Solutions to Differential Equations: Special Functions

Visualizing a few special functions

Bessel's equation

Bessel's equation is a second-order ODE having the following form, with the parameter ν being real and nonnegative.

BesselODE = x^2y''[x] + x y '[x] + (x^2 - ν^2) y[x] == 0

(x^2 - ν^2) y[x] + x y^′[x] + x^2 y^′′[x] == 0

Bessel's equation arises in problems in heat conduction and mass diffusion for problems with cylindrical symmetry (and many other situations). It's solution is a linear combination of two special functions called Bessel functions of the first kind, BesselJ in Mathematica, and Bessel functions of the second kind, BesselY in Mathematica.

DSolve[BesselODE, y[x], x]

{{y[x] →BesselJ[ν, x] C[1] + BesselY[ν, x] C[2]}}

The functions BesselJ and BesselY can be evaluated numerically and of course Mathematica has this capability built-in.

MyPlotStyle[HowMany_Integer] := Table[{Hue[0.66 * i/HowMany], Thickness[0.01]}, {i, 0, HowMany}]

Plot[{BesselJ[0, x], BesselY[0, x]}, {x, 0, 20}, PlotStyle→MyPlotStyle[2]]

[Graphics:HTMLFiles/Lecture-26_7.gif]

-Graphics -

Plot[{BesselJ[5, x], BesselY[5, x]}, {x, 0, 20}, PlotStyle→MyPlotStyle[2]]

[Graphics:HTMLFiles/Lecture-26_10.gif]

-Graphics -

Plot[{BesselJ[1/2, x], BesselY[1/2, x]}, {x, 0, 20}, PlotStyle→MyPlotStyle[2]]

[Graphics:HTMLFiles/Lecture-26_13.gif]

-Graphics -

As an example of an application where the Bessel functions arise, consider radially-symmetric heat flow in an infinitely long cylinder of radius a that has an initial temperature profile T =T(r) and a surface temperature T(r = a) = T_r,and  substitute T= ^(-κα^2t)τ into the heat equation ∂T/∂t∇^2T in cylindrical coordinates. The function τ must obey(d^2τ)/∂r^2+ 1/rdτ/dr+ α^2τ= 0, which has the form of Bessel's equation of order ν = zero. The solution will have the form T= A J_0(αr)^(-κα^2t) where A is a constant and J_0(αr)is the Bessel function of order zero of the first kind. The parameter α must, from boundary conditions, be a solution to the equation J(αa) = 0. The initial temperature distribution, f(r), can be expanded as a series of Bessel functions of zero order, analogous to what we did with Fourier series. The general solution to the heat-flow problem will then be an infinite series of Bessel functions, each modified by an exponentially decaying amplitude, taking the form T= Underoverscript[∑, n = 1, arg3]A_n J_0(α_nr)^(-κα_n^2t).  For a more thorough discussion, see H.S. Carslaw and J.C. Jaeger, Conduction of Heat in Solids, Oxford University Press, Second Edition, pp. 194–196 (1959).

Legendre's equation

Legendre's equation is a second-order ODE having the following form, with the parameters m and n being integers such that n is positive and -n m n (seems to suggest applications to quantum numbers!). Legendre's equation arises in physical problems with spherical symmetry. The simplest form of the equation has only one parameter, n and takes the form:

LegendreODE = (1 - x^2) y''[x] - 2 x y '[x] + (n (n + 1)) y[x] == 0

n (1 + n) y[x] - 2 x y^′[x] + (1 - x^2) y^′′[x] == 0

Its solution is a linear combination of two special functions, Legendre and PLegendreQ:

DSolve[LegendreODE, y[x], x]

{{y[x] →C[1] LegendreP[n, x] + C[2] LegendreQ[n, x]}}

The two-parameter form of the Legendre equation is:

AnotherFormLegendreODE = (1 - x^2) y''[x] - 2 x y '[x] + (n (n + 1) - m^2/(1 - x^2)) y[x] == 0

(n (1 + n) - m^2/(1 - x^2)) y[x] - 2 x y^′[x] + (1 - x^2) y^′′[x] == 0

which has a solution involving the same special functions:

DSolve[AnotherFormLegendreODE, y[x], x]

{{y[x] →C[1] LegendreP[n, m, x] + C[2] LegendreQ[n, m, x]}}

Of course, Mathematica can evaluate and plot Legendre functions…

Plot[{LegendreP[0, x], LegendreQ[0, x]}, {x, -1, 1}, PlotStyle→MyPlotStyle[2]]

[Graphics:HTMLFiles/Lecture-26_40.gif]

-Graphics -

Plot[{LegendreP[1, x], LegendreQ[1, x]}, {x, -1, 1}, PlotStyle→MyPlotStyle[2]]

[Graphics:HTMLFiles/Lecture-26_43.gif]

-Graphics -

Plot[{LegendreP[2, x], LegendreQ[2, x]}, {x, -1, 1}, PlotStyle→MyPlotStyle[2]]

[Graphics:HTMLFiles/Lecture-26_46.gif]

-Graphics -

Plot[Evaluate[Table[LegendreP[i, x], {i, 0, 10}]], {x, -1, 1}, PlotStyle→MyPlotStyle[11]]

[Graphics:HTMLFiles/Lecture-26_49.gif]

-Graphics -

Plot[Evaluate[Table[LegendreQ[i, x], {i, 0, 10}]], {x, -1, 1}, PlotStyle→MyPlotStyle[11]]

[Graphics:HTMLFiles/Lecture-26_52.gif]

