28
O O Classroom Tips and Techniques: Eigenvalue Problems for ODEs - Part 3 Robert J. Lopez Emeritus Professor of Mathematics and Maple Fellow Maplesoft Initializations restart with VectorCalculus , SetCoordinates , Laplacian : with PDEtools , dchange , separability : with Statistics : with Student Calculus1 , Summand : with IntegrationTools , Parts : with gfun, diffeqtorec : interface typesetting = extended : Introduction In Part 1 of this series of articles on solving eigenvalue problems for ODEs, we discussed equations for which the general solution readily yielded eigenvalues and eigenfunctions without the need for detailed knowledge of any of the special functions of applied mathematics. In Part 2 of this series, we examined the solution of Laplace's equation in a cylinder. Separation of variables in cylindrical coordinates leads to a singular Sturm-Liouville eigenvalue problem whose differential equation is the Bessel equation. In Part 3 of this series, we will examine the solution of Laplace's equation in a sphere. Separation of variables in spherical coordinates leads to a singular Sturm-Liouville eigenvalue problem in which the differential equation is Legendre's equation. Reasoning from a general solution of Legendre's equation to the bounded solutions needed to solve the eigenvalue problem is a significantly greater challenge than it was for the parallel case of Bessel's equation. Our discussion will highlight the contributions Maple can make to this process.

Classroom Tips and Techniques: Eigenvalue Problems for

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

Classroom Tips and Techniques:

Eigenvalue Problems for ODEs - Part 3

Robert J. LopezEmeritus Professor of Mathematics and Maple Fellow

Maplesoft

Initializations

restart

with VectorCalculus, SetCoordinates, Laplacian :with PDEtools, dchange, separability :with Statistics :with Student Calculus1, Summand :with IntegrationTools, Parts :with gfun, diffeqtorec :interface typesetting= extended :

Introduction

In Part 1 of this series of articles on solving eigenvalue problems for ODEs, we discussed equations for which the general solution readily yielded eigenvalues and eigenfunctions without the need for detailed knowledge of any of the special functions of applied mathematics. In Part 2 of this series, we examined the solution of Laplace's equation in a cylinder. Separation of variables in cylindrical coordinates leads to a singular Sturm-Liouville eigenvalue problem whose differential equation is theBessel equation.

In Part 3 of this series, we will examine the solution of Laplace's equation in a sphere. Separation of variables in spherical coordinates leads to a singular Sturm-Liouville eigenvalue problem in which the differential equation is Legendre's equation. Reasoning from a general solution of Legendre's equation to the bounded solutions needed to solve the eigenvalue problem is a significantly greater challenge than it was for the parallel case of Bessel's equation. Our discussion will highlight the contributions Maple can make to this process.

Page 2: Classroom Tips and Techniques: Eigenvalue Problems for

Steady-State Temperatures in a Sphere

At steady state, the temperature u in a sphere satisfies Laplace's equation V2u = 0 and some conditionson the boundary of the sphere, which we describe in spherical coordinates by 0 % ρ% c, 0% φ%π, 0% θ% 2 π. In addition to the conditions prescribed on the surface ρ = c,

the physical properties of the system demand the solution be continuous. This requirement will be the most important, and most difficult condition to impose.

If the temperature on the surface of the sphere is prescribed, we say that a Dirichlet condition has been imposed. If the prescribed temperature on the surface is f φ , a function of φ alone, the temperature in the sphere will exhibit azimuthal symmetry so that u ρ, φ, θ = u ρ, φ . Alternatively, if this prescribed temperature is F φ, θ , then the temperature in the sphere will exhibit azimuthal asymmetry so that u = u ρ, φ, θ .

If the surface of the sphere is insulated so the net heat flux across this surface is zero, we say that a homogeneous Neumann condition has been imposed. The flux across the surface is the normal

derivative given by uρ

=vu

vρ evaluated at ρ = c, where c is the radius of the sphere. The net flux

would be the surface integral of this derivative. However, if the net heat flux across the surface of a homogeneous sphere is zero, the steady-state temperature in the sphere will be constant.

Spherical Coordinates in Maple

From our statement of the problem above, our definition of spherical coordinates can be inferred. However, because there are two different usages prevalent in the literature, we will explicitly define our system according to the notation in most mathematics texts. In such texts, ρ is the distance from the origin; θ, measured from the positive x-axis and around the z-axis, lies in the range 0% θ%2 π; and φ, measured downward from the positive z-axis, lies in the range 0% φ% π. The equations connecting these spherical coordinates with Cartesian coordinates appear on the left in Table 1.

Spherical coordinates in texts for physics, engineering, and the applied sciences tend to interchange the names θ and φ. The equations connecting these spherical coordinates with Cartesian coordinates appear on the right in Table 1.

Math Texts

Angle φ measured downfrom z-axis

Science Texts

Angle θ measured down from z-axis

x = ρ sin φ cos θy = ρ sin φ sin θ

z= ρ cos φ

x = ρ sin θ cos φy = ρ sin θ sin φ

z= ρ cos θ

