\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 -- Lab 2}
\author{Fall Semester 2005}
\date{September 20, 2005}
\maketitle

\noindent

\begin{enumerate}

\item Determine, numerically, the error behavior of Problem~1 from
Lab~1. 

\emph{Recall:} The limit
\begin{gather*}
  C = \lim_{n\to\infty} c_n = 0.577\,215\,664\,901\,532 \dots 
  \qquad \text{with} \qquad
  c_n = \sum_{k=1}^n \frac1k - \ln n
\end{gather*}  
is called Euler constant.

\begin{enumerate}
\item Write an \textsf{Octave} function for computing $c_n$ which
accepts as optional input $c_m$ for $1 \leq m < n$.  Test its
performance (runtime and absolute error with respect to the given
value for $C$) for $n \leq 10^7$.

\item Verify numerically (again for $n \leq 10^7$) that the
approximation error satisfies 
\begin{gather*}
  E_n \equiv c_n - C = \frac1{2n} + O\Bigl(\frac1{n^2}\Bigr)
\end{gather*}
as $n\to\infty$.  Assuming that this relation holds, compute a new
sequence
\begin{gather*}
  d_n = 2 \, c_{2n} - c_n
\end{gather*}
and check the new error sequence $F_n \equiv d_n - C$ numerically.
Explain the result!

\end{enumerate}

\item Show, numerically, that the iteration 
\begin{equation*}
  y_{n+1} = 1 - \cos(y_n)
\end{equation*}
converges to zero with order $2$.

\end{enumerate}
\end{document}
