# HW1 Sol - EE 103 Winter 09 Prof SEJ HW 1 Sol Applied...

• Notes
• 12

This preview shows pages 1–4. Sign up to view the full content.

EE 103, Winter ’09, Prof SEJ: HW 1 Sol. Page 1 of 12 Applied Numerical Computing Instructor: Prof. S. E. Jacobsen HW1 Solution Students: Distributed HW solutions are a component of the course and should be fully understood. SEJ Problem 1) To find the roots of the equation 0 1 1 . 62 2 = + x x , using four-digit arithmetic we compute: b 2 4 ac = fl (( 62.1) 2 ) 4 = fl (3856.41) 4 = 3856 4 = 3852 = fl (62.0645) = 62.06 therefore if we use four-digit arithmetic and the quadratic formula, the two roots will be: fl ( r 1 ) = b + b 2 4 ac 2 a = (62.1 + 62.06) 2 = 62.08 fl ( r 2 ) = b b 2 4 ac 2 a = (62.1 62.06) 2 = 0.02 But the roots of the equation, 0 1 1 . 62 2 = + x x (to seven decimal places) are 0838928 . 62 1 = r and 0161072 . 0 2 = r . If we round these numbers to four digits, we will have 08 . 62 1 = r and 01611 . 0 2 = r . What we found instead are fl ( r 1 ) = 62.08 and fl ( r 2 ) = 0.02 . So the relative errors are | | | ) ( | 1 1 1 r r r f = 0.0 and | | | ) ( | 2 2 2 r r r f = 24 . 0 01611 . 0 00389 . 0 The percentage error for the second root is approximately 24%. This error is very large and clearly unacceptable. The reason for this large error is subtractive cancellation, which occurs when two close numbers are subtracted (in this case b=62.1 and 06 . 62 4 2 ac b ). while at least one of them is subject to error (here we have error due

This preview has intentionally blurred sections. Sign up to view the full version.