Skip to content

Commit 3f687d2

Browse files
authored
Merge pull request sympy#17849 from czgdp1807/pr-12116
Added `eval` in sympy.functions.special.bessel.jn
2 parents 4764908 + d989bd2 commit 3f687d2

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

sympy/functions/special/bessel.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,18 @@ class jn(SphericalBesselBase):
668668
.. [1] http://dlmf.nist.gov/10.47
669669
670670
"""
671+
@classmethod
672+
def eval(cls, nu, z):
673+
if z.is_zero:
674+
if nu.is_zero:
675+
return S.One
676+
elif nu.is_integer:
677+
if nu.is_positive:
678+
return S.Zero
679+
else:
680+
return S.ComplexInfinity
681+
if z in (S.NegativeInfinity, S.Infinity):
682+
return S.Zero
671683

672684
def _rewrite(self):
673685
return self._eval_rewrite_as_besselj(self.order, self.argument)

sympy/functions/special/tests/test_bessel.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ def myn(n, z):
221221

222222
def test_jn():
223223
z = symbols("z")
224+
assert jn(0, 0) == 1
225+
assert jn(1, 0) == 0
226+
assert jn(-1, 0) == S.ComplexInfinity
227+
assert jn(z, 0) == jn(z, 0, evaluate=False)
228+
assert jn(0, oo) == 0
229+
assert jn(0, -oo) == 0
230+
224231
assert mjn(0, z) == sin(z)/z
225232
assert mjn(1, z) == sin(z)/z**2 - cos(z)/z
226233
assert mjn(2, z) == (3/z**3 - 1/z)*sin(z) - (3/z**2) * cos(z)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy