Numerical Analysis

Math 370 Fall 1998  MWF 11:30am - 12:25pm
\begin{matrix}c \\ ◯ \end{matrix}1998 Ron Buckmire  Fowler 127

Class 4: Monday September 9

SUMMARY Examples of Round-Off Errors CURRENT READING Burden & Faires Sections 1.2 and 1.4

Loss of Significance

Consider the numbers a = 0.54617 and b = 0.54601. Compute c = a ⊖ b using 4-digit chopping and then 4-digit rounding arithmetic.

Compute the relative error in c using chopping and rounding arithmetic

Example Consider two numbers x and y which have k-digit decimal representations where p digits (p < k) are the same. Let’s write their decimal number representation fl(x) and fl(y) below Then let’s write down the representation of fl(fl(x) − fl(y)

Round-off Errors in the Quadratic Formula

Recall that the common formula for the roots of a quadratic equation ax^{2} + bx + c = 0 is

x_{1} = \frac{−b + \sqrt{b^{2} − 4ac}}{2a} and x_{2} = \frac{−b − \sqrt{b^{2} − 4ac}}{2a}

Round-off error can wreak havoc with the numerical implementation of this formula. Consider

x^{2} + 62.10x + 1 = 0

which has the approximate roots x_{1} = −0.01610723 and x_{2} = −62.08390 Because of the size of the parameters in the quadratic equation, b^{2} is much bigger than 4ac, so \sqrt{b^{2} − 4ac} is very close to b

b =  b^{2} =  4ac =  b^{2} − 4ac =

\underline{Groupwork} Using 4-digit rounding arithmetic compute the first root x_{1}

What’s the relative error in this calculation? Solution: change the formula for x_{1} so that we

don’t have to subtract b from \sqrt{b^{2} − 4ac} Now, a new formula for x_{1} =

Use a similar new formula to compute x_{2} (using 4-digit precision) and compute the relative error in x_{2}

What’s the problem? Solution: Use the new formula for x_{1} when you have to subtract numbers which are similar in size, use the traditional formula for the other root.

The Ultimate Quadratic Formula

q ≡ −\frac{1}{2} [b + sign(b)\sqrt{b^{2} − 4ac}]

where

sign(b) = \{ \begin{matrix}1 & b ≥ 0 \\ −1 & b < 0 \end{matrix}

and

x_{1} = \frac{q}{a} and x_{2} = \frac{c}{q}

Machine Precision

There is a number ϵ_{m} such that 1 + δ = 1 whenever δ < ϵ_{m} What is ϵ_{m} equal to in exact arithmetic? How would you compute the machine precision of your calculator? Developan algorithm.

ANNOUNCEMENTS

Class is cancelled on Friday September 11. Quiz 2 is due on Monday September 14 in class.