# Spherical Harmonics

Hello,

I was wondering the difference between Sage's spherical_harmonic (as well as Maxima's spherical_harmonic) and Mathematica's SphericalHarmonicY for the same arguments.

Sage's

print(spherical_harmonic(1,1,pi/3,pi/6).n())
print(spherical_harmonic(1,-1,pi/3,pi/6).n())


gives the following result:

0.149603355150537 - 0.259120612103502*I
-0.259120612103502 + 0.149603355150537*I


Maxima's

print(maxima.spherical_harmonic(1,1,pi/3,pi/6).n())
print(maxima.spherical_harmonic(1,-1,pi/3,pi/6).n())


gives

0.259120612103502 + 0.149603355150537*I
-0.259120612103502 + 0.149603355150537*I


and Mathematica,

SphericalHarmonicY[1, 1, Pi/3, Pi/6] // N
SphericalHarmonicY[1, -1, Pi/3, Pi/6] // N


gives

-0.259121 - 0.149603*I
0.259121 - 0.149603*I


I have come across the convention difference between Maxima and Mathematica in some textbooks-- that is the (-1)^m factor, but I am not quite sure if I get it for between Sage's and Mathematica's.

So, what is the mathematical relationship between Sage's spherical_harmonic and Mathematica's SphericalHarmonicY in terms of l and m?

Thanks alot.

edit retag close merge delete

Sort by » oldest newest most voted

Unfortunately, spherical harmonics in Sage have various issues, which are tracked in the ticket #25034. See this thread for a possible workaround.

more

Wow.. this problem was reported 2 years ago with "major" priority. I am suprised that it has been resolved yet. At the moment, my work around is to use Maxima's spherical_harmonic with ".sage()" at the end; converting it to sage.

Thanks for the warning, though. I was digging all the math books to figure out if there were a different convention to represent spherical_harmonics that mathces sage's.