Mathematica - Spherical Harmonics
Mathematica - Spherical Harmonics
Sin[]
2
Sin[],
1
2
3
Cos[],
1
2
3
Cos[] Sin[]
2
,
1
2
15
Cos[] Sin[]
2
Sin[],
1
2
15
Cos[] Sin[]
2
Sin[],
1
8
5
(1 3 Cos[2 ]),
1
2
15
Cos[2 ] Sin[]
2
Out[11]=
11
, {0],
3
4
, {0], {0], {0],
10 5
143
, {0], {0]
Out[12]= Function{, ],
Cos[]
8
3
572
(17 25 Cos[2 ])
Out[13]=
2 SH_Test .nb
In[28]:= + Checks if a given set of coefficients corresponds to zonal harmonics +
shIsZonalshcoeffs_, l_ := Plus FlatenshIndicesl+ Flattenshcoeffs = 0
+ Some utility functions +
shSymConvolveNormCoeffsl_ := MapIndexedlist, currLevel
TableSqrt4 + Pi 2+ currLevel +1, Lengthlist, shIndicesl
shExtractSymCoeffsshcoeffs_ :=
Table1CeilingLength1 2, Length1 & shcoeffs
+ Convolution with a kernel expressed via zonal harmonics,
symmetric around the z-axis +
shSymConvolutionshcoeffs_, shsymkerncoeffs_, l_ :=
CheckshIsZonalshsymkerncoeffs, err;
shSymConvolveNormCoeffsl+ shcoeffs + shExtractSymCoeffsshsymkerncoeffs
In[59]:= + Another test +
testFn2_, _ := UnitStepCos+ Sin + asymmetric +
testFn2Coeffs = shGenCoeffsshfns, testFn2
testFn2SH = , EvaluateshReconstructshfns, testFn2Coeffs
plotFn2 = SphericalPlot3DtestFn2, ,
, 0, Pi, , 0, 2+ Pi, Mesh - False, PlotRange - Full
plotFn2SH = SphericalPlot3DtestFn2SH, , , 0, Pi,
, 0, 2+ Pi, Mesh - False, PlotRange - Full
ShowplotFn2, plotFn2SH
+ Test convolution +
shIsZonaltestFnCoeffs, testNumLevels
testConvolvedCoeffs = shSymConvolutiontestFn2Coeffs, testFnCoeffs, testNumLevels
testFnConvolvedSH = , EvaluateshReconstructshfns, testConvolvedCoeffs
plotConvolvedSH = SphericalPlot3DtestFnConvolvedSH, ,
, 0, Pi, , 0, 2+ Pi, Mesh - False, PlotRange - Full
Out[60]= , {{0], {0], {0]], {0], 2
5
3
, {0], {0], {0]
Out[61]= Function{, ],
5 Sin[2 ] Sin[]
2
SH_Test .nb 3
Out[62]=
4 SH_Test .nb
Out[63]=
SH_Test .nb 5
Out[64]=
Out[65]=
1
4
3
Flaten[{{0], {1, 0, 1], {2, 1, 0, 1, 2]]]
1
11
Flaten[{{0], {1, 0, 1], {2, 1, 0, 1, 2]]]
10
143
5 Flaten[{{0], {1, 0, 1], {2, 1, 0, 1, 2]]] 0
6 SH_Test .nb
Out[66]=
2
3 2
11 3
, {{0], {0], {0]], {0],
200
21
143
, {0], {0], {0]
Out[67]= Function{, ],
91 3 300 35 Cos[] Sin[] Sin[]
3003
Out[68]=
SH_Test .nb 7