Skip to content

Get rid of sqrt in spherical harmonics #33501

@egourgoulhon

Description

@egourgoulhon

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions