Section 5.2 Legendre’s Equation

(1-(x^2))y\!\(\*
StyleBox["\"", "Subtitle"]\)\!\(\*
StyleBox["-", "Subtitle"]\)\!\(\*
StyleBox["2", "Subtitle"]\)\!\(\*
StyleBox["xy", "Subtitle"]\)\!\(\*
StyleBox["'", "Subtitle"]\)\!\(\*
StyleBox["+", "Subtitle"]\)\!\(\*
StyleBox["n", "Subtitle"]\)\!\(\*
StyleBox["(", "Subtitle"]\)\!\(\*
StyleBox["n", "Subtitle"]\)\!\(\*
StyleBox["+", "Subtitle"]\)\!\(\*
StyleBox["1", "Subtitle"]\)\!\(\*
StyleBox[")", "Subtitle"]\)\!\(\*
StyleBox["y", "Subtitle"]\)\!\(\*
StyleBox[" ", "Subtitle"]\)\!\(\*
StyleBox["=", "Subtitle"]\)\!\(\*
StyleBox[" ", "Subtitle"]\)\!\(\*
StyleBox["0", "Subtitle"]\)

n=1

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

sol=DSolve[eqn,y,x]

sol /. {C[1]-> 1,C[2]-> 0}

eqn /. %

n=2

eqn=(1-x^2) y''[x]-2 x y'[x]+6 y[x]==0

sol=DSolve[eqn,y,x]

n=3

eqn=(1-x^2) y''[x]-2 x y'[x]+12y[x]==0

DSolve[eqn,y,x]

LegendreP[1,x]

LegendreP[2,x]

LegendreP[3,x]

yl[x_]:=LegendreP[3,x]

Expand[(1-x^2) yl''[x]-2 x yl'[x]+12yl[x]==0]

Sum[n x^n,{n,1,5}]

LegenPoly[n_,x_]:=Sum[(-1)^m (2n-2m)!/(2^n m! (n-m)!(n-2m)!)x^(n-2m),{m,0,n/2}]

LegenPoly[1,x]

LegenPoly[2,x]

LegenPoly[3,x]

LegenPoly[4,x]

Plot[{LegenPoly[1,x],LegenPoly[2,x],LegenPoly[3,x],LegenPoly[4,x]},{x,-1,1},PlotLegends->"Expressions"]

Associated Legendre functions:

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

n=1;k=1;

fa[x_]:=(1-x^2)^(1/2)D[LegendreP[1,x],x]

y[x_]:=fa[x]

Simplify[eqna]

n=2;k=1;

fa[x_]:=(1-x^2)^(1/2)D[LegendreP[2,x],x]

y[x_]:=fa[x]

y[x]

Simplify[eqna]

n=2;k=2;

fa[x_]:=(1-x^2)D[LegendreP[2,x],{x,2}]

y[x_]:=fa[x]

y[x]

Simplify[eqna]

n=4;k=2;

fa[x_]:=(1-x^2)D[LegendreP[4,x],{x,2}]

y[x_]:=fa[x]

y[x]

Simplify[eqna]

ALegenf[n_,k_,x_]:=(1-x^2)^(k/2)D[LegendreP[n,x],{x,k}]

ALegenf[4,2,x]

ALegenf[2,2,x]

ALegenf[3,1,x]

n=2;k=2;

y[x_]:=ALegenf[n,k,x]

Simplify[eqna]

n=3;k=1;

y[x_]:=ALegenf[n,k,x]

y[x]

Simplify[eqna]

n=3;k=2;

y[x_]:=ALegenf[n,k,x]

y[x]

Simplify[eqna]

n=3; k=0;

ALegenf[n,k,x]

y[x_]:=ALegenf[n,k,x]

Simplify[eqna]