\documentclass[11pt,titlepage]{article}
\usepackage[margin=1in,noheadfoot]{geometry} % See geometry.pdf to learn the layout options. There are lots.
\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{hyperref}
\usepackage{wrapfig}

\newcommand{\e}[1]{\times 10^{#1}}
\newcommand{\q}{\mathrm}
\newcommand{\where}[1][where]{\qquad\mbox{#1}}
\newcommand{\bs}[1]{\boldsymbol{#1}}
\newcommand{\bh}[1]{\hat{\boldsymbol{#1}}}
\newcommand{\bv}[1]{\vec{\boldsymbol{#1}}}
\newcommand{\bt}[1]{\tilde{\boldsymbol{#1}}}
\newcommand{\flow}[1]{\mathcal{E}_{#1}}
\newcommand{\flux}[1]{\Phi_{#1}}

\usepackage{calligra}
\DeclareMathAlphabet{\mathcalligra}{T1}{calligra}{m}{n}
\DeclareFontShape{T1}{calligra}{m}{n}{<->s*[2.2]callig15}{}
\newcommand{\scriptr}{\hspace{-.1ex}\ensuremath{\mathcalligra{r}}\,}
\newcommand{\dslash}{d \hspace{-0.5ex}\rule[1.2ex]{0.6ex}{.1ex}}

\begin{document}
\begin{center}
  {\bf University of Kentucky, Physics 416G \\
    Problem Set \#6 (Rev. A), due Friday, 2011-10-21 }
\end{center}

\vspace{.3 in}

1.~{\bf Relaxation method}.  Use the mean value property of Laplace's equation
to calculate the potential distribution within a square, two of whose adjacent
edges are maintained at 100~V while the other two are maintained at 0~V and at
50~V.

\quad a) First draw a square grid of 36 points. Of these, 20 will be on the
edges of the square, and 16 will be in the interior.

\quad b) Guess carefully the potentials at the interior points and write them on
your grid. This is your first approximation.

\quad c) Now you can correct your first approximation as follows. Start at an
interior point, near one corner of the square. Let us call this point
$\mathcal{P}$.  Calculate the sum of the potentials at the four nearest points
and subtract four times the potential at $\mathcal{P}$. This number is called
the residual at $\mathcal{P}$. Show this number on your grid, preferably in a
different color, and repeat the calculation for the other interior points. To
obtain a second approximation, select the points where the residuals are the
largest and add to your original estimates one quarter of the residuals. Round
off the potentials to the nearest volt. This makes the potential distribution
satisfy more closely the condition found in Problem 3.

\quad d) Now calculate the new residuals and repeat the operation until the
residuals are everywhere less than 2, corresponding to corrections of less
than $\frac12$V.  You might wish to solve this problem on a computer.

\quad e) Sketch in some equipotentials. This is a good illustration of the
relaxation method of calculation, which we largely owe to R.~V.~Southwell, and
which is described in many books on applied mathematics.  The method is
applicable to a wide variety of problems, and not only to the solution of
Laplace's equation.

2.~{\bf Finite Differences Method}.  Re-solve problem \#1 by the as outlined
below.

\quad a) Given the discrete approximation of a function $f_i = f(x_i)$
evaluated at regular intervals $x_i=x_0+i\, \Delta x$, explain how the formula
$f'(x) = (f_{i+i}-f_i)/\Delta x$ is a good approximation to the derivative of
$f(x)$ at the midpoint between $x_i$ and $x_{i+1}$.

\quad b) Come up with a formula for the discrete second derivative similar to
part a), and extend it to a discrete 2-dimensional Laplacian.

\quad c) Turn Laplace's equation into a matrix equation by treating the
function $V(x)$ as a 16-component vector $\bs V =
[V_{11},V_{12},V_{13},V_{14},V_{21}, \ldots, V_{44}]$.  Use part b) to
represent $\nabla^2V$ as a $16\times 16$ matrix $\bs K$ multiplied by $\bs V$.
Ignore function points outside the $4\times 4$ grid for now. The Laplacian can
be approximated by a matrix because it is a linear operator.

\quad d) For derivatives near the edge, include the boundary conditions
$V_{0n}$, $V_{5n}$, $V_{m0}$, and $V_{m5}$ as a fixed vector $\bs B$, so that
the expression $\bs K \bs V + \bs B$ respresents the full Laplacian $\nabla^2
V$

\quad d) Solve the matrix equation $\bs K \bs V = - \bs B$ for the potential
$V$.  DO NOT do this by hand.  Try using one of the software packages
\href{http://www.gnu.org/software/octave/}{Octave} (free), Matlab, Maple, or
Mathematica.

\newpage

3.~{\bf Finite Element Method}.  In this problem we will investigate one of
the most common methods of solving partial differential equations numerically
(especially involving the Laplacian).  This method is very flexible and can be
used to solve PDEs on irregularly shaped domains like cars or electrodes of
your awesome new experiment.  The problem is self-contained, but for extra
details and hints, you may refer to the article
\href{http://en.wikipedia.org/wiki/Finite_element}
{http://wikipedia.org/wiki/Finite\_element}.

\quad a) Show that 
\begin{equation}
\int_R (\nabla^2 u) v d\tau = \oint_{\partial R} (\nabla u) v
\cdot {\bs{da}} - \int_R \nabla u \cdot \nabla v  d\tau.
\end{equation}
Assuming that
$v=0$ on the boundary, this means that the equation $\nabla^2 u=f$ can be
written 
\begin{equation}
  - \int_R \nabla u \cdot \nabla v  d\tau = \int_R f v d\tau,
  \label{integral_eq}
\end{equation} 
which is now a first order integral equation, for any function $v({\bs r})$.

\quad b) In a one-dimensional space, Eq.~\ref{integral_eq} can be discretized
by choosing appropriate ``basis functions'' for $v({\bs r})$.  Define the
``tent function''
\begin{equation}
v_i(x) = (1-|x-i|)\;
\theta(1-|x-i|),
\end{equation}
where $\theta(x)= \{ 1$ if $x>0$, and $0$ if $x<0 \}$ is the standard step
function and $i=1,2,3,4$.  Plot each of these functions on the same graph.

\quad c) Sketch the function $f(x)=2 v_1(x) + 4 v_2(x) + 3 v_3(x) + 1 v_4(x)$.
In the same way, any function defined on $0<x<5$ can be approximated by a
linear combination of these basis functions $f(x)\approx \sum_{i=1}^4 f_i
v_i(x)$, where $f_i = f(i)$.

\quad d) Convert Eq.~\ref{integral_eq} into a matrix equation by substituting
$v(x) \to v_i(x)$ for $i=1,2,3,4$, approximating $u(x)=\sum_j u_j v_j(x)$ and
$f(x)=\sum_j f_j v_j(x)$, and performing the integrals
$\int_{-\infty}^{\infty} v_i(x) v_j(x) dx$ and $\int_{-\infty}^{\infty} \nabla
v_i(x) \cdot \nabla v_j(x) dx$.  Note that $\nabla = d/dx$ in one dimension.
 
\quad e) Use part d) to solve the boundary value problem $\nabla^2 u = 3$ on
the region $0<x<5$, with boundary conditions $u(0)=0$ and $u(5)=0$, by solving
the above matrix equation for $u_i$.  
%You can use \verb|http://toolpaq.com/en/matrix_inverter/| to invert matrices.
 
\quad f) Find the analytic solution $u(x)$ of part e) and compare with the
finite element result.
 
\quad g) Describe how this method could apply to higher dimensions.  Hint:
Define the 2-dimensional tent function $v_{ij}(x,y) = v_i(x) \; v_j(y)$.  Plot
this basis function, and evaluate at least two of the integrals that would be
needed to form the matrix equation.  We won't do a 2- or 3-dimensional
problem, because the matrices become very large.  However there are packages
like FlexPDE (\href{http://www.pdesolutions.com/index.html}
{http://www.pdesolutions.com}, free student veresion) and COMSOL
(\href{http://comsol.com}{http://comsol.com}) which do all the bookkeeping to
implement this method on complex geometries and differential equations that
you construct using graphical operations.
 
% 3.  Find the capacitance of two spherical conductors of radius $a$,
% separated by a distance $d$ using the method of image charges.  Hint: use
% the results of Example 3.2.
 
4.~Find the capacitance per unit length of two rods of radius $a$, separated
by a distance $d$ using the method of image charges.  Hint: use the results of
HW 5 \#4.  See also
\href{http://www.pa.uky.edu/~crawford/phy416_fa10/priv/ieee_cylinder_capacitance.pdf}
{IEEE Tr. Microwave Th. Tech, {\bf 47} 365}.

 
Also, Griffiths chapter 3, problems 1, 2, 5, 10.

\end{document}
