After #33117, Sage's spherical harmonics agree with those of SymPy, SciPy, Mathematica and Wikipedia. But for odd order m, they contain sqrt(sin(theta)^2) terms, which should be simplified to sin(theta), given that the colatitude angle theta lies in [0,pi] and hence fulfills sin(theta)>=0.
For instance, in Sage 9.6.beta5, we have
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)
whereas SymPy version has sin(theta) instead of sqrt(sin(theta)^2):
sage: from sympy import Ynm
sage: Ynm(1, 1, theta, phi).expand(func=True)
-sqrt(6)*exp(I*phi)*sin(theta)/(4*sqrt(pi))
CC: @slel @mjungmath @tscrim
Component: symbolics
Keywords: spherical harmonics
Author: Eric Gourgoulhon
Branch/Commit: 175cc9a
Reviewer: Matthias Koeppe, Frédéric Chapoton, Samuel Lelièvre
Issue created by migration from https://trac.sagemath.org/ticket/33501
After #33117, Sage's spherical harmonics agree with those of SymPy, SciPy, Mathematica and Wikipedia. But for odd order m, they contain
sqrt(sin(theta)^2)terms, which should be simplified tosin(theta), given that the colatitude anglethetalies in [0,pi] and hence fulfillssin(theta)>=0.For instance, in Sage 9.6.beta5, we have
whereas SymPy version has
sin(theta)instead ofsqrt(sin(theta)^2):CC: @slel @mjungmath @tscrim
Component: symbolics
Keywords: spherical harmonics
Author: Eric Gourgoulhon
Branch/Commit:
175cc9aReviewer: Matthias Koeppe, Frédéric Chapoton, Samuel Lelièvre
Issue created by migration from https://trac.sagemath.org/ticket/33501