Table 1 Spherical coordinates as defined in math

Page 3: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

OOOO

texts (left) and science texts (right)

Finally, note that in Maple's VectorCalculus package, commands that use spherical coordinates assume that the "middle" coordinate in the triple u, v, w is the angle measured down from the z-axis. Unfortunately, in a number of plot commands in the plots package, this convention is not respected. Maple is currently struggling with this quandary, especially so, given its commitment to backward compatibility.

We set the ambient coordinate system via the command

SetCoordinates sphericalρ, φ, θ :

Laplace's Equation in Spherical Coordinates

In a sphere, the steady-state temperature u ρ, φ, θ satisfied Laplace's equation V2u = 0. This equation is given in Maple as

LE := expand Laplacian uρ, φ, θ = 0

LE d

2 v

vρu ρ, φ, θ

ρC

v2

vρ2 u ρ, φ, θ C

cos φ v

vφu ρ, φ, θ

ρ2 sin φ

C

v2

vφ2 u ρ, φ, θ

ρ2

C

v2

vθ2

u ρ, φ, θ

ρ2 sin φ

2= 0

Maple can determine if the partial differential equation is variable separable:

separability LE, `*` ;0

The return of "0" indicates that the equation is indeed separable because the separability conditions are identically satisfied.

Azimuthal Symmetry

Separation of Variables

Under the assumption that the steady-state temperatures u are symmetric about the z-axis, dependence on angle θ can be dispensed with. Hence, u = u ρ, φ , and a Maple-generated variable-separation is obtained with

pdsolve LEu ρ, φ, θ = u ρ, φ

Page 4: Classroom Tips and Techniques: Eigenvalue Problems for

(6.1.1)

OOOO

OOOO

OOOO

OOOO

u ρ, φ = _F1 ρ _F2 φ &whered2

dρ2

_F1 ρ =_F1 ρ _c1

ρ2

K

2 d

dρ_F1 ρ

ρ,

d2

dφ2

_F2 φ =K_F2 φ _c1K

cos φ d

dφ_F2 φ

sin φ

Equation (6.1.1) shows that a variable separation solution of the form

U := Ρ ρ Φ φ

U d Ρ ρ Φ φ

exists, and provides the ordinary differential equations the functions Ρ ρ and Φ φ must satisfy. We now proceed to obtain these same results from first principles.

Under the separation assumption, Laplace's equation assumes the simpler form

q1d expand

LEu ρ, φ, θ = U

ρ2

U

q1d

2 ρ d

dρΡ ρ

Ρ ρC

ρ2

d2

dρ2Ρ ρ

Ρ ρC

cos φ d

dφΦ φ

Φ φ sin φC

d2

dφ2Φ φ

Φ φ= 0

Moving all terms in φ to the right, we then have

temp:= select has, lhs q1 , φ :

q2d q1Ktemp

q2d

2 ρ d

dρΡ ρ

Ρ ρC

ρ2

d2

dρ2Ρ ρ

Ρ ρ=K

cos φ d

dφΦ φ

Φ φ sin φK

d2

dφ2Φ φ

Φ φ

Introduction of Bernoulli's separation constant λ then leads to the ordinary differential equations

q3d lhs q2 = λ

q4d rhs q2 = λ

q3d

2 ρ d

dρΡ ρ

Ρ ρC

ρ2

d2

dρ2Ρ ρ

Ρ ρ= λ

q4dK

cos φ d

dφΦ φ

Φ φ sin φK

d2

dφ2 Φ φ

Φ φ= λ

Page 5: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

OOOO

OOOO

We are primarily interested in the second of these equations - it will become Legendre's equation after a mild rearrangement and change of variables. First, write the equation in the form

q5d q4K lhs q4

q5d 0 =λC

cos φ d

dφΦ φ

Φ φ sin φC

d2

dφ2Φ φ

Φ φ

and then

q6d expand q5 Φ φ sin φ

q6d 0 =Φ φ sin φ λCcos φ d

dφΦ φ Csin φ

d2

dφ2Φ φ

Now, make the change of variables x = cos φ , with Φ φ becoming Φ arccosx = y x . This is done in Maple with

q7d simplify dchange φ = arccosx , Φ φ = y x , q6

q7d 0 =y x λKy x λ x2

K2 y# x xC2 x3 y# x Cy$ x K2 y$ x x2Cy$ x x4

1Kx2

Further simplifying, we have

q8d collect simplifyq7

1Kx2, diff

q8d 0 = 1Kx2 y$ x K2 y# x xCy x λ

which is the standard form of Legendre's equation, the self-adjoint form of which would be

1Kx2 y# #Cλ y x = 0

The Sturm-Liouville Eigenvalue Problem

The eigenvalue problem that embeds Legendre's equation is singular. The boundary conditions are simply that y x must be continuous on the interval K1 % x% 1. Passage from the general solution

dsolve q8, y x

y x = _C1 P4 λC1

2K

12

x C_C2 Q4 λC1

2K

12

x

