\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{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\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}}
\newcommand{\pO}{{\partial\Omega}}
\begin{document}
\title{Math 116 Numerical PDEs: Homework 6}
\date{due Man 9am, Feb 20}
\maketitle
{\em Shorter to let you start projects.
Hint: always try to extend/tweak your existing code.
First you may want to look over (or fix!) your HW5 codes,
rename the routines to informative names, document them, etc.}
\ben
%\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
Here your alter your code from HW5 \#4 to
solve the interior Dirichet BVP for the Helmholtz
equation in the same $\Omega$.
[Warning: you are now using complex numbers, so to transpose
an array you should use {\tt .'} . Also graph-plotting and {\tt imagesc}
only handles real-valued arrays.]
\ben
\item The Helmholtz DLP kernel $\partial\Phi(x,y)/\partial n_y$ is
$\Phi(x,y) = (i/4) H_0(k|x-y|)$; note $H_0'(z) = -H_1(z)$.
Give your kernel function an extra $k$ input argument and make it
switch between Laplace and Helmholtz (which has the same diagonal values) using
{\tt if k==0 ... else ... end}.
\item Fixing wavenumber $k=6$,
test with boundary data for the solution field $u(x) = 5i H_0(k|x-x_0|)$, with
`source point' $x_0 = (0,2)$ which is outside $\Omega$.
Produce a color image of $\log_{10}$ error over the grid
$[-1.3,1.3]^2$ with spacing 0.02, for $N=50$. [Since
special functions are slow, computation will take about 5 sec].
\item What now is the convergence order, or rate, at
the fixed location $x = (0.2,0.1)$ ? Is it as good as for Laplace?
What does this suggest about the smoothness of the Helmholtz DLP kernel?
\een
\item Make your code switchable to the {\em exterior} Helmholtz
BVP, which is as simple as changing the
signs in the BIE to $(I+2D) \tau = 2f$.
You will now bounce waves off the domain $\Omega$!
\ben\item
Use this to solve for the scattered field $u^s$ due to
the incident plane wave $u^i(x) = e^{ik\hat{n}\cdot x}$ with
wavenumber $k=10$ and direction $\hat{n} = (\cos 0.2, \sin 0.2)$ reflecting from
the domain $\Omega$ from before with Dirichlet boundary condition.
Produce a 2D color image showing $u = u^i + u^s$ over the region $[-4,4]^2$;
this should look familiar from the course webpage. In particular
check that $u|_\pO$ heads towards zero.
BONUS: set the values inside $\Omega$ to zero or {\tt NaN} since they are
not physically relevant.
\item Since the solution is not known analytically, observe the
convergence with $N$ until you are confident in the first 4 significant
digits of the total field $u$ at the point $(-2,0)$ and quote them.
\een
\item Here you explore the dependence on wavenumber $k$ of the above Helmholtz
kernel matrices---this will be quick since you already have a function for
these.
\ben
\item Plot a graph vs $k\in[0.1,4]$ of the lowest singular value of the
Nystr\"{o}m matrix for $(I-2D)$ you used for the interior BVP.
Locate as accurately as you can the lowest
$k$ where its condition number blows up.
BONUS: use a built-in minimization function (rather than just searching
`by hand'.)
\item By choosing generic (i.e.\ almost any)
boundary data $f$, answer whether the actual
physical solution to the interior BVP blows up near this $k$, or if it
is merely a BIE effect?
\item Plot a similar graph for the matrix $(I+2D)$ which you used in the
exterior BVP. Locate as accurately as you can the lowest
nonzero $k$ where its condition number blows up.
\item Answer as before whether the physical
solution to the exterior BVP blows up near this $k$, or if it is merely
a BIE effect?
\een
{\em Note: the $k^2$ values you found in (a) are the Dirichlet eigenvalues
of $\Omega$, and in (c) the Neumann eigenvalues of $\Omega$.}
%\item Here we regain spectral convergence.
\een
\end{document}
\item Here you solve the interior Dirichlet BVP for Laplace's equation
using the closed planar curve from last time with
radial function in polar coordinates
$R(t) = 1 + a \cos(3t)$, with $t\in[0,2\pi)$, with $a=0.3$.
\ben
\item Code the formula for curvature $\kappa(t)$ in terms of
$R(t)$, $R'(t)$, $R''(t)$, and feed it the values for this radial function.
Let $t_j$ be nodes in the periodic trapezoid rule, as in HW5 \#4.
Plot $\kappa(t_j)$ for yourselves to check it gives what you expect.
Make a function to fill the
Nystr\"{o}m kernel matrix: diagonal elements via
$\kappa(t_j)$, off-diagonal elements via your HW5 \#4a function.
Check the diagonal elements smoothly agree with those near the diagonal,
by plotting a color image of the matrix; debug as needed.
\item
Let's use a BVP with known solution
$u(x_1,x_2) = \cos(x_1)e^{x_2}$ which you can check is harmonic.
Then its Dirichlet boundary data is $f = u|_{\pO}$, which you should use
to fill a column vector of values $f(y_j)$.
Solve the linear system corresponding to $(I-2D) \tau = -2f$ to get
the $\tau$ vector at the nodes. Tweak your code from HW5 \#4 to
compute the resulting solution field $u^{(N)}$ over the grid in
$[-1.3,1.3]^2$ with spacing 0.02, for $N=50$.
Produce a 2D color image showing $\log_{10} |u^{(N)} - u|$ with a
color scale range $[-16,0]$.
How does the error vary inside the domain?
\item For the fixed location $x = (0.2,0.1)$, show convergence vs $N$
of this error on an appropriate plot, and state the convergence order or rate.
[Note you shouldn't evaluate over the whole grid here].
\een