-Graphics -

Note how some of the Legendre functions are even and some are odd.  Recall that by summing even and odd functions, functions that are neither even or odd can be produced.

Hypergeometric and Laguerre special functions

Here is another differential equation whose solution involves special functions.  Many special functions are defined and analyzed precisely because they are solutions to simple ODEs

DSolve[x y''[x] + (q   + 1 - x) y '[x] + p  y[x] == 0, y[x], x]

{{y[x] →C[1] HypergeometricU[-p, 1 + q, x] + C[2] LaguerreL[p, q, x]}}

Plot[LaguerreL[4, 1, x], {x, -5, 15}]

[Graphics:HTMLFiles/Lecture-26_57.gif]

-Graphics -

Using Special Functions to visualize the eigensolutions for an electron bound to a fixed proton--The Hydrogen Atom

Eigenfunctions for Hydrogen:

Preliminary Definitions:
n will be the first quantum number n =1,2,3
L will be the second quantum number L=0,1,2,... (n-1)
m will be the third quantum number m = -L,-L+1,... 0,1,2, +L
These rules come from restrictions on the special functions that make up the eigenfunctions for the H-atom

Z = 1 ; a0 = 1 ;

κ[n_] := κ[n] =    ( Z)/(a0  n)

ρ[n_, r_] := 2 κ[n] r

A[n_ , L_] := A[n , L] = Factorial[n - L - 1]/(2 n (Factorial[n + L])^3)^(1/2)

Prefact[n_, L_] := Prefact[n, L] =    (2 κ[n])^3/2  A[n, L]

R[n_ , L_, r_] := Prefact[n, L] ρ[n, r] Exp[-ρ[n, r]/2] LaguerreL[n - L - 1, 2 L + 1, ρ[n, r]]

The eigenfunctions for the Hydrogen Atom can now be written down.  The eigenfunctions will relate to the above definitions and involve the Spherical Harmonics which are related to Legendre functions and its derivatives.

HAtom[n_ , L_ , m_ , {r_ , θ_, φ_}] := R[n, L, r] SphericalHarmonicY[L, m, θ, φ]

<<Calculus`VectorAnalysis`

CoordinatesFromCartesian[{x, y, z}, Spherical]

{(x^2 + y^2 + z^2)^(1/2), ArcCos[z/(x^2 + y^2 + z^2)^(1/2)], ArcTan[x, y]}

SphericalCoords[x_, y_, z_] := Module[{rsq = x^2 + y^2 + z^2, r, phi = ArcTan[x, y]}, r = Sqrt[rsq] ; Return[{r, ArcCos[z/r], phi}]]

2,1,1 corresponds to a 2p spin up electron

HAtom[2, 1, 1, SphericalCoords[1, 2, 1]]

-1/48 ^(-3/2^(1/2) +  ArcTan[2]) 5/π^(1/2)

N[HAtom[2, 1, 1, SphericalCoords[1, 2, 1]]]

-0.00345369 - 0.00690739 

<<Graphics`ContourPlot3D`

Abs[HAtom[2, 1, 1, CoordinatesFromCartesian[{0, 1, .5}, Spherical]]]

0.00672057

Plot a surface of constant probability density. Only an octant can be plotted, the numerical methods do not behave well on the coordinate "zero value" planes.

p1 = ContourPlot3D[Abs[HAtom[2, 1, 1, SphericalCoords[x, y, z]]], {x, -5, 5}, {y, 0.001, 5}, {z, 0.002, 5}, MaxRecursion ->2, Contours -> {0.006, 0.007, 0.008}]

[Graphics:HTMLFiles/Lecture-26_78.gif]

-Graphics3D -

epsilon = 10^(-6)

1/1000000

pdens = NMaximize[Abs[HAtom[3, 2, 1, SphericalCoords[x, y, z]]], {x, y, z}]

{0.0000480448, {x→ -2.07518, y→0.440033, z→2.12132}}

p1 = ContourPlot3D[Abs[HAtom[3, 2, 1, SphericalCoords[x, y, z]]], {x, -10, 10}, {y, epsilon, 10}, {z, epsilon, 10}, MaxRecursion→2, PlotPoints-> {7, 7}, Contours-> {0.95pdens[[1]]}]

[Graphics:HTMLFiles/Lecture-26_85.gif]

-Graphics3D -

[Graphics:HTMLFiles/Lecture-26_88.gif]

-Graphics3D -

However, we can always put the octants back together like a puzzle

Show[p1, p2]

[Graphics:HTMLFiles/Lecture-26_91.gif]

-Graphics3D -

Write a function to place all the octants on one graph

It takes about a minute to compute and display one probability density contour

H210 = HAtomShow[2, 1, 0, 0.8]

[Graphics:HTMLFiles/Lecture-26_95.gif]

-GraphicsArray -

The next one takes a couple minutes, presumably because of the small probability values?

3,2,1 corresponds to a 3d spin-up electron

H321 = HAtomShow[3, 2, 1, 0.8]

[Graphics:HTMLFiles/Lecture-26_98.gif]

-GraphicsArray -

I am not sure why I am only getting the top half here...

H31m1 = HAtomShow[3, 1, -1, 0.8]

[Graphics:HTMLFiles/Lecture-26_101.gif]

-GraphicsArray -

H531 = HAtomShow[5, 3, 1, 0.9]

[Graphics:HTMLFiles/Lecture-26_104.gif]

-GraphicsArray -


Created by Mathematica  (December 5, 2005) Valid XHTML 1.1!