to the eigenfunctions is surprisingly more difficult than it was for Bessel's equation. Because we are in extended typesetting mode, the functions LegendrePa, x and LegendreQa, x are displayed as Pa x and Qa x , respectively. (Were we in extended typesetting mode during our

earlier discussion of Bessel's equation, Maple would have displayed BesselJa, x as Ja x .)

Page 6: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

OOOO

When solving Laplace's equation in the cylinder, it was relatively easy to use continuity to restrictthe general solution to just J0 µ r , the Bessel function bounded on the interval 0% r % c, and to

determine the eigenvalues µk from the zeros of J0 x . We began the process by ruling out the

Bessel function of the second kind because we could tell from a graph that all such functions wereunbounded at the origin.

We will try to rule out the function LegendreQa, x in a similar way, but we will find the processmore difficult than it was for the Bessel function. For example, consider

simplify LegendreQ 2,x

Kln xC1

4C

ln K1Cx4

C3 x2 ln xC1

4K

3 x2 ln K1Cx4

K3 x2

from which it is clear that the function is unbounded at the endpoints x =G1 because of the logarithms. But this is obvious for a = 2, an integer. It is a bit more difficult to divine the endpoint behavior for general values of a. For example, we can calculate the values

simplify LegendreQ 2.5,K1simplify LegendreQ 2.5, 1

Float N CFloat N i

Float N CFloat N i

which suggest LegendreQa, x may indeed be unbounded at x =G1 for general values of a. Figure 1 contains graphs of the real and imaginary parts of LegendreQa, x , with x in the open interval K1, 1 and a in the interval 1, 3.

plot3d R LegendreQa, x , a= 1 ..3,x =K1 ..1,axes= box, orientation= 30,70 , title= "(a) - Real Part"

1

-1-1

x

20

a

9

13

(a) - Real Part

plot3d I LegendreQa, x , a= 1 ..3,x =K1 ..1,axes= box, orientation= 35,75 , title= "(b) - Imaginary Part"

1-1-1.6

2

x

0.4

0 31

(b) - Imaginary Part

Figure 1 Real and imaginary parts of LegendreQa, x for

Page 7: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

OOOO

OOOO

K1 ! x!1, suggesting LegendreQa, x is unbounded on K1 % x% 1

From Figure 1(a) especially, we conclude that LegendreQ a, 1 is unbounded for general values of a. On the basis of this conclusion, we set _C2 to zero in the general solution of Legendre's equation, and turn our attention to LegendrePa, x , the Legendre function of the first kind.

We first show that for general (real) values of a, LegendrePa,K1 is unbounded. Sample calculations include

LegendreP 2.2,K1Float N CFloat N i

To illustrate this behavior for multiple values of a, we define the following piecewise function.

f := piecewise1000! LegendrePa, K1 , 2, LegendrePa, K1

f d2 1000! Pa K1

Pa K1 otherwise

If LegendrePa,K1 is large, then a graph of f a will show a point at a, 2 for that value of a. If LegendrePa,K1 is "not large" then a graph of f a will show the value of LegendrePa,K1 .

We can control the evaluation points for a graph of f a if we define the uniform random variableX via

X := RandomVariable UniformK3, 3 :then create a uniform but random sample of a-values that includes the integers in the interval K3, 3 .

S := sort convert convert Sample X, 100 , set g seq k, k =K3 ..3 , list :The graph of f a in Figure 2 shows that virtually all evaluations of LegendrePa,K1 are large inmagnitude.

plot f, a =K3 ..3,sample= S, adaptive= false, style= point, view= K3..3,K2 ..2 , color = blue

Page 8: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

(6.2.1)

OOOO

K3 K2 K1 0 1 2 3

K2

K1

1

2

Figure 2 Stylized graph of LegendrePa,K1 for K3 % a % 3

However, it also suggests that LegendrePk,K1 =K1 k kR 0

K1 kC1 k! 0 for integer k. For

noninteger k, f a is unbounded so that the bounded solutions of Legendre's equation

q8

0 = 1Kx2 y$ x K2 y# x xCy x λ

will be the eigenfunctions LegendrePk, x with

k =12

4 λC1 K12

k =4 λC1

2K

12

an integer. Hence, the eigenvalues will be

solve (6.2.1), λk2Ck

that is, λk = k kC1 , k = 0, 1,…. The first few eigenfunctions are

for k from 0 to 5 doP kd simplify LegendrePk, xend dounassign 'k'

P0d 1P1d x

P2dK12

C3 x2

2

Page 9: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

P3d52

x3K

32

x

P4d38

C358

x4K

154

x2

P5d638

x5K

354

x3C

158

x

which are the Legendre polynomials Pk x , normalized so that Pk 1 = 1. These polynomials are

graphed in Figure 3.

plot P|| 0 ..5 , x =K1 ..1OOOO

K1.0 K0.5 0 0.5 1.0

K1.0

K0.5

0.5

1.0

Figure 3 The Legendre polynomials Pk x , k = 0,…, 5

That the function LegendrePa, x reduces to the polynomial Pk x for a = k = 0, 1,…, can be seen

from the following calculations.

