Ask Your Question
2

Spherical Harmonics

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

curios_mind gravatar image

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

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

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Comments

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 +0100 )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

Stats

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

Seen: 733 times

Last updated: Jun 15 '20