\documentstyle[twocolumn]{article}

\input HFTmacros.tex

\title{Harmonic Function Theory}

\author{Paul C. Abbott\\
Department of Physics\\
University of Western Australia\\
Nedlands  6009\\
AUSTRALIA\\
email: \verb+paul@earwax.pd.uwa.edu.au+}

\begin{document}\maketitle
 
\section{Introduction}

The \mma\ package \verb+HFT.m+, is designed for the symbolic manipulation of harmonic functions.  The package is based upon material from the book Harmonic Function Theory [1].

Although \verb+HFT.m+ is primarily intended for mathematicians, this review is taken from the viewpoint of a physicist. Physicists are interested in the applications of harmonic functions to areas including: solutions to the Laplace (potential theory), Helmholtz (scattering theory), and Schr\"{o}dinger (atomic and nuclear physics) equations; spherical harmonics (central to the study of angular momentum); approximate solutions to few-particle systems (hyperspherical harmonics); and generalizing physical problems to $n$-dimensions so that the large and small $n$ limits can be studied.

\section{Getting the package}

\verb+HFT.m+ and its documentation are available by \verb+ftp+ (from \verb+otter.stanford.edu+ in the directory \verb+/mma/Analysis+) and by electronic mail (from Sheldon Axler at \verb+axler@math.msu.edu+)

\section{Loading the package}

The package is loaded into a \mma\ session using the command:

\begin{In}{1}
<<HFT`
\end{In}

\begin{Out}{1}
HFT;\ Version\ 2.11,\ 5\ April\ 1993\ ...
\end{Out}

\ni This message shows the version of \verb+HFT.m+ that was reviewed. All computations used \mma\ version 2.1 with the front end running on a Macintosh PowerBook 180 talking to a remote kernel on a DECstation 5100.

\section{Functions}

Using standard \mma\ syntax it is straightforward to obtain a complete listing of all functions defined in the \verb+HFT+ package:

\begin{In}{2}
?HFT`*
\end{In}
\begin{verbatim}
    AnnularDirichlet     MacSymbols
    Ball                 Neumann
    BasisH               Norm
    BergmanKernel        NormalD
    BergmanKernelH       Orthonormal
    BergmanProjection    Partial
    BiDirichlet          Phi
    Delta                PoissonKernel
    Dimension            PoissonKernelH
    DimensionH           S
    Dirichlet            Schwarz
    Divergence           SetDimension
    ExpandNorm           Sphere
    ExteriorDirichlet    Subscripts
    Gradient             SurfaceArea
    HarmonicConjugate    Symbols
    HilbertSchmidt       Taylor
    Homogeneous          Togetherness
    IdentityMatrix       Trace
    IntegrateBall        Tracer
    IntegrateSphere      Transpose
    Inversion            TurnOff
    Jacobian             TurnOn
    Kelvin               Volume
    KelvinM              ZonalHarmonic
    Laplacian
\end{verbatim}

\ni More detailed information is available on any of these functions, \eg,

\begin{In}{3}
?BasisH
\end{In}

\begin{verbatim}
BasisH[m, x, options] gives a basis
  for the space of harmonic polynomials 
  homogeneous of degree m in the variable x.
\end{verbatim}

\section{Examples}

I will try to indicate the scope of a package by a few examples. My bias is towards physical examples and the reader is encouraged to obtain the \TeX\ documentation for mathematical examples.

\subsection{Simple examples}

\subsubsection{Euclidean norm}

The function \verb+Norm[x]+ gives the Euclidean norm of $x$. An example of the type of manipulations that \verb+HFT+ is capable of is a verification of the {\em symmetry lemma}:

\begin{In}{4}
Norm[ x/Norm[x] - Norm[x]y ] - \\
\hspace*{4em} Norm[ y/Norm[y] - Norm[y]x ]
\end{In}

\begin{Out}{4}
|\frac{1}{|x|}\,x - |x|\,y| - |\frac{1}{|y|}\,y - |y|\,x|
\end{Out}

\ni is simplified using (\verb+%+ denotes the previous expression):

\begin{In}{5}
ExpandNorm[\%]
\end{In}

\begin{Out}{5}
0
\end{Out}

\ni which verifies the identity.

\subsubsection{Partial derivatives}

\verb+HFT+ introduces \verb+Partial+ for computing partial derivatives. For example, the partial derivative of $e^{i k.x}$ with respect to $x_{5}$ is

\begin{In}{6}
Partial[ Exp[I k.x], x[5]]
\end{In}

\begin{Out}{6}
I\ E^{I\ k.x}\ k_5
\end{Out}

The syntax follows the general \mma\ style.  The authors (wisely) decided not to implement the functionality of \verb+Partial+ by overloading the \mma\ \verb+D+ operator as such built-in operators have a number of internal simplification rules that are not easily modified.