For noninteger a, we first obtain the formal power series expansion of LegendrePa, x via

F := convert LegendrePa, x , FormalPowerSeries, x

F d>k= 0

N 2 π Ka2 k

a2

C12 k

4k x2 k

Γ12

Ka2

Γa2

a 2 k !C>

k= 0

N

K

2 π 12

Ka2 k

1Ca2 k

4k x2 kC1

Γa2

C12

Γ Ka2

2 kC1 !

then extract the general term in the first series with

q9d Summand op1, F 1

Page 10: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

q9d

2 π Ka2 k

a2

C12 k

4k x2 k

Γ12

Ka2

Γa2

a 2 k !

The pochhammer symbol

z n = pochhammerz, n = z zC1 / zCnK1

or "rising factorial" for z complex generalizes to

pochhammerz, µ =Γ zCµ

Γ z

for complex µ. If z is a nonpositive integer, then

pochhammerz, µ = limt/0

Γ zCµCt

Γ zC t

Making this transformation and setting x = 1 in the general term of the first series for LegendrePa, x gives the general coefficient

q10d convert q9x = 1

, Γ

q10d

2 π Γ Ka2

Ck Γa2

C12

Ck 4k

Γ12

Ka2

Γa2

a Γ Ka2

Γa2

C12

Γ 2 kC1

For large k this coefficient is asymptotic to

temp1d series q10, k =N, 2 assuming a O 0 :

temp2d simplify convert temp1, polynom assuming a O 0 :

combine temp2

Ksin π a

2 k π

suggesting that LegendrePa, 1 is unbounded since the series under consideration will behave like the harmonic series at x = 1. We can confirm this behavior by comparing the general

coefficient with 1k

for large k. In the limit we find the ratio tends to

limk/N

q10 k assuming kT posint, a O0

2 π

Γ12

Ka2

Γa2

a Γ Ka2

Γa2

C12

Page 11: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

which is finite for a not an integer. To see that for integer a the series for LegendrePa, x reducesto a polynomial, examine the recursion formula for its coefficients. This is most efficiently obtained in Maple via

factor isolate diffeqtorec q8, y x , u k , u kC2

u kC2 =KλCkCk2 u k

kC1 kC2

from which it becomes clear that ukC2 = 0 when λ = k kC1 . Hence, ukC2 j = 0, j = 2, 3,….

Therefore, LegendrePk, x is a polynomial of degree k for .λ = k kC1 .

Orthogonality of the Eigenfunctions

The classical proof of the orthogonality of the eigenfunctions of Legendre's equation is based on integration by parts. The self-adjoint form of the equation, namely,

1Kx2 y# #Cλ y x = 0

is written once for an eigenfunction u x and once for v x . The first equation is multiplied by v x , and the second, by u x , and the difference of the two products is integrated over K1 % x

% 1. Integration by parts is applied to the terms containing the derivatives, which then vanish as we can see from the following sketch. Integrals of the terms containing the derivatives can be written as

q11d

K1

1

u x ddx

1Kx2 ddx

v x dx

q12d

K1

1

v x ddx

1Kx2 ddx

u x dx

q11d

K1

1

u x ddx

1Kx2 v# x dx

q12d

K1

1

v x ddx

1Kx2 u# x dx

Integration by parts and subtraction then lead to

Parts q11, u x KParts q12, v x

0

What remains is λuKλvK1

1

u v dx= 0. If the eigenvalues λu and λv are different, then

K1

1

u v dx= 0, which implies orthogonality of u and v.

Page 12: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

Thus, K1

1

Pj x Pk x dx= 0 for j s k, as we see for 0% j, k%5 via the matrix of evaluations

below.

Matrix 6, 6, i, j /

K1

1

LegendrePi K1, x LegendrePj K1, x dx

2 0 0 0 0 0

023

0 0 0 0

0 025

0 0 0

0 0 027

0 0

0 0 0 029

0

0 0 0 0 0211

From this matrix we also infer that K1

1

Pk2 x dx=

22 kC1

, a result Maple cannot show in

general, as we see from

K1

1

LegendrePk, x 2 dx assuming kT posint

K1

1

Pk x 2 dx

Fourier-Legendre Series

An integrable function f x ,K1 % x%1, can be represented by the Fourier-Legendre series

>k= 0

N

ak Pk x , where

ak =2 kC1

2K1

1

f x Pk x dx

The coefficients ak, k = 0, 1,…, 5, for the Fourier-Legendre series of the function

f := 1Kx2

Page 13: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

OOOO

f d 1Kx2

are

for k from 0 to 5 do

ak :=2 kC1

2 K1

1

f LegendrePk, x dx

end do; unassign 'k'

a0dπ

4a1d 0

a2dK5 π32

a3d 0

a4dK9 π256

a5d 0

A partial sum of the Fourier-Legendre series itself is given by

FLf :=>k= 0

5

ak LegendrePk, x

FLf dπ

4K

5 π P2 x

32K

9 π P4 x

256

or better still, by

simplify FLf6452048

πK1051024

π x2K

