Sage has long had problems with spherical harmonics, e.g., this thread
from June 2019:
https://groups.google.com/g/sage-support/c/I_d_meMxRbM/m/Esxo5UO2BAAJ
As of 9.5.beta8, spherical harmonics are (still) broken for some arguments,
with the test case noted in that earlier thread still giving the same
(wrong) result:
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 correct result would be
-1/4*sqrt(6)*e^(I*phi)*sin(theta)/sqrt(pi)
(see, e.g.,
https://en.wikipedia.org/wiki/Table_of_spherical_harmonics).
In that earlier thread, Eric Gourgoulhon noted that the problem was related
to
https://trac.sagemath.org/ticket/25034
Unfortunately, even though that ticket is now marked "closed defect (fixed)",
spherical harmonics are still broken.
Eric suggested a workaround, using the spin-weighted spherical harmonics
from the /kerrgeodesics_gw/ package, which for spin 0 should reduce to
the standard spherical harmonics.
This works if ell and emm are specific integers, but it can't handle the
case where they are generic variables. E.g., this works with Sage's
native spherical harmonics
sage: ell,emm = var('ell,emm')
sage: theta,phi = var('theta,phi')
sage: diff(spherical_harmonic(ell,emm, theta,phi), theta)
but the analogous
sage: from kerrgeodesic_gw import spin_weighted_spherical_harmonic
sage: diff(spin_weighted_spherical_harmonic(0, ell,emm, theta,phi), theta)
fails.
--
-- "Jonathan Thornburg [remove color- to reply]" <
jthor...@pink-gmail.com>
on the west coast of Canada, eh?
"There was of course no way of knowing whether you were being watched
at any given moment. How often, or on what system, the Thought Police
plugged in on any individual wire was guesswork. It was even conceivable
that they watched everybody all the time." -- George Orwell, "1984"