\subsubsection{Operator identities}

Some useful operator identities are easily verified, \eg, the $n$-dimensional Laplacian acting on scalar functions $f$ and $g$,

\begin{In}{7}
Laplacian[f[x] g[x], x]
\end{In}

\begin{Out}{7}2 Gradient[f][x].Gradient[g][x] + \\
\hspace*{5em} g[x] Laplacian[f][x] + f[x] Laplacian[g][x]
\end{Out}

\ni which may be more recognizable as 
$$\Delta fg=f\Delta g+g\Delta f+2\nabla f\bullet \nabla g.$$

\subsection{Physical examples}

\subsubsection{Potential theory}

Potential theory requires solutions to Laplace's equation in $n$-dimensions. \verb+HFT+ is capable of working in an {\em arbitrary} number of dimensions. Throughout the following define

\begin{In}{8}
r = Norm[x]
\end{In}

\begin{Out}{8}
|x|
\end{Out}

\ni Choosing $x$ to be $n$-dimensional:

\begin{In}{9}
SetDimension[x, n] \\
\end{In}

\ni one finds that

\begin{In}{10}
Laplacian[1/r, x]
\end{In}

\begin{Out}{10} 
\frac{3 - n}{3|x|}
\end{Out}

\ni which reveals that (apart from the singularity at $r = 0$) the Coulombic potential, $1/r$, is a formal solution to Laplace's equation in three dimensions. 

\subsubsection{Scattering theory}

In scattering theory, one studies asymptotic solutions to the Sch\"{o}dinger equation where the potential vanishes faster than $1/r$ for large $r$. This leads to the Helmholtz equation $\left( {\Delta +k^2} \right)\psi \left( r \right)=0$.

In standard texts the asymptotic solution is stated without proof. The incident particle beam is usually chosen to be monoenergetic particles travelling in direction $k$. Using \verb+HFT+ it is easy to show that the incident solution can be represented by a plane wave $e^{i k.x}$:

\begin{In}{11}
Laplacian[E\verb$^$(I k.x), x]- \\
\hspace*{6em} k.k E\verb$^$(I k.x)
\end{In}

\begin{Out}{11}
0
\end{Out}

\ni As this expression does not depend on the dimensionality, it is clear that plane waves are solutions of the Helmholtz equation in $n$ dimensions.

Far from the scattering center, the scattered solution must represent an outgoing spherical wave. It is easily verified that the radial behaviour of the scattered solution is $e^{i k r}/r$:

\begin{In}{12} 
Laplacian[E\verb$^$(I k r)/r,\ x]- \\
\hspace*{6em} k\verb$^$2 E\verb$^$(I k r)/r // Factor
\end{In}

\out[12]
\begin{verbatim}
             I |x| k
          I E        (-3 + n)
          ------------------- (I + |x| k)
                 3 |x|
\end{verbatim}

\ni but only in three dimensions:

\begin{In}{13} 
\% /. n -> 3
\end{In} 

\begin{Out}{13} 
0
\end{Out} 

The Green's function exhibiting purely outgoing wave behaviour satisfies $\left( {\Delta +k^2} \right)G_0^{(+)}\left( {k,x,y} \right)=\delta \left( {x-y} \right)$ with the solution

\begin{In}{14} 
green[k\_,x\_,y\_] = \\
\hspace*{5em} -E\verb$^$(I k Norm[x-y])/(4Pi Norm[x-y])
\end{In}

\out[14]
\begin{verbatim}
            I |x - y| k
          -E
          -------------
          4 Pi |x - y|
\end{verbatim}

\ni Restricting attention to three dimensions:

\begin{In}{15}
SetDimension[x,3]
\end{In}

\begin{In}{16}
SetDimension[y,3]\\

\end{In}


\ni this result can be (formally) verified for $x \neq y$:

\begin{In}{17}
Laplacian[green[k,x,y], x] - \\
\hspace*{6em} k\verb$^$2 green[k,x,y] // ExpandNorm
\end{In}

\begin{Out}{17}
0
\end{Out}