3152048

π x4

Figure 4 compares graphs of f x and the partial sum of its Fourier-Legendre series.

plot f, FLf , x =K1 ..1,color= black, red , thickness= 5,2 , scaling= constrained

Page 14: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

K1.0 K0.5 0 0.5 1.0

0.2

0.6

1.0

Figure 4 Graphs of f x = 1Kx2 (in black) and a partial sum of its Fourier-Legendre series (in red)

An integrable function g φ , 0% φ%π, can be represented by the Fourier-Legendre series

>k= 0

N

bk Pk cos φ , where

bk =2 kC1

20

π

g φ Pk cos φ dφ

The function g φ = f cos φ = 1Kcos2φ = sin φ has for its Fourier-Legendre coefficientsthe numbers

for k from 0 to 5 do

bkd2 kC1

20

π

sin φ simplify LegendrePk, cos φ sin φ dφ

end do; unassign 'k'

b0dπ

4b1d 0

b2dK5 π32

b3d 0

b4dK9 π256

b5d 0

Page 15: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

and for a partial sum of its Fourier-Legendre series, the polynomial

FLg := simplify >k= 0

5

bk LegendrePk, cos φ

FLg dK15 π K43C14 cosφ

2C21 cosφ

4

2048

Figure 5 compares graphs of g x and the partial sum of its Fourier-Legendre series.

plot sin φ , FLg , φ = 0 ..π, color= black, red , thickness= 5, 2 ,scaling= constrained

OOOO

0 1 2 30

0.6

1.0

Figure 5 Graphs of g 4 = sin 4 (in black) and a partial sum of its Fourier-Legendre series(in red)

Azimuthal Asymmetry

Separation of Variables

Without symmetry, u = u ρ, φ, θ , so the separated form of the solution of Laplace's equation would be

U := Ρ ρ Φ φ Θ θ

Ud Ρ ρ Φ φ Θ θ

Maple provides the following ODEs governing these three functions.

pdsolve LE;

Page 16: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

u ρ, φ, θ = _F1 ρ _F2 φ _F3 θ &whered2

dθ2

_F3 θ =K_F3 θ _c2,d2

dφ2

_F2 φ =K_F2 φ _c1C_F2 φ _c2

sin φ2

K

cos φ d

dφ_F2 φ

sin φ,

d2

dρ2

_F1 ρ

=_F1 ρ _c1

ρ2 K

2 d

dρ_F1 ρ

ρ

We proceed to obtain these results from first principles.

Upon division by u and multiplication by ρ2sin2

φ, Laplace's equation becomes

q13d expand

LEu ρ, φ, θ = U

ρ2 sin φ

2

U

q13d

2 ρ sin φ2

d

dρΡ ρ

Ρ ρC

ρ2 sin φ

2

d2

dρ2Ρ ρ

Ρ ρC

sin φ cos φ d

dφΦ φ

Φ φ

C

sin φ2

d2

dφ2 Φ φ

Φ φC

d2

dθ2 Θ θ

Θ θ= 0

If the terms containing θ are moved to the right, we have

temp:= select has, lhs q13 , θ :

q14d q13Ktemp

q14d

2 ρ sin φ2

d

dρΡ ρ

Ρ ρC

ρ2 sin φ

2

d2

dρ2 Ρ ρ

Ρ ρC

sin φ cos φ d

dφΦ φ

Φ φ

C

sin φ2

d2

dφ2Φ φ

Φ φ=K

d2

dθ2Θ θ

Θ θ

Introducing the separation constant µ leads to the two equations

q15d lhs q14 =µ

q16d rhs q14 =µ

Page 17: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

q15d

2 ρ sin φ2

d

dρΡ ρ

Ρ ρC

ρ2 sin φ

2

d2

dρ2Ρ ρ

Ρ ρC

sin φ cos φ d

dφΦ φ

Φ φ

C

sin φ2

d2

dφ2Φ φ

Φ φ=µ

q16dK

d2

dθ2 Θ θ

Θ θ=µ

The resulting θ-equation can be put into the form

q17d expandKΘ θ q16Kµ

q17dd2

dθ2Θ θ CΘ θ µ = 0

Continuity requires the imposition of the periodic boundary conditions

Θ Kπ =Θ π Θ# Kπ =Θ# π

thus forming a Sturm-Liouville eigenvalue problem for which the solution is Θ =α

ncos n θ Cβ

nsin n θ , n = 0, 1,…. Thus, µ = n2. Making this change in the companion

equation, and dividing by sin2φ, we have

q18d expand

q15

µ = n2

sin φ2

q18d

2 ρ d

dρΡ ρ

Ρ ρC

ρ2

d2

dρ2 Ρ ρ

Ρ ρC

cos φ d

dφΦ φ

Φ φ sin φC

d2

dφ2 Φ φ

Φ φ

=n2

sin φ2

Isolating the terms in ρ yields the separated equation

temp:= select has, lhs q18 , φ :

q19d q18Ktemp

Page 18: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

OOOO

q19d

2 ρ d

dρΡ ρ

