\documentclass[12pt]{article}
\usepackage{fullpage,amsmath,amsfonts}

\newcommand{\x}{\boldsymbol{x}}
\renewcommand{\v}{\boldsymbol{v}}
\newcommand{\w}{\boldsymbol{w}}
\renewcommand{\a}{\boldsymbol{a}}
\renewcommand{\b}{\boldsymbol{b}}
\renewcommand{\c}{\boldsymbol{c}}
\newcommand{\e}{\boldsymbol{e}}
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\newcommand{\Range}{\operatorname{Range}}
\newcommand{\Ker}{\operatorname{Ker}}
\newcommand{\Span}{\operatorname{Span}}
\renewcommand{\dim}{\operatorname{dim}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}


\begin{document}

\title{Numerical Methods I -- Problem Set 1}
\author{Homework due September 12, 2003}
\date{Projects due September 15, 2003}
\maketitle

\noindent

\begin{enumerate}

\item 
\begin{enumerate}
\item The IEEE 754 floating point format has the useful property that
the ordering of numbers is preserved when all the bits are interpreted
as a sign-magnitude integer.  Explain briefly why this is the case.

\item The introduction of subnormals into the IEEE floating point
standard was considered a significant advance.  What useful property
of was lost if subnormals were not present?

\emph{Hint:} Think about the distance between zero and the two
smallest positive floating point numbers.
\end{enumerate}

\item 
\begin{enumerate}
\item Explain the following \textsf{Octave} result:
\begin{verbatim}
octave:1> log(1+3e-16)/3e-16
ans = 0.74015
\end{verbatim}
(Example due to L. Vandenberghe.)

\item Use \textsf{Octave} to compute $\sin(1.0 \times
10^{20}\pi$).  What goes wrong?

\item The following \textsf{Octave} Program has a subtle bug.  Can you
fix it?
\begin{verbatim}
  x = 0.0;
  d = 0.1;
  while x <> 1.0
    x = x + d;
  end 
  x
\end{verbatim}
\end{enumerate}

\item Find the condition number of evaluating $y=\sqrt{x}$ near $x=1$
and $x=0$.

\item Given a smooth function $f(x)$ with a simple zero at $x=x_0$,
and a smooth bounded function $g(x)$.  Let
\[
  h(x) = f(x) + \varepsilon \, g(x) \,.
\]
Show that when $\varepsilon$ is small, $h(x)$ has a zero at
$x=x_0+\delta$, where
\[
  \delta \approx - \varepsilon \, \frac{g(x_0)}{f'(x_0)} \,.
\]
When is the problem well, and when is it ill conditioned?

\item \textbf{Project:} Find the roots of the quadratic equation
\[
  x^2 + p \, x + 1 = 0
\]
by using the standard formula.
\begin{enumerate}
\item Show that the zeros are approximately $-p$ and $-1/p$ when $p$
is large.
\item Let \textsf{Octave} compute the zeros when $p=10^{10}$.  What do
you get?
\item Can you rewrite the solution formula so that the computation is
stable? 
\end{enumerate}


\item \textbf{Project:} (From QS, p.\ 6) The sequence defined by
\begin{gather*}
  z_2=2 \,, \\
  z_{n+1} = 2^{n-1/2} \sqrt{1-\sqrt{1-4^{1-n}z_n^2}}
  \qquad \text{for } n=2,3,\dots\,,
\end{gather*}
converges to $\pi$ as $n\to \infty$.

\begin{enumerate}
\item Write an \textsf{Octave} program that plots the logarithm of the
error vs.\ $n$.
\item Explain why the error grows when $n$ gets larger than about
$16$.
\item Why does this sequence converge to $\pi$?
\item Can you improve the stability of this algorithm?
\end{enumerate}


\end{enumerate}
\end{document}
