Programming Assignment One

Your work should be presented in the form of a typed report using clear and properly punctuated English. Where appropriate include full program listings and output. If you choose to work in a group of two, please turn in independently prepared reports.


\def\R{{\bf R}}
\hangindent\parindent
\item{1a.}  Given $x\in\R$ let $x^*$ denote the
floating point approximation of $x$.
Write a program 
to find the greatest $\delta_1$ such that
$$
	(x^*+\delta_1)^*=x^*.$$
You may use the bisection method
with initial interval of $[0,x^*]$.
Run your program 
for $x^*$ ranging over the set
$\{\,1,2,3,4,5,10,100,1000\,\}$
using single precision floating point
and again using double precision.
\bigskip
\hangindent\parindent
\item{b.}  For $x\in\R$ fixed define
$$
	\delta_2=\min\big\{\,\delta:(x^*+\delta)^*=x^*\,\big\}.$$
Write a program to determine whether $\delta_1=-\delta_2$.
What happens theoretically when chopping
is used for $x^*$?  How about when rounding is used?
\bigskip
\hangindent\parindent
\item{c.}  Let $J$ be a bounded subset of $\R$.
Define $J^*=\{\,x^*:x\in J\,\}$
and $I=\{\,x: x^*\in J^*\,\}$.
The maximum
relative error
$$
	\epsilon=\max_{x\in I}{|x-x^*|\over |x|}
	\ge \max_{x\in I}{|x-x^*|\over |x^*|+|x-x^*|}
	= \max_{x^*\in J^*}{\delta\over |x^*|+\delta}
$$
where $\delta=\max\{\,\delta_1,-\delta_2\,\}$.
Since relative error is bounded by $5\times 10^{-n}$
where $n$ is the number of significant digits, then
$$
	n\le \log_{10}\bigg\{
		5\min_{x^*\in J^*}\Big( {|x^*|+\delta\over\delta}\Big)
		\bigg\}.
$$
Write a program to compute this upper bound for $n$
using both single and double precision floating point.
Take the set $J^*=\{\,1,2,3,4,5,10,100,1000\,\}$.


Last updated: Tue Sep 10 11:03:56 PDT 2002