Ρ ρC

ρ2

d2

dρ2Ρ ρ

Ρ ρ=

n2

sin φ2K

cos φ d

dφΦ φ

Φ φ sin φ

K

d2

dφ2Φ φ

Φ φ

and introduction of the separation constant λ leads to the two ODEs

q20d lhs q19 = λ

q21d rhs q19 = λ

q20d

2 ρ d

dρΡ ρ

Ρ ρC

ρ2

d2

dρ2Ρ ρ

Ρ ρ= λ

q21dn2

sin φ2 K

cos φ d

dφΦ φ

Φ φ sin φK

d2

dφ2 Φ φ

Φ φ= λ

The ρ-equation can be manipulated to the form

q22d expandΡ ρ q20Kλ

q22d 2 ρ d

dρΡ ρ Cρ

2

d2

dρ2Ρ ρ KΡ ρ λ = 0

from which we see that it is an Euler equation solvable in powers of ρ.

The remaining ODE is the associated Legendre equation, which we cast in the form

q23d expand sin φ Φ φ q21Kλ

q23dΦ φ n2

sin φKcos φ

d

dφΦ φ Ksin φ

d2

dφ2Φ φ KΦ φ sin φ λ = 0

by bringing all terms to the left and multiplying through by sinφ cos φ . The same change of variables that was used for Legendre's equation is applied, leading to

q24d simplify dchange φ = arccosx , Φ φ = y x ,Kq23

q24d

K1

1Kx2y x n2

C2 y# x xK2 x3 y# x Ky$ x C2 y$ x x2Ky$ x x4

Ky x λCy x λ x2 = 0

and then

Page 19: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

OOOO

(7.1.1)

collectq24

1Kx2, diff, y x , simplify

1Kx2 y$ x K2 y# x xCn2

Cλ x2Kλ y x

K1Cx2= 0

after suitable rearrangement. A slightly better form for this equation can be obtained with the command

q25 := collectq24

1Kx2, diff, y x , ζ/collect simplify ζ , λ, normal

q25d 1Kx2 y$ x K2 y# x xC λCn2

K1Cx2 y x = 0

but the form typically seen for Legendre's associated equation is

1Kx2 y''K2 x y'C λKn2

1Kx2 y = 0

The Sturm-Liouville Eigenvalue Problem

The general solution of Legendre's associated equation is

dsolve q25, y x

y x = _C1 P4 λC1

2K

12

n x C_C2 Q4 λC1

2K

12

n x

a linear combination of the two associated Legendre functions, LegendrePa, b, x and LegendreQa, b, x . (In extended typesetting mode, Maple writes these functions as Pa

b x , and

Qab x , respectively.) These are imaginatively called associated Legendre functions of the

first and second kinds, respectively. From Legendre's associated equation we can see that LegendrePa, 0, x = LegendrePa, x , and LegendreQa, 0, x = LegendreQa, x .

In the complex plane, a branch cut for a function is a line or line segment across which the function has a jump discontinuity. In Maple, there are two cut-regimes for the Legendre functions. The default regime imposes a cut on the real line coincident with the interval K1, 1 . Alternatively, the real intervals KN,K1 and 1,N comprise a second cut regime. Theenvironment variable _EnvLegendreCut is used to fix the cut regime by assigning it either of the expressions -1..1 or 1..infinity.

To solve Laplace's equation in the interior of a sphere, the associated Legendre functions that arise must have their branch cut outside of the interval K1, 1 , that is, opposite to the default regime. Hence, when working in Maple, the branch cut must be shifted via a proper assignment to the environment variable. However, commands such as evalf or simplify, commands that will

Page 20: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

OOOO

OOOO

OOOO

most likely be invoked in the context of the solution process, have a remember table, which storesthe value assigned to the environment variable. Reassigning a new value to the environment variable will not change the cut regime unless something is done to modify the remember tables in commands such as evalf and simplify. This is done by applying the forget command to these operators before changing the assignment to the environment variable.

For the sake of completeness, we illustrate these issues below.

With the default cut in place, the function LegendreP 5, 3,x is discontinuous across the line segment coincident with the real interval K1, 1 , a discontinuity we sample at x = 0.6 with the evaluations

LegendreP 5, 3, 0.6C1. 10-9 i

LegendreP 5, 3, 0.6K1. 10-9 i1.209600000 10K7K60.21120000 i

1.209600000 10K7C60.21120000 i

Another way to see the discontinuity across this cut is symbolically, with

simplify LegendreP 5, 3,x105 K1Cx 3 2 xC1 3 2 K1C9 x2

2

Careful inspection shows that for x ! 1, the term xK1 3/2 will be the square root of a negative number, from whence the discontinuity

limy/0C

xC i yK1 3/2 assuming xT RealRange OpenK1 , Open 1

limy/0K

xC i yK1 3/2 assuming xT RealRange OpenK1 , Open1

Ki 1Kx 3 2

i 1Kx 3 2

arises. Now, if we attempt to shift the branch cut with

