% Typeset with pdflatex
\documentclass[12pt]{amsart}
\usepackage{graphicx}
\usepackage[plain]{algorithm}
\textheight=9in
\textwidth=6.5in
\calclayout
\pagestyle{plain}
\thispagestyle{empty}
\parindent=0pt
\parskip=10pt plus3pt minus2pt
\newcommand\norm[1]{\lVert#1\rVert}
\newcommand\C{\mathbb C}
\newcommand\R{\mathbb R}
\renewcommand\P{\mathcal P}
\renewcommand\r{\sqrt{a/b}}
\begin{document}
\hbox to\hsize{\rlap{MATH 8445, Fall '17}\hfil Homework 1 \hfil\llap{Arnold}}
\bigskip
\parskip=10pt plus 2pt minus 2pt
\renewcommand{\theenumi}{\alph{enumi}}
\bigskip

Notes: It is great if you are able to use LaTeX.  Then you
can send me your solutions as a PDF file via email if you prefer.  For the computer problem,
send me the complete working python source code via email.  For some
of the problems you may find it helpful to use a symbolic algebra package
like Mathematica or SymPy as an assistant for things like computing integrals and
derivatives.  That is fine, just explain how you obtained your results.
You can discuss the homework with others, but everyone must write up their
own solutions, and write their own computer code.

\bigskip

 1. Consider the boundary value problem
 $$
 (au')' = f \text{ in $I$}, \quad u(0) = u(1) = 0.
 $$
 where $a:\bar I\to\R$ is a smooth everywhere positive coefficient function,
 and $f:\bar I\to \R$ a smooth function.  We will use the finite difference
 approximation 
 $$
 (au')'(x)\approx L_h u(x):= \frac{1}{h}\left[ a(x+h/2)\frac{u(x+h)-u(x)}{h} - a(x-h/2)\frac{u(x)-u(x-h)}{h}\right].
 $$
 \begin{enumerate}
 \item Prove an $O(h^2)$ error estimate for the consistency error.
 \item Prove that the operator $L_h$ acting on grid functions satisfies the discrete maximum principle.
 \item Write down the finite difference method and prove that it has a unique solution.
 \end{enumerate}
 
 \bigskip
  2. Consider the following possible stencils for finite difference approximations of the Laplacian.
\begin{equation*}
  \frac1{h^2} \begin{pmatrix} & 1 & \\ 1 & -4 & 1 \\ & 1 & \end{pmatrix} \qquad\qquad
 \frac1{h^2} \begin{pmatrix} & & \alpha & & \\ & & \beta & & \\
 \alpha & \beta & \gamma & \beta & \alpha \\ & & \beta & & \\ & & \alpha & & \end{pmatrix} \qquad\qquad
 \frac1{h^2} \begin{pmatrix} \alpha & \beta & \alpha \\ \beta & \gamma & \beta \\ \alpha & \beta & \alpha \end{pmatrix}
\end{equation*}
The first one is the usual 5-point Laplacian and we have proved a second order bound on its consistency error:
$$
\|\Delta_h u - \Delta u\|_{L^{\infty}(\Omega_h)} \le \frac{h^2}{12}(\|\partial^4u/\partial x^4\|_{L^\infty(\bar\Omega)} 
+ \|\partial^4u/\partial y^4/\|_{L^\infty(\bar\Omega)}).
$$
\begin{enumerate}
 \item Is it possible to choose the coefficients $\alpha$, $\beta$, $\gamma$ so that the finite difference method for
 the middle stencil  satisfies a \emph{fourth} order bound on its consistency error?  If so, give the values of
 the coefficients and demonstrate that the consistency error is $O(h^4)$.  If not, demonstrate that it is not possible.
 \item Same question for the right stencil.
\end{enumerate}

\bigskip
 3. Consider solving the problem $\Delta u = f$ by a finite difference method using a finite difference operator on
 both the left and the right of the equation: $L_h u_h = M_h f_h$.  Taking as stencils for $L_h$ and $M_h$
 \begin{equation*}
  \frac1{6h^2} \begin{pmatrix} 1 & 4 & 1 \\ 4 & -20 & 4 \\ 1 & 4 & 1\end{pmatrix} \qquad\text{and}\qquad
 \frac1{12} \begin{pmatrix} & 1 &  \\ 1 & 8 & 1 \\  & 1 & \end{pmatrix}
\end{equation*}
respectively, show that the consistency error is $O(h^4)$ for a smooth solution $u$.

\bigskip
4. For the problem $-\Delta u = 1$  in $\Omega$, $u = 0$ on $\partial\Omega$,
with $\Omega$ the unit square:
\begin{enumerate}
 \item Compute the value of $u$ at the center of the square \emph{analytically} to at least six correct digits after the decimal point ,
 using separation of variables (Fourier series).  Supply your value and explain how you computed it
 and why you are confident that it is correct to six digits.  (Hint: You may want to
 do the 1D problem first as a warm up.)
 \item Write a python computer code that uses the finite difference method to solve the boundary value problem with a uniform grid
 with mesh spacing $h=1/4, 1/8,\ldots, 1/128$.  Provide a table that shows for each mesh
 the approximation of $u(1/2,1/2)$, the error in this quantity, and, for meshes after the first,
 the apparent rate of convergence. 
\end{enumerate}


\end{document}

