sphrs icon indicating copy to clipboard operation
sphrs copied to clipboard

Differences with scipy.special.sph_harm for high degrees

Open sdeslauriers opened this issue 2 years ago • 1 comments

There are significant differences between the complex SH provided by scipy.special.sph_harm and those provided by sphrs for high degrees. For example, the conjugate of the computed SH at the point Coordinates::spherical(1f64, 1.7453292519943295, 1.3962634015954636) are

degree 11 and order 11: scipy: 0.4405634627748642+0.16035198675529674j sphrs: 3.561861287727778+1.2964114873179975j

degree 12 and order 12: scipy: -0.23561802283529287+0.4081023867296495j sphrs: -56.973351046253434+98.68073868956799j

degree 13 and order 13: scipy: -0.3622756435535203-0.3039853588902706j sphrs: -1770.9169188717583-1485.975733470897j

The dramatic increase in the values returned by sphrs makes me think of numerical instability, but I couldn't pinpoint the issue.

sdeslauriers avatar May 17 '23 10:05 sdeslauriers

That's not great. I also suspect a numerical instability. I'll have to investigate, but unfortunately I won't be able to look into it for at least a couple of weeks. Therefore if someone wants to have a go at this, feel free to do so!

Thanks for reporting this bug!

stefan-k avatar May 18 '23 05:05 stefan-k