_EnvLegendreCut:= 1 ..N:it can appear that the behavior of simplify is erratic; simplify may or may not reflect the change inthe branch cut, depending on the internal state of Maple. Here, we see

simplify LegendreP 5, 3,x105 K1Cx 3 2 xC1 3 2 K1C9 x2

2

Thus, it is possible that we could have obtained exactly the same result as when the branch cut is along K1, 1 . The reason for the uncertainty lies in the remember table attached to the simplify command. Although reassignment to the environment variable is immediate, because of the remember table simplify will not immediately access the new value unless an internal event causes the table to be cleared. To force the remember table to access the new setting, use

forget simplify;_EnvLegendreCutd 1 ..N:

Page 21: Classroom Tips and Techniques: Eigenvalue Problems for

(7.3.2)

OOOO

OOOO

OOOO

OOOO

(7.3.1)

the effect of which we test via

simplify LegendreP 5, 3,x

K105 1Kx 3 2 xC1 3 2 K1C9 x2

2

In either event, notice that now the term 1Kx 3/2 is real for x ! 1, and there will not be a jump across K1, 1 , as we see from

limy/0C

1K xC i y 3/2 assuming xT RealRange OpenK1 , Open 1

limy/0K

1K xC i y 3/2 assuming xT RealRange OpenK1 , Open1

1Kx 3 2

1Kx 3 2

Relating Maple to the Literature

The associated Legendre function of the first kind appears in the literature with two different symbols. For example, in the Handbook of Mathematical Functions by Abramowitz and Stegun (Dover Publications), we find the following two formulas relating these functions to Legendre polynomials.

Pnm x = K1 m 1Kx2 m/2 dm

dxm Pn x

Pnm x = K1 mPnm x = 1Kx2 m/2 dm

dxmPn x

By the obvious experiment, we can conclude that in Maple

LegendrePn, m, x = Pnm x = K1 m 1Kx2 m/2 dm

dxm Pn x

Indeed, we construct P53 x as

K1 3 1Kx2 3/2

d3

dx3 simplify LegendreP 5,x

K 1Kx2 3 2

945 x2

2K

1052

and compare it to LegendreP 5, 3,x in the form

simplify LegendreP 5, 3,x

K105 1Kx 3 2 xC1 3 2 K1C9 x2

2

On K1 % x% 1, the radicals appearing in both expressions are equivalent, as demonstrated by the

Page 22: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO OOOO

graphs in Figure 6.

plot (7.3.1), (7.3.2) , x =K1 ..1,color = black, red , thickness= 5, 2

OOOO

K1.0 0 0.5 1.0

K60

K40

K20

20

40

Figure 6 Graphs of LegendreP 5, 3,x (red) and P5

3 x (black)

Orthogonality of the Eigenfunctions

The orthogonality relation for the associated Legendre functions of the first kind is

K1

1

Pnm x Pk

m dx=

0 ksn

kCm !kKm !

22 kC1

k = n, and 0%m% k

a relation Maple can instantiate, but not easily establish from first principles. For example, Table 2 lists some integrals for which ks n, while Table 3 lists some for which k = n, comparing the computed and formulaic values of the integral.

for k to 5 do for n to 5 do for m to 5 do if n ! k and m% n then

q27d

K1

1

LegendrePk, m, x

.LegendrePn, m, x dx;

q28d

K1

1

simplify LegendrePn,

m, x LegendrePk, m, x dx;

for k to 5 do for m to k do

q29d

K1

1

LegendrePk, m, x 2

dx; q30d

K1

1

simplify LegendrePk, m,

Page 23: Classroom Tips and Techniques: Eigenvalue Problems for

print q27 = q28 end ifend do: end do: end do:

K1

1

P21 x ,P1

1 x dx = 0

K1

1

P31 x ,P1

1 x dx = 0

K1

1

P31 x ,P2

1 x dx = 0

K1

1

P32 x ,P2

2 x dx = 0

K1

1

P41 x ,P1

1 x dx = 0

K1

1

P41 x ,P2

1 x dx = 0

K1

1

P42 x ,P2

2 x dx = 0

K1

1

P41 x ,P3

1 x dx = 0

K1

1

P42 x ,P3

2 x dx = 0

K1

1

P43 x ,P3

3 x dx = 0

K1

1

P51 x ,P1

1 x dx = 0

K1

1

P51 x ,P2

1 x dx = 0

K1

1

P52 x ,P2

2 x dx = 0

K1

1

P51 x ,P3

1 x dx = 0

K1

1

P52 x ,P3

2 x dx = 0

K1

1

P53 x ,P3

3 x dx = 0

x 2 dx;

q31d2 kCm !

kKm ! 2 kC1;

print q29 = q30, q31

end do: end do:

K1

1

P11 x

2dx =

43

,43

K1

1

P21 x

2dx =

125

,125

K1

1

P22 x

2dx =

485

,485

K1

1

P31 x

2dx =

247

,247

K1

1

P32 x

2dx =

2407

,2407

K1

1

P33 x

2dx =

14407

,1440

7

K1

1

P41 x

2dx =

409

,409

K1

1

