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 011.622=+−xx, using four-digit arithmetic we compute: b2−4ac=fl((−62.1)2)−4=fl(3856.41)−4=3856−4=3852=fl(62.0645)=62.06therefore if we use four-digit arithmetic and the quadratic formula, the two roots will be: fl(r1)=−b+b2−4ac2a=(62.1+62.06)2=62.08fl(r2)=−b−b2−4ac2a=(62.1−62.06)2=0.02But the roots of the equation, 011.622=+−xx(to seven decimal places) are 0838928.621=rand 0161072.02=r. If we round these numbers to four digits, we will have 08.621=rand 01611.02=r. What we found instead are fl(r1)=62.08 and fl(r2)=0.02. So the relative errors are |||)(|111rrrf−= 0.0 and |||)(|222rrrf−=24.001611.000389.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 issubtractive cancellation, which occurs when two close numbers are subtracted (in this case b=62.1 and 06.6242≈−acb). 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.