% This is a LaTex file.
% Homework for the course "Scientific Computing",
% Spring semester, 1996, Jonathan Goodman.
% A latex format for making homework assignments.
\documentstyle[12pt]{article}
% The page format, somewhat wider and taller page than in art12.sty.
\topmargin -0.1in \headsep 0in \textheight 8.9in \footskip 0.6in
\oddsidemargin 0in \evensidemargin 0in \textwidth 6.5in
\begin{document}
% Definitions of commonly used symbols.
% The title and header.
\noindent
{\scriptsize Scientific Computing, Spring 1996} \hfill
\begin{center}
\large
Assignment 1.
\normalsize
\end{center}
\noindent
Given January 22, due January 29.
\vspace{.3in}
% The questions!
\noindent
{\bf Objectives:} (1) To warm up to programming with good habits, (2) To
illustrate basic numerical ideas.
\vspace{.5cm}
We want to study the function
\begin{equation}
f(x) = \int_0^1 \cos \left( xt^2 \right) dt \;\; .
\end{equation}
\begin{description}
\item[Step 1:] Write a program to estimate $f(x)$ using a panel integration
method. The program should be modular, well documented, robust, and clean.
At the lowest level should be a procedure that takes as input $x$ and
$n = 1/\Delta t$ and returns the approximate integral with that
$x$ and $\Delta t$ value. This routine should be written so that another
person could easily substitute a different panes method by changing a few
lines of code.
\item[Step 2:]
Verify the correctness of the program by checking that it gives the right
answer for small $x$. We can estimate $f(x)$ for small $x$ using a few
terms of its Taylor series. This series can be computed by integrating the Taylor series for $\cos(xt^2)$ term by term.
\item[Step 3:] With $x=1$, do a convergence study to verify the second
order accuracy of the trapezoid rule and the fourth order accuracy of
Simpson's rule.
\item[Step 4:]
Write a routine that uses the routine from Step 1 and Richardson estimation
to find an $n$ that gives $f(x)$ to within a specified error tolerance.
The input should be $x$ and the desired error bound. The output should
be the estimated value of $f$ and the number of points used. This routine
should be robust enough to quit and report failure if it is unable to
achieve the requested accuracy.
\item[Step 5:] For large $x$ we have the approximation
\begin{equation}
f(x) \sim \sqrt{\frac{\pi}{x} } + \frac{1}{2x}\sin(x)
- \frac{1}{4x^2} \cos(y) + \cdots \;\; .
\end{equation}
Make a few plots showing $f$ and its approximations using one, two and
all three terms on the right side of (2) for $x$ in the range
$1 \leq x \leq 1000$. In all cases we want to evaluate $f$ so accurately
that the error in our $f$ value is much less than the error of the approximation
(2). Note that even for a fixed level of accuracy, more points are needed
for large $n$. Why?
\end{description}
\end{document}