\subsubsection{Schr\"{o}dinger equation}

One often needs to factor off the asymptotic behaviour of solutions to a differential equation. As an example, the Schr\"{o}dinger equation for a Coulombic potential can be written

$$\left( {-{1 \over 2}\Delta -{Z \over r}-E} \right)\psi (r)=0$$

\ni and implemented using Laplacian as

\begin{In}{18}
Schroedinger[f\_, x\_] := \\
\hspace*{5em} -1/2 Laplacian[f, x] - z/r f - e f \\
\end{In}

For large $r$, the exponentially decaying asymptotic form $e^{-a r}$, is easily factored off: 

\begin{In}{19}
Schroedinger[g[x] E\verb$^$(-a r), x]/ \\
\hspace*{6em} E\verb$^$(-a r) // Expand
\end{In}

\out[19]
\begin{verbatim}
               2
            -(a  g[x])
            ---------- - e g[x] + 
                2
              a Gradient[g][x].x   a g[x]
              ------------------ + ------ - 
                     |x|            |x|
              z g[x]   Laplacian[g][x]
              ------ - ---------------
               |x|            2
\end{verbatim}

\ni yielding an equation which can be further simplified by re-scaling and suitable choice of the parameter $a$.

\subsubsection{Statistical physics}

In statistical physics, multi-dimensional volume and surface integrations are often required. For example, here is the volume:

\begin{In}{20}
Volume[4]
\end{In}

\begin{Out}{20}
\frac{Pi^2}{2}
\end{Out}

\ni of a unit sphere in four dimensions.

\verb+IntegrateBall+, which integrates over the unit ball, can be used to compute the normalization integrals for many-electron atomic wavefunctions:

\begin{In}{21}
IntegrateBall[r\verb$^$m Exp[-a r], x]
\end{In}

\begin{Out}{21}
4 \ a^{-3 - m} \ Pi \ Gamma[3 + m, 0, a]
\end{Out}

\ni and partition function integrals

\begin{In}{22}
IntegrateBall[Exp[-a x.x], x] \\
\end{In}

\out[22]
\begin{verbatim}
                    -1
            4 Pi (------ + 
                       a
                  2 a E
                Sqrt[Pi] Erf[Sqrt[a]]
                ---------------------)
                          3/2
                       4 a
\end{verbatim}

\subsubsection{Spherical harmonics}

The command \verb+BasisH[m, x, options]+ gives a basis for the space of harmonic polynomials homogeneous of degree $m$ in the variable $x$,\eg,

\begin{In}{23}
BasisH[2, \{x,\ y,\ z\}] \\
\end{In}

\out[23] 
\begin{verbatim}
     2    2   2        2   2    2
   {x - 2y + z , z y, x + y - 2z , y x, z x}
\end{verbatim}

\ni for an explicit set of three-dimensional cartesian coordinates. Alternatively, in three dimensions:

\begin{In}{24}
SetDimension[x, 3] \\
\end{In}

\ni the normalised harmonics can be obtained directly:

\begin{In}{25}
spherical = BasisH[2, x, \\
\hspace*{5em} Orthonormal -> Ball]; \\
\end{In}


It is easily verified that each harmonic, \eg,

\begin{In}{26} 
spherical[[1]] \\
\end{In}

\out[26]
\begin{verbatim}
                 35       2       2
            Sqrt[--] (-|x|  + 3 x  )
                 Pi              2
            ------------------------
                       4
\end{verbatim}

\ni is orthonormal by computing the appropriate integrals. For example,

\begin{In}{27}
IntegrateBall[spherical[[1]]\verb$^$2, x]
\end{In}

\begin{Out}{27}
1
\end{Out}

\ni reveals that \verb+spherical[[1]]+ is correctly normalized.

\section{Conclusions}

The quality of the \verb+HFT+ package is demonstrated by its utility in a domain that its authors may not have deliberately intended. The package is well-written and the documentation is readable and concise.

Where possible, \verb+HFT+ follows standard \mma\ conventions. A brief study of the source code showed it to be a well-written package that could be easily customized.

Although there is an admirable effort to incorporate input and output type-setting (using specific key sequences) for functions such as \verb+Norm+ and \verb+Integrate+, and \verb+Partial+, this feature is presently restricted to the Macintosh platform. Not all functions are type-set on input or output (\eg, \verb+Gradient+). These deficiencies serve to highlight the need for a uniform type-setting functionality presently missing from \mma\ and should not be viewed as a criticism of the \verb+HFT+ package itself.

Some extensions to the package that I would like to see include the capability of computing integrals like

\begin{verbatim}
     IntegrateBall[1/(Norm[x-q]^2+1), q]
\end{verbatim}

\ni (which presently produces an error message), explicit access to spherical coordinates in $n$-dimensions, and the capability of handling distributions (\eg, the Dirac delta function).

\section{About the author}

Paul Abbott received his Ph.D. in theoretical atomic physics from the University of Western Australia in 1987.  His research relied heavily on computer algebra.  In 1989, Abbott was involved with the foundation of {\it The Mathematica Journal} as Technical Editor. In 1991 he founded Analytica, a company based in Perth, Western Australia, that sells and supports a range of technical software packages.  In 1992, Abbott was appointed to the staff of the Department of Physics at the University of Western Australia. 

\section{References}

{
% \viiipt
[1] Axler, S., Bourdon, P. and Ramey, W.,
{\it Harmonic Function Theory},
Springer-Verlag (1992)
}

\end{document}
