Correct implementation of spherical bessel functions (#992)

Closes #991
This commit is contained in:
Ferrangelo
2025-08-17 12:11:22 +02:00
committed by GitHub
parent 97c45f21e3
commit d9587127d5
2 changed files with 6 additions and 2 deletions
+2 -2
View File
@@ -218,7 +218,7 @@ def spherical_jn(ctx, n, z):
mpf('0.84147098480789639')
"""
return ctx.besselj(n + ctx.one/2, z) * ctx.sqrt(ctx.pi/2*z)
return ctx.besselj(n + ctx.one/2, z) * ctx.sqrt(ctx.pi/(2*z))
@defun
def spherical_yn(ctx, n, z):
@@ -240,7 +240,7 @@ def spherical_yn(ctx, n, z):
mpf('-0.54030230586813965')
"""
return ctx.bessely(n + ctx.one/2, z) * ctx.sqrt(ctx.pi/2*z)
return ctx.bessely(n + ctx.one/2, z) * ctx.sqrt(ctx.pi/(2*z))
@defun_wrapped
def whitm(ctx,k,m,z,**kwargs):
+4
View File
@@ -2454,3 +2454,7 @@ def test_issue_908():
def test_issue_637():
assert hankel1(1, 1 + 30j).ae(-7.25495e-15 - 1.17346e-14j)
assert hankel2(1, 1 - 30j).ae(-7.25495e-15 + 1.17346e-14j)
def test_issue_991():
assert spherical_jn(0, 1.3).ae(0.74119860416707)
assert spherical_yn(0, 1.3).ae(-0.20576832971122)