\documentclass[10pt]{article}
\usepackage{calc}
\usepackage{url}
\usepackage[margin=1.2in]{geometry}
\usepackage{setspace}
\usepackage{amsmath,amsthm,amssymb,fancybox,ifthen,float}
\usepackage{bm}
\usepackage{color}
\usepackage{parskip}
\usepackage{comment}
\usepackage{isomath}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[L]{\small Spring 2018 MATH-UA 252.001}
\fancyhead[C]{\small NYU Courant}
\fancyhead[R]{\small Prof. M. O'Neil}
\fancyfoot[C]{\thepage\ of \pageref{LastPage}}
\usepackage{parskip}
%%%%\onehalfspacing
\newcommand{\matlab}{\textsc{Matlab}}
\newcommand{\vct}{\vectorsym}
\newcommand{\mtx}{\matrixsym}
\newcommand\horline{\begin{center}\line(1,0){250}\end{center}}
\DeclareMathOperator{\trace}{trace}
\begin{document}
\Large
%\noindent
\begin{center}
{\bf Homework 6}\\
\normalsize
Due: 12:30pm May 3, 2018
\end{center}
\normalsize
\vspace{.25in}
\horline
Notes on the assignment:
\textbf{Submission}: Homework assignments must be submitted in
hardcopy at the beginning of class on the due date.
Late homework will not be accepted.
You are encouraged to use the original homework LaTeX document as a
template to write-up your homework. If you are required to hand in
code, this will explicitly be stated on the homework assignment.
\horline
\begin{enumerate}
\item (10 pts)
A quadrature formula on the interval $[-1,1]$ uses the quadrature
nodes $x_1 = -\alpha$ and $x_2 = \alpha$, where $\alpha \in (0,1]$:
\[
\int_{-1}^1 f(x) \, dx \approx w_1 \, f(-\alpha) + w_2 \, f(\alpha).
\]
The formula is required to be exact whenever $f$ is a polynomial of
degree 1. Show that $w_1 = w_2 = 1$, independent of the value of
$\alpha$. Show also that there is one particular value of~$\alpha$
for which the formula is exact also for all polynomials of degree
2. Find this $\alpha$, and show that, for this value, the formula is
also exact for all polynomials of degree 3.
\vspace{2\baselineskip}
\item (10 pts)
Denote by $T_nf$ the composite trapezoidal rule applied to $f$ on the
interval $[a,b]$,
\[
T_nf = h \left( \frac{1}{2} f(x_0=a) + f(x_1) + f(x_2) + \cdots +
f(x_{n-1}) + \frac{1}{2} f(x_n=b) \right),
\]
with $h = x_j-x_{j-1}$,
and by $S_{2n}f$ the composite Simpson rule applied to $f$ on the same
interval,
\[
S_{2n}f = \frac{h}{3} \left( f(x_0=a) + 4f(x_1) + 2f(x_2) + 4f(x_3)
+ \cdots + 2f(x_{2n-2}) + 4f(x_{2n-1}) + f(x_{2n}=b) \right).
\]
Show that
\[
S_{2n}f = \frac{4 T_{2n}f - T_{n}f}{3}.
\]
\vspace{2\baselineskip}
\item
Construct the 10-point Gauss-Legendre quadrature rule on the interval
$[-1,1]$ in the following steps:
\begin{enumerate}
\item (4 pts) Write a code to find the zeros of
$P_{10}$, the Legendre polynomial of degree 10.
\item (3 pts) Write a code which computes the Gauss-Legendre
weights $w_1, \ldots, w_{10}$ by enforcing that the following
integrals are \emph{exactly} computed by the quadrature rule:
\[
I_m = \int_{-1}^{1} x^m \, dx = \sum_{i=1}^{10} w_i \, x_i^m, \qquad
\text{for } m = 0, \ldots, 9.
\]
\item (3 pts) Show that the quadrature rule constructed gives the
exact (up to machine precision) answer for the integrals
\[
I_m = \int_{-1}^1 x^m \, dx, \qquad \text{for } m = 0,\ldots,19.
\]
\end{enumerate}
You should turn in all your work and a printout of your
code, as well as a list of all the quadrature nodes and weights,
shown to 12 significant digits.
Hint: The Legendre polynomials satisfy the following recurrence
relationship:
\[
P_{n+1}(x) = \frac{2n+1}{n+1}\, x \, P_n(x) - \frac{n}{n+1} \, P_{n-1}(x).
\]
The derivative $P_{n+1}'(x)$ can be computed by differentiating
the above expression.
\vspace{2\baselineskip}
\item (10 pts)
Using Taylorâ€™s Theorem, derive the error term for the approximation:
\[
f'(x) \approx \frac{-3f(x) + 4f(x+h) - f(x+2h)}{2h}.
\]
What is the round-off error in the above finite difference?
(You can ignore the error in computing $h$, $x$, $x + h$, and $x +
2h$.)
\vspace{2\baselineskip}
\item
\begin{enumerate}
\item (5 pts)
Show that Euler's method fails to approximate the solution
\[
y(x) = \left(\frac{4x}{5} \right)^{5/4}
\]
of the initial value problem
\[
\begin{aligned}
y' &= y^{1/5}\\
y(0) &= 0.
\end{aligned}
\]
Justify your answer.
\item (5 pts)
Now consider approximating the solution to the same initial value
problem with the implicit Euler method. Show that there is a
solution of the form $y_n = (c_n \, h)^{5/4}$, for $n \geq 0$, with
\[
\begin{aligned}
c_0 &= 0, \\
c_1 &= 1, \\
c_n &>1, \qquad \text{for all } n \geq 2.
\end{aligned}
\]
\end{enumerate}
\end{enumerate}
\end{document}