P42 x

2dx = 80, 80

K1

1

P43 x

2dx = 1120, 1120

K1

1

P44 x

2dx = 8960, 8960

K1

1

P51 x

2dx =

6011

,6011

K1

1

P52 x

2dx =

168011

,168011

K1

1

P53 x

2dx =

4032011

,40320

11

K1

1

P54 x

2dx =

72576011

,

72576011

Page 24: Classroom Tips and Techniques: Eigenvalue Problems for

K1

1

P51 x ,P4

1 x dx = 0

K1

1

P52 x ,P4

2 x dx = 0

K1

1

P53 x ,P4

3 x dx = 0

K1

1

P54 x ,P4

4 x dx = 0

K1

1

P55 x

2dx =

725760011

,

725760011

Table 2 K1

1

Pnm x Pk

m dx= 0 for ks nTable 3 For k = n,

K1

1

Pnm x Pk

m dx compared to

kCm !kKm !

22 kC1

Fourier-Legendre Series

The functions Pnm cos φ cos m θ , 0%m%n, n = 0, 1,…, together with the functions

Pnm cos φ sin m θ , 1%m% n, n = 1, 2,…, form a complete set on the rectangle 0% φ%π, 0

% θ%2 π. Consequently, a function g φ, θ can be expanded in a Fourier-Legendre series of the form

g φ, θ = >k= 0

N

>m= 0

k

Pkm cos φ Akm cos m θ CBkm sin m θ

where

m= 0 and kR 0

Ak0 =0

2 π

0

π

g φ, θ Pk0 cos φ sin φ dφ dθ

2 π0

π

Pk0 cos φ

2sin φ dφ

=0

2 π

0

π

g φ, θ Pk0 cos φ sin φ dφ dθ

2 π2

2 kC1

kR 0 and 1 %m

% k

Page 25: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

Akm=0

2 π

0

π

g φ, θ Pkm cos φ cos m θ sin φ dφ dθ

π0

π

Pkm cos φ

2sin φ dφ

=0

2 π

0

π

g 4, θ Pkm cos 4 cos m θ sin 4 d4 dθ

πkCm !kKm !

22 kC1

kR 1 and 1 %m

% kBkm=

0

2 π

0

π

g φ, θ Pkm cos φ sin m θ sin φ dφ dθ

π0

π

Pkm cos φ

2sin φ dφ

=0

2 π

0

π

g φ, θ Pkm cos φ sin m θ sin φ dφ dθ

πkCm !kKm !

22 kC1

For example, take g φ, θ as

g d16φ πKφ θ 2 πKθ

g dφ πKφ θ 2 πKθ

6

a function whose graph is seen in Figure 7.

plot3d g, φ = 0 ..π, θ = 0 ..2 π, axes= box, scaling= constrained, labels= 'f ', q, " " , labelfont= SYMBOL, 12

Page 26: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

OOOO

00

2

04θ

4

Figure 7 Graph of

g 4, θ =16

φ πKφ θ 2 πKθ

It is also useful to define the function

unassign 'k', 'm'

d := k, m /kCm !$2

kKm ! 2 kC1:

'd' k, m = d k, m

d k, m =2 kCm !

kKm ! 2 kC1

whose values appear in the denominators of the expressions for the series coefficients. The computation of these coefficients is slightly simplified by recognizing that all the Bkm are zero by

symmetry. Then, the first few Ak0 are given by

for k from 0 to 10 do

Ak, 0d1

2 π d k, 00

2 π

0

π

g simplify LegendrePk, 0, cos φ sin φ dφ dθ

end do:and the first few Akm, mO0, are given by

for k from 0 to 10 dofor m to k do

Tempd1

π d k, m0

2 π

g simplify LegendrePk, m, cos φ cos m θ sin φ dθ;

Ak, m := evalf0

π

Temp dφ

end do: end do:

Page 27: Classroom Tips and Techniques: Eigenvalue Problems for

OOOO

OOOO

unassign 'k','m'A partial sum of the Fourier-Legendre series for g is then

G :=>k= 0

10

>m= 0

k

Ak, m simplify LegendrePk, m, cos φ cos m θ :

the graph of which can be seen in Figure 8.

plot3d G, φ = 0 ..π, θ = 0 ..2 π, axes= box, scaling= constrained, labels= 'f', q, " " , labelfont= SYMBOL, 12

OOOO

0.20

2.2

04θ2

φ

Figure 8 Graph of partial sum of the Fourier-Legendre series for g 4, θ

To estimate the accuracy of this approximation, the difference GKg is plotted in Figure 9.

plot3d GKg, φ = 0 ..π, θ = 0 ..2 π, axes= box, scaling= constrained

Page 28: Classroom Tips and Techniques: Eigenvalue Problems for

Figure 9 Graph of GKg as an estimate of the accuracy of the partial sum G

Legal Notice: The copyright for this application is owned by Maplesoft. The application is intended to demonstrate the use of Maple to solve a particular problem. It has been made available for product evaluation purposes only and may not be used in any other context without the express permission of Maplesoft.