\documentstyle[11pt]{article}
\setlength{\textwidth}{7.5in}
\setlength{\evensidemargin}{-.5in}
\setlength{\oddsidemargin}{-.5in}
\renewcommand{\theequation}{\arabic{equation}}


\begin{document}

\begin{center}
Final Project \\
MA/CS 375, Spring 2002 \\
Due 12:00 noon on Monday, May 6 \\
Turn in to me at my office, Hum 432 \\
\vspace{.1in}
{\bf TURN IN TESTS OF ALL FUNCTIONS YOU WRITE! }\\
Usual rules apply; format and appearance is important!

\vspace{.1in}
\end{center}

The project is to implement and test a program for computing polynomial
interpolants on Chebyshev nodes using the Fast Fourier Transform (FFT).
The key to this is the representation of the interpolant, $P(x)$, in
the Chebyshev basis:
\begin{equation}\label{expand}
P(x) = \sum_{j=0}^{n} a_{j} T_{j} (x) ,
\end{equation}
where the $j$th Chebyshev polynomial is given by
\begin{equation}
T_j(x) = \cos{(j \arccos{x})}\  , \ \ \mbox{ or } \  T_j(\cos{t}) = \cos{(j t)}.
\end{equation}
Using trigonometric identitites, it can also be shown that:
\begin{equation}\label{recurse}
T_{0}(x) = 1, \ \ T_{1}(x) =x, \ \ T_{j}(x) = 2xT_{j-1}(x) - T_{j-2} (x) ,
\ j \geq 2.
\end{equation}
(You may remember using this recursion relation in homework 1.)

%_________________________________________________________________________
% ADDENDUM: THE DISCRETE COSINE TRANSFORM AS USED FOR CHEBYSHEV TRANSFORMS
(NOTE: {\bf{The discrete cosine transform is its own inverse!}\\
The following formulas can be useful for validating your results!
\[ f_k = \sum_{m=0}^{M} F_m \cos{\frac{\pi k m}{M}} , \]
\[ F_n = \frac{2 c_n}{M} \sum_{k=0}^{M} c_k f_k \cos{\frac{\pi k n}{M}} .\]
where $f_k = f(x_k)$ are the grid values of the function $f(x)$,
$F_n$ are the expansion coeficients and the quantities $c_k$ are defined as
$c_k = 1$ for $k=1:M-1$ while $c_0 = c_M = 1/2$. })
%_________________________________________________________________________

\begin{description}
\item[(i.)] Argue that each member of the canonical basis for the polynomials,
$x^n$, can be expressed in terms of the Chebyshev polynomials:
\begin{equation}\label{canon}
x^n = \sum_{j=0}^{n} d_{j} T_{j} (x) .
\end{equation}
You need not find the coefficients $d_j$ explicitly, but simply show that they
can be constructed. Note that $T_j(x)$ is a degree $j$ polynomial which by
the recursion relation (\ref{recurse}) may be written in the form:
\begin{equation}\label{lot}
T_j(x) = 2^{j-1} x^{j} + \ \ {\rm lower~~order~~terms} .
\end{equation}
Explain why this implies that any polynomial of degree $n$ can be expressed in
the form (\ref{expand}).
\item[(ii.)] Consider the polynomial interpolation problem using Chebyshev
nodes and the Chebyshev expansion (\ref{expand}):
\begin{equation}\label{interp}
P(x_i) = \sum_{j=0}^{n} a_{j} T_{j} (x_i) = y_i , \ \ i=0,\ldots,n ,
\end{equation}
\begin{equation}\label{Chbpts}
x_i = \cos{\left( \frac {i}{n} \pi \right)} .
\end{equation}
(Note these are a slightly different set of Chebyshev nodes than used in
class which include the endpoints. They also lead to stable interpolation.)
Making the change of variables:
\begin{equation}
x = \cos{t} ,
\end{equation}
show that the interpolation problem (\ref{interp})-(\ref{Chbpts}) is
equivalent to the trigonometric interpolation problem:
\begin{equation}\label{cosint}
a_0+\sum_{j=1}^{n-1} a_j \cos{j t_i}+a_n \cos{n t_i} = y_i ,
 \ \ t_i = \frac {i}{n} \pi , \ \ i=0, \ldots, n.
\end{equation}
By equivalent we mean that the same coefficients, $a_j$, solve each problem.
\item[(iii.)] Problem (\ref{cosint}) differs from the standard interpolation
problem of Section 2.4.4 by the absence of the $\sin{jt}$ terms. Consider the
even extension of the data, adding nodes in $(\pi , 2 \pi)$ by the prescription:
\begin{equation}\label{extend}
y_i = y_{2n-i}, \ \ t_i = \frac {i}{n} \pi , \ \ i=n+1 , \ldots , 2n.
\end{equation}
We now have $2\pi$-periodic data. We can thus compute a full trigonometric
interpolant, involving both $\cos{jt}$ and $\sin{jt}$, using the FFT-based
function you wrote for problem 5.4.2. However, due to the fact that:
\begin{equation}
\cos{(j t_i)} = \cos{(j t_{2n-i})} , \ \ \sin{(j t_i)} = -\sin{(j t_{2n-i})} , \ \
i=n+1, \ldots, 2n ,
\end{equation}
the coefficients of the sine term vanish (in exact arithmetic). Therefore,
the output of your FFT-based trigonometric interpolant, given the extended
dataset (\ref{extend}), are the coefficents $a_j$ in (\ref{cosint}) and, hence,
(\ref{interp}). Modify your function from 5.4.2
to solve (\ref{cosint}) via FFTs applied to the extended dataset. Verify that
the sine coefficients are negligibly small.
\item[(iv.)] Use the function written in (iii.) to solve the polynomial interpol
ation
problem on Chebyshev points, (\ref{interp}).
\item[(v.)] For the Chebyshev series to be useful, we must be able to evaluate it.
Write a function which takes as input the coefficients, $a_j$, computed by the
function written for part (iv) and a set of points, $z$, and returns:
\begin{equation}
\sum_{j=0}^{n} a_j T_{j} (z) .
\end{equation}
To do this efficiently, i.e. with $O(n)$ flops, use the recursion (\ref{recurse}
).
\item[(vi.)] Demonstrate the accuracy and efficiency of your code by carrying
out at least the following experiments:
\begin{enumerate}
\item For $n$ chosen so that FFTs of vectors of length $8$, $16$, $32$, $64$ and
$128$ are required, i.e. $n=4,8,16,32,64$, verify the accuracy of your functions
by interpolating random data and computing the norm of the relative residual of
the interpolation equations. That is, evaluate the interpolant at the nodes and
find the maximum error normalized by the maximum data value. Comment on the results. 
\item For the same choices of $n$, find the number of flops required to compute
the
coefficients and verify that it grows like $n \ln{n}$. Also record the number of
flops required to evaluate the interpolant at a single point and verify that it
grows like $n$.
\item Use your functions to interpolate:
\begin{equation}
\cos{(kx)} e^{-2x^2} , \ \ k=1,10,30 .
\end{equation}
Try the values of $n$ above, and find the maximum error on $100$ equally  
spaced nodes. What is the smallest value that produces an error less than
$.001$? For each value of $k$ plot the function along with representative
interpolants. Don't bother to increase $n$ once the error tolerance of
$.001$ is attained.
\end{enumerate}
\end{description}
\end{document}
