\documentstyle[12pt]{article}
%\documentstyle[12pt,ncs]{article}
\topmargin=-1.25in
\oddsidemargin=0in
%\evensidemargin=0in
\textwidth=6.5in
\textheight=10.5in
\parindent=0in
%\parskip=10pt
\pagestyle{empty}

%\newfont{\cmss}{cmss12.tfm}
\tolerance=3000
%\setcounter{chapter}{1}

\begin{document}

\input 370top

\centerline{{\it Class 4}: {\bf Monday September 9}}

\begin{description}
\item[SUMMARY] Examples of Round-Off Errors
\vspace*{-12pt}
\item[CURRENT READING] Burden \& Faires Sections 1.2 and 1.4
\end{description}

{\it\large Loss of Significance}\\
Consider the numbers $a = 0.54617$ and $b=0.54601$.
Compute $c = a \ominus b$ using 4-digit chopping and then 4-digit rounding arithmetic.
%\vspace{1in}
\vfill
Compute the relative error in $c$ using chopping and rounding arithmetic
\vfill
{\bf 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
\vspace{24pt}
Then let's write down the representation of $fl(fl(x)-fl(y)$
\vfill
\vfill

{\it\large 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} \qquad \mbox{  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 =  $ \hspace{1.5in} $b^2= $ \hspace{1.5in}  $4ac = $ \hspace{1.5in}  $b^2 - 4ac = $\\

\newpage
\underline{\sc Groupwork}\\
Using 4-digit rounding arithmetic compute the first root $x_1$
\vfill
What's the relative error in this calculation?
\vspace{24pt}
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 =  $
\vspace{24pt}


Use a similar new formula to compute $x_2$ (using 4-digit precision) and compute the relative error in $x_2$
\vfill
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.\\

{\it\large The Ultimate Quadratic Formula}\\
$$q \equiv - \frac{1}{2} \left[b + \mbox{sign}(b) \sqrt{b^2 - 4ac} \right]$$
where 
$$
\mbox{sign(b)}=\left\{ 
\begin{array}{rl}
1 & b \ge 0\\
-1 & b < 0
\end{array}
\right.
$$
and $$x_1 = \frac{q}{a} \qquad \mbox{ and } x_2 = \frac{c}{q}$$

{\it\large Machine Precision}\\
There is a number $\eps_m$ such that $1 + \delta = 1$ whenever $\delta < \eps_m$

What is $\eps_m$ equal to in {\bf exact arithmetic}?\\
\bigskip
How would you compute the machine precision of {\bf your} calculator? Developan algorithm.

\centerline{\bf ANNOUNCEMENTS}
Class is cancelled on Friday September 11. \\
{\bf Quiz 2} is due on Monday September 14 in class.

\end{document}
