104 views

Skip to first unread message

Jun 14, 2019, 2:15:38 PM6/14/19

to sage-support

Today I have been working with the sage function "spherical_harmonic" and have had problems reproducing the tabulated results for these functions. For example, "spherical_harmonic(2, 1, theta, phi)" gives results that are wrong in a minus sign and happen similarly with other parameters. However, I use the sympy library function that I thought was the default for symbolic calculations in SageMath and you can see that it works correctly. Could it help me understand what's going on?

Jun 15, 2019, 11:55:07 AM6/15/19

to sage-support

Unfortunately, the current implementation of spherical harmonics in Sage suffers from various issues. One is the sign convention, which is different from the standard one, as you pointed out. Another issue is getting false results for some parameters, like

`sage: theta, phi = var('theta phi')`

sage: spherical_harmonic(1, 1, theta, phi)

-1/4*sqrt(3)*sqrt(2)*sqrt(-sin(theta)^2)*e^(I*phi)/sqrt(pi)

The term sqrt(-sin(theta)^2) in the above expression is plain false. It should be sin(theta).

This issue is related to the bug reported in

As a workaround, I would recommend to use the function spin_weighted_spherical_harmonic with the spin weight set to zero instead of spherical_harmonic. The function spin_weighted_spherical_harmonic is not part of the main SageMath, but of the SageMath package kerrgeodesics_gw. So you have to install the later via

`sage -pip install kerrgeodesic_gw`

`NB: on CoCalc, you have to add the option --user:`

`sage -pip install --user kerrgeodesic_gw`

Then, you will get (the first argument, i.e. 0, is the spin weight; if zero, one gets the standard spherical harmonics):

`sage: from kerrgeodesic_gw import spin_weighted_spherical_harmonic`

sage: spin_weighted_spherical_harmonic(0, 2, 1, theta, phi)

-1/4*sqrt(15)*sqrt(2)*cos(theta)*e^(I*phi)*sin(theta)/sqrt(pi)

sage: spin_weighted_spherical_harmonic(0, 1, 1, theta, phi)

-1/4*sqrt(6)*e^(I*phi)*sin(theta)/sqrt(pi)

Both results agree with the standard values, as given e.g. in

Jun 15, 2019, 10:29:12 PM6/15/19

to sage-s...@googlegroups.com

Can I someone tell me in whats files (path) are implemented de algorithm for spherical harmonics for take a time for doing a modification in cython??

Jun 16, 2019, 4:09:15 AM6/16/19

to sage-support

On Sun, Jun 16, 2019 at 3:29 AM Evys Ancede <eanc...@gmail.com> wrote:

>

> Can I someone tell me in whats files (path) are implemented de algorithm for spherical harmonics for take a time for doing a modification in cython??

It is Python, in fact, there is class SphericalHarmonic in
>

> Can I someone tell me in whats files (path) are implemented de algorithm for spherical harmonics for take a time for doing a modification in cython??

functions/special.py, and you want to fix its

_eval_ member.

>

> --

> You received this message because you are subscribed to the Google Groups "sage-support" group.

> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.

> To post to this group, send email to sage-s...@googlegroups.com.

> Visit this group at https://groups.google.com/group/sage-support.

> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAF8QkNPuP4maJqX6ZgZfW%2BHWNNKBka9CLbLWB84WKqowZ6we%3DQ%40mail.gmail.com.

> For more options, visit https://groups.google.com/d/optout.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu