Tutorial and exercises for the BHPToolkit SpinWeightedSpheroidalHarmonics package

<<SpinWeightedSpheroidalHarmonics`

The four new functions

The package defines 4 new functions

?SpinWeightedSphericalHarmonicY

?SpinWeightedSpheroidalEigenvalue

?SpinWeightedSpheroidalHarmonicS

?SpinWeightedSpheroidalHarmonicSFunction

The last one you never call directly: it is the output from SpinWeightedSpheroidalHarmonicS in some cases

Spin-weighted spherical harmonics

SpinWeightedSphericalHarmonicY[-2,2,2,θ,ϕ]

SpinWeightedSphericalHarmonicY[-2,2,2,0.5,0.1]

You can evaluate the functions to arbitrary precision

SpinWeightedSphericalHarmonicY[-2,2,2,0.5`30,0.1`30]

For s=0 the spin-weighted harmonics just become the scalar harmonics

Table[SpinWeightedSphericalHarmonicY[0,l,m,θ,ϕ]-SphericalHarmonicY[l,m,θ,ϕ]//Simplify,{l,0,5},{m,-l,l}]//MatrixForm

The eigenvalue value is simple in the γ=0 case

SpinWeightedSpheroidalEigenvalue[s,l,m,0]

Spin-weighted spheroidal eigenvalue

SpinWeightedSpheroidalEigenvalue[2,3,2,0.1]

The SpinWeightedSpheroidalEigenvalue can be quickly evaluated to very high precision.

Timing[SpinWeightedSpheroidalEigenvalue[2,3,2,0.1`200]]

You can use Mathematica’s Series command to make expansions about γ=0 for arbitrary {s,l,m}

Series[SpinWeightedSpheroidalEigenvalue[s,l,m,γ],{γ,0,1}]

It is quicker to perform the expansion for specific values of {s,l,m}

smallγExpansion=Series[SpinWeightedSpheroidalEigenvalue[2,3,2,γ],{γ,0,5}]

You can also make expansions around γ =∞. This only works for specific values of {s,l,m}

largeγExpansion=Series[SpinWeightedSpheroidalEigenvalue[2,3,2,γ],{γ,∞,5}]

Let’s compare the two expansions above to the numerical results

eigenvalueTable=Table[{γ,SpinWeightedSpheroidalEigenvalue[2,3,2,γ]},{γ,0,8,0.1}];

Show[
ListPlot[eigenvalueTable,PlotTheme->"Detailed",BaseStyle->18,FrameStyle->Black,FrameLabel->{"γ","(Subscript[λ, 32])"},ImageSize->600,PlotStyle->Darker[Green]],
Plot[Evaluate[Normal[smallγExpansion]],{γ,0,10},PlotStyle->Red],
Plot[Evaluate[Normal[largeγExpansion]],{γ,1,10},PlotStyle->Blue]
]

For s=0 the eigenvalue can be related to the SpheroidalEigenvalue[ ] function build into Mathematica

Block[{l=2,m=2,γ=0.5`20},
{SpinWeightedSpheroidalEigenvalue[0,l,m,γ],
SpheroidalEigenvalue[l,m,I γ]-2 m γ}
]

Spin-weighted spheroidal harmonic

The SpinWeightedSpheroidalHarmonicS function can be evaluated quickly to arbitrary precision

t1=Timing[SpinWeightedSpheroidalHarmonicS[-2,2,2,0.5`40,0.5`40,0.4`40]]

The above was fast but if you want to compute the harmonic for many different values of {θ,ϕ} then there is a quicker way. If you call the function without the θ,ϕ arguments you get an object that stores some precomputed steps and that can be evaluated quickly.

S=SpinWeightedSpheroidalHarmonicS[-2,2,2,0.5`40]

t2=Timing[S[0.5`40,0.4`40]]

t1/t2

This is ~70 times faster to run. This is fast plot interactively using a manipulate function

Manipulate[Block[{S,s=-2,l=2,m=2},
S=SpinWeightedSpheroidalHarmonicS[s,l,m,γ];
Show[
ListPlot[Table[{θ,S[θ,0]},{θ,0,π,0.01}],Joined->True,PlotTheme->"Detailed",PlotStyle->Red,ImageSize->600],
Plot[SpinWeightedSphericalHarmonicY[s,l,m,θ,0],{θ,0,π}],
PlotRange->All
]
],{{γ,1.},0,3}]

Let’s do the same but for all the l=2 harmonics:

plotOptions:=Sequence[PlotRange->{0,1},Frame->True,FrameLabel->{"θ","Spin-weighted spheroidal harmonic (γ=2.0)"},PlotLegends->Placed[LineLegend[Table["m = "<>ToString[m],{m,-l,l}],LegendFunction->(Framed[#,RoundingRadius->5,Background->Directive[White,Opacity[0.8]]]&)],{0.85,0.71}],ImageSize->600];

Manipulate[Block[{s=-2,l=2},Module[{sSlm},
sSlm=Table[SpinWeightedSpheroidalHarmonicS[s,l,m,γ][θ,0],{m,-l,l}];Plot[sSlm,{θ,0,π},Evaluate[plotOptions]]]],{γ,0,2}]

We can also make a nice 3D plot show all the l=2 harmonics:

plot3DOptions:=Sequence[Axes->False,Boxed->False,PlotRange->{{-1,1},{-1,1},{-1,1}},BoxRatios->{1,1,1},PlotStyle->Directive[ColorData[97,m+l],Opacity[0.8]],ViewPoint->{Front,Right},SphericalRegion->True,PlotPoints->50];

Block[{s=-2,l=2,γ=2.0},Show[
Table[
sSlm=SpinWeightedSpheroidalHarmonicS[s,l,m,γ];
SphericalPlot3D[Abs[Re[sSlm[θ,ϕ]]],{θ,0,π},{ϕ,-π,π},Evaluate[plot3DOptions]],{m,-l,l}],ImageSize->800]]

We can also use Series[ ] to expand the SpinWeightedSpheroidalHarmonic about γ=0 as a series of SpinWeightedSphericalHarmonics

Series[SpinWeightedSpheroidalHarmonicS[s,l,m,γ,θ,ϕ],{γ,0,1}]

Series[SpinWeightedSpheroidalHarmonicS[2,l,2,γ,π/2,0],{γ,0,3}]/.l->3

We can also compute derivatives of the harmonic w.r.t. θ and ϕ

D[SpinWeightedSpheroidalHarmonicS[2,2,2,0.1,θ,0.4],{θ,2}]/.θ->0.5

Explicitly using either the “SphericalExpansion” or “Leaver” method

SpinWeightedSpheroidalEigenvalue[2,2,2,2.`50,Method->"SphericalExpansion"]
SpinWeightedSpheroidalEigenvalue[2,2,2,2.`50,Method->"Leaver"]

The SphericalExpansion method has an extra option called “NumTerms”.  As we increase the number of terms used the result converges exponentially to the right answer.

S=SpinWeightedSpheroidalEigenvalue[2,2,2,2.`100];
diff=N[{#,SpinWeightedSpheroidalEigenvalue[2,2,2,2.`100,Method->{"SphericalExpansion","NumTerms"->#}]-S}]&/@{5,10,15,20,25,30}

ListLogPlot[diff,PlotTheme->"Detailed",PlotRange->All,ImageSize->500]

Exercises

1. By making a plot show that the residual between the series expansion about γ=0 of the eigenvalue up to O(n) goes as O(n+1). Pick any values for n, l,m, and s≠0

2. Do the same as Q1 but for the series expansion about γ=∞

3. By explicit substitution show that the harmonic and eigenvalue satisfy the angular equation