jmert / AssociatedLegendrePolynomials.jl

A library for calculating the Associated Legendre polynomials
https://jmert.github.io/AssociatedLegendrePolynomials.jl/
MIT License
20 stars 2 forks source link

Calculate the initial condition using only real numbers #33

Closed jmert closed 1 year ago

jmert commented 1 year ago

The other recursion coefficients were already all using only real number types, but the initial condition was forgotten. This has worked thus far, but a change in the upcoming Julia v1.9 (presumably JuliaLang/julia#47255) broke the exact correspondance between real inputs and real-axis complex inputs for the spherical normalization.

Specifically, on Julia 1.8:

julia> r = inv(sqrt(4convert(Float64, π)))
0.28209479177387814

julia> r - real(inv(sqrt(4convert(ComplexF64, π))))
0.0

while with Julia 1.9:

julia> r = inv(sqrt(4convert(Float64, π)))
0.28209479177387814

julia> r - real(inv(sqrt(4convert(ComplexF64, π))))
-5.551115123125783e-17

The simple change that allows the tests to pass again is to just ask for the initial condition to be calculated in the appropriate real number type.

codecov[bot] commented 1 year ago

Codecov Report

Merging #33 (5603444) into master (b0df887) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #33   +/-   ##
=======================================
  Coverage   96.57%   96.57%           
=======================================
  Files           9        9           
  Lines         350      350           
=======================================
  Hits          338      338           
  Misses         12       12           
Impacted Files Coverage Δ
src/calculation.jl 94.40% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.