Ask Your Question

Spherical Harmonics

asked 2020-06-15 00:04:06 +0200

curios_mind gravatar image

updated 2020-06-15 00:18:14 +0200


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.



gives the following result:

0.149603355150537 - 0.259120612103502*I
-0.259120612103502 + 0.149603355150537*I




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


-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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-06-15 11:47:57 +0200

eric_g gravatar image

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

edit flag offensive delete link 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.

curios_mind gravatar imagecurios_mind ( 2020-06-15 15:26:01 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-06-15 00:04:06 +0200

Seen: 452 times

Last updated: Jun 15 '20