
%\documentstyle{siam}
\documentclass[final,psfrag,twoside,epsfrag]{article}
\input{zmacros}
\textwidth 6.4in
\textheight 9in
\oddsidemargin -0.3in
\evensidemargin -0.3in
\topmargin -.5in

%\input{zmacros.tex}
\def\be{\begin{enumerate}}
\def\ee{\end{enumerate}}
%\newcommand{\vthin}{\vskip 5pt}


\pagestyle{empty}
\begin{document}
\hfill\vbox{\hbox{MA 780}\hbox{Homework \#3}
\hbox{\bf Due  March 4}}
\vskip .2in
\baselineskip 14pt


\be

\item (a): Consider a triangle  whose vertices are   ${\bf x}_i=(x_i,y_i)$, $i=1,2,3$. Assume that the area of the triangle is no-zero.  Show that there is a unique linear function $u_h(x,y)=a_{0,0} + a_{1,0} x + a_{0,1} y$ that interpolates a function $f(x,y)$ at three vertices. 
Thus, the interpolation can be written as $u_h({\bf x}) = \sum_{i=1}^3 f ({\bf x}_i ) \phi_i(  {\bf x})$, where $\phi_i(  {\bf x})$ is the basis functions satisfying $\phi_i(  {\bf x}_j)=\delta_i^j$.

\vthin

(b):  {\bf Optional:} Assuming that $f({\bf x} )\in C^2$ and $h$ is the longest side of the triangle, show that $| f({\bf x} ) - u_h ({\bf x} )| \le C h^2$. So the interpolation is second order accurate. 

\vthin

\item Fin and list  the Newton-Cotes coefficients,  closed and open, for $0\le n \le 6$. Which ones are stable? {\bf Hint:} Use a symbolic software package, for example, Maple. 

\vspace{-0.5cm}

\item \null
\be \item
\vthin Show that the Simpson quadrature rule has algebraic precision $3$ by
testing the polynomial basis function $\{1,x,x^2,x^3, x^4\}$. Therefore the
Simpson quadrature rule is exact for any polynomial of $p_k(x)$ of degree
$k\le 3$.

\vthin
\item Consider the polynomial interpolation
\eqmno
&& p_3(a) = f(a), \qquad p_3(b)=f(b), \\
&& p_3(c) = f(c), \qquad p_3'(c)=f'(c), \qquad c= \fr{a+b}{2}.
\enmno
We know that
\eqmno
f(x)-p_3(x) = \fr{f^{(4)}(\xi(x))}{4!} (x-a)(x-c)^2 (x-b)
\enmno
assuming $f(x)\in C^4(a,b)$.
Use the error estimate above to show that
\eqmno
\int_a^b f(x) dx - \fr{b-a}{6} \lp f(a) + 4 f(c) + f(b) \rp =
- \fr{(b-a)^5}{2880} f^{(4)}(\eta).
\enmno

\vthin \item
Using the error estimate above to show the following error estimate for
the composite Simpson rule:
\eqmno
 \int_a^b f(x)dx -S_n = -\fr{b-a}{2880} f^{(4)}(\eta)\, h^4.
\enmno
\ee


\item Assume that $\fr{f^k(x)}{k!}$ are all $O(1)$ quantities for all $k$'s. If we wish to
approximate $\int_0^1 f(x) dx$ with different quadrature methods such that
the error is less than $10^{-10}$, estimate the smallest $n$ that is needed for
the following methods:
\be
\item Composite trapezoidal formula.
\item Composite Simpson formula.
\item Romberg method.
\ee

\item \be \item Find the coefficients of the following quadrature
\eqmno
\int_0^1 f(x) dx \approx \alf_1 f(0) + \alf_2 f(1) + \alf_3 f'(0).
\enmno
\item
What is the algebraic precision of the quadrature formula?
\item Can you give an error estimate?
\ee

\item Find $x_1$ and $x_2$ such that the following quadrature
\eqmno
\int_{-1}^1 f(x) dx \approx \fr{1}{3} \lp f(-1) + 2 f(x_1) + 3 f(x_2)\rp
\enmno
has as high algebraic precision as possible.

\ignore{
\item % Derive the convergence estimate (9.39) and the posterior error
 %estimate (9.40) for the composite Simpson quadrature formula.
 Let $S_n$ be the error of the composite Simpson quadrature formulae, show that
\eqmno
&& R_{2n} =   \int_a^b f(x) dx - S_{2n} \approx \fr{1}{16} \lp \int_a^b f(x) dx
- S_n \rp  = \fr{R_n}{16} \\ \eqsp
&& R_{2n} = \int_a^b f(x) dx- S_{2n} \approx \fr{S_{2n}-S_n}{15}.
\enmno


\vthin}

\vthin
\item Reformulate the following integrals to normal integrals.
\be
\item $\dsp \int_0^1  x^2  \log x  dx$.
\item $\dsp \int_1^{\infty} \fr{dx}{(1+x) \sqrt{x}}$.
\item $\dsp \int_0^{\pi} \fr{\sin x} { x^{\mu}} dx$, $\quad 0< \mu<2$.
\ee

\vthin
\vthin
\item Implement Romberg integration to approximate $\int_{a}^b f(x) dx$:
\be
\item $a=0$, $\dsp b=\fr{\pi}{2}$. $\dsp f(x)=\fr{5 e^{2x}}{e^{\pi} -2 }$.
 Note that $\int_0^{\pi/2} f(x) dx = \fr{5(e^{\pi}-1)}{2 (e^{\pi}-2)}$.
\item $a=0$, $b=1$, $f(x)=x^2 \log(x)$, where $\log(x)$ is the natural
logarithm. You should be able to find the
exact solution by integration by parts. \ ( {\bf Hint:} Use $\log(x)\approx
\log(x + \epsilon)$ to avoid the singularity. Take $\epsilon=10^{-16}$, for
example).
\item Find the circumference (its length) of the ellipse $x^2 +
\fr{y^2}{4}=1$. \ ({\bf Hint:} $L=\oint ds$. Write down the ellipse in
terms of the parametric form $x=\cos t$; $y=2\sin t$,
$ds=\sqrt{dx^2 + dy^2}$).
\ee
Use the computed approximations
 to estimate the errors. Analyze
the results and compare with the
exact error if possible.
\ee
\end{document}
