ohno / Antique.jl

Self-contained, well-tested, well-documented Analytical Solutions of Quantum Mechanical Equations.
https://ohno.github.io/Antique.jl/
MIT License
18 stars 3 forks source link

Mismatch between definition and implementation in spherical harmonics #40

Closed ohno closed 3 weeks ago

ohno commented 3 months ago

There is a mismatch between the definition and the implementation in the spherical harmonics.

Y_{lm}(\theta,\varphi) = (-1)^{\frac{|m|+m}{2}} \sqrt{\frac{2l+1}{4\pi} \frac{(l-|m|)!}{(l+|m|)!}} P_l^{|m|} (\cos\theta) \mathrm{e}^{im\varphi}.

https://github.com/ohno/Antique.jl/blob/54fde9ab8408d503bf9f3cf740d3b1bf44c8846d/src/HydrogenAtom.jl#L50-L53

These are mathematically equivalent.

i^{|m|+m} \sqrt{\frac{(l-|m|)!}{(l+|m|)!}} P_l^{|m|} = (-1)^{\frac{|m|+m}{2}} \sqrt{\frac{(l-|m|)!}{(l+|m|)!}} P_l^{|m|} = (-1)^m \sqrt{\frac{(l-m)!}{(l+m)!}} P_l^{m}.

However, they are not equivalent programmatically.

julia> im^(abs(-1) + -1)
1 + 0im

julia> (-1)^((abs(-1) + -1)/2)
1.0
ohno commented 1 month ago

The phase factor is called as "Condon-Shortley Phase":

This issue is related to https://github.com/ohno/Antique.jl/issues/49 and https://github.com/ohno/Antique.jl/issues/51.