Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatch between definition and implementation in spherical harmonics #40

Closed
ohno opened this issue Apr 5, 2024 · 1 comment
Closed
Assignees
Milestone

Comments

@ohno
Copy link
Owner

ohno commented Apr 5, 2024

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}.$$

function Y(model::HydrogenAtom, θ, φ; l=0, m=0)
N = (im)^(m+abs(m)) * sqrt( (2*l+1)*factorial(l-Int(abs(m))) / (2*factorial(l+Int(abs(m)))) )
return N * P(model,cos(θ), n=l, m=Int(abs(m))) * exp(im*m*φ) / sqrt(2*π)
end

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 ohno added this to the v1.0.0 milestone Apr 18, 2024
@ohno
Copy link
Owner Author

ohno commented May 17, 2024

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

This issue is related to #49 and #51.

@ohno ohno closed this as completed in 13ad0af Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant