\documentclass[10pt,letterpaper]{article}
\usepackage{graphicx,verbatim,amsmath,amssymb}
\usepackage[colorlinks=true]{hyperref}
\topmargin -0.5in
\textheight 9in
\oddsidemargin=-0.05in
\evensidemargin=-0.05in
\textwidth 6.5in
\pagestyle{empty}
\def\bea{\begin{eqnarray}}
\def\eea{\end{eqnarray}}
\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
\newcommand\ben{\begin{enumerate}}
\newcommand\een{\end{enumerate}}
\newcommand\vg{\vspace{2ex}}
\newcommand{\bc}{\begin{center}}
\newcommand{\ec}{\end{center}}
\newcommand{\ie}{{\it i.e.\ }}
\newcommand{\eg}{{\it e.g.\ }}
\newenvironment{tight}{\vspace{-1ex}\begin{list}%
{$\bullet$}{\setlength{\parsep}{0in} \setlength{\itemsep}{-2ex}}}%
{\end{list}\vspace{-1ex}}
\newcommand{\bt}{\begin{tight}}
\newcommand{\et}{\end{tight}}
\newcommand{\eps}{\varepsilon}
\newcommand{\mbf}[1]{{\mathbf #1}}
\newcommand{\xx}{\mbf{x}}
\newcommand{\uu}{\mbf{u}}
\newcommand{\vv}{\mbf{v}}
\newcommand{\nn}{\mbf{n}}
\newcommand{\bb}{\mbf{b}}
\begin{document}
\title{Math 116 Numerical PDEs: Homework 3}
\date{due Mon 9am, Jan 30}
\maketitle
{\em Complex analysis keeps coming up this week, crucial to understand
quadrature convergence!}
\ben
\item Visualizing \& understanding functions on $\mathbb{C} \to\mathbb{C}$
\ben
\item Make a 3D height plot of absolute value of $f(z) = (1+25z^2)^{-1}$
over the complex box Re $z, $ Im $z \in [-1,1]$.
Choose a good vertical scale.
Where, and of what type, are any singularities?
[Hint: look up {\tt [xx, yy] = meshgrid }\dots\; then use {\tt zz = xx+1i*yy;}]
\item Do the same for $f(z) = e^{-1/z}$. (Ask if stuck about the singularity
type.)
\item [BONUS] Get \verb#z2rgb_kawski.m# from the website and try the following
given the {\tt zz} data from (a) or (b):
\verb#surf(xx, yy, 0*xx, z2rgb_kawski(zz)); view(2); shading interp#
Black is vanishing size and white is size $\infty$,
but what new information is shown?
%(You don't have to hand include plots unless you want to).
\een
\item Prove that, given a set of distinct points $\{x_j\}_{j=0,\dots n}$
in $[a,b]$ there exists a {\em unique} set of weights
$\{w_j\}_{j=0,\dots, n}$
such that Newton-Cotes quadrature integrates exactly over $[a,b]$ all
polynomials up to degree $n$. Use a different method than the two in lecture.
[Hint: proof is one line. Write the equations the weights must satisfy for the
monomial basis for $\mathbb{P}_{n}$.]
\item Consider numerical integration of $(1+4x^2)^{-1}$ on $[-1,1]$
(note: exact answer easy).
Compare with suitable plots the convergence vs $n=1,\ldots,40$
of the quadrature error using $n+1$ equally-spaced nodes using the
following two schemes for weights:
\ben
\item Composite trapezoid rule.
Choose axes so that the convergence is a straight line.
Does it match the theorem from lecture?
\item Newton-Cotes, \ie interpolatory quadrature. Here you will need to
get the weights from solving a simple linear system.
[Hint: see previous question.] What is the minimum-achievable error?
\een
\item Get from the website
{\tt gauss.m} which provides nodes and weights of $(n+1)$-node
Gaussian quadrature on $[-1,1]$.
Use this to produce convergence plots of quadrature error
for the integrals of the following functions on $[-1,1]$.
%(If possible make a single figure with 3 labeled subplots in it.)
Note, in each case you can compute the analytic answer to compare to.
\ben
\item $(1+4x^2)^{-1}$ (is performance better than in question \#3?)
\item $x^{20}$
\item $|x|^3$
\een
Measure the order (if algebraic) or rate (if exponential, i.e.\ give $\alpha$
in $Ce^{-\alpha n}$) of convergence
in each case, or state another kind of behavior, as appropriate.
Discuss reasons for what you observe---in one case you should have a theorem,
but in the others just intuition is fine (theorems there require extra
reading and are thus BONUS).
%BONUS: In the last case, can you think of a
%way to handle this type of problem while preserving high convergence rate?
%See p.36 Spect Meth, p. 130.
\item We discussed that given an inner product $(\cdot,\cdot)$ on $L^2[-1,1]$
a sequence $(q_n)$ of orthogonal polynomials can be constructed by applying
the
Gram-Schmidt procedure from linear algebra to the monomials $1,x,x^2,\dots$.
Prove that the following 3-term recurrence relation also constructs them:
\bea
q_{-1}(x) &=& 0 \nonumber \\
q_0(x) &=& 1 \nonumber \\
q_{j+1}(x) & = & x q_j(x) -\alpha_{j+1} q_j(x) - \beta_{j+1} q_{j-1}(x),
\qquad j=0,1,2,\ldots \nonumber
\eea
where $\alpha_{j+1} := (q_j,xq_j)/(q_j,q_j)$ and $\beta_{j+1} :=
(q_j,q_j)/(q_{j-1},q_{j-1})$ with the exception of $\beta_1 = 0$.
[Hint: one approach is to start with Gram-Schmidt and notice all but two
projection terms vanish. Another is to prove that the above recurrence
generates a {\em mutually} orthogonal set, i.e.\ orthogonal to all lower poly's.
To make life easier, use a shorthand notation such as $(xj,j+1)$ for
$(xq_j,q_{j+1})$.]
\item Compare error convergence ({\tt semilogy} plots)
for the integrals over $[0,2\pi)$ of the
following three $2\pi$-periodic functions using the periodic trapezoid rule,
in each case explaining how analyticity (where are singularities? qu. \#1
may help)
controls convergence rate:
\ben
\item $(1/2\pi)e^{\cos x}$. The exact answer is the modified Bessel function $I_0(1)$ which in Matlab is {\tt besseli(0,1)}.
\item $\left( 1+\cos^2(x/2)\right)^{-1}$.
Since exact answer not easy, just use the value found once converged.
Please quote this to 15 digits. Also, please add to your plot the
predicted best rate from Thursday's lecture, which should agree.
\item $\exp(-1/|\sin(x/2)|)$. Go out to $n=300$, ignore the `scalloping' effect and instead look at overall behavior.
\een
[Hints: The coding is very easy here.
One of the functions is $C^\infty$ but not real analytic on $[0,2\pi)$.
Recall that the composition of entire functions is entire.
Also you may need $\sin(ix) = i\sinh(x)$.]
%\item Show that the Lagrange polynomial for trigonometric interpolation
%$l_k(x) = \frac{1}{2n}\sum_m' e^{im(x-x_k)}$ can be written
%\frac{1}{2n} \cot \left(\frac{x-x_k}{2}\right) \sin n(x-x_k)$.
%\item solve an integral eqn diagonal in Fourier,
%such as bvp on unit disc.
%\item Nystr\"{o}m method for simple IE on $[0,1]$ from Atkinson?
\een
\end{document}