As a SymPy newbie, I am considering the following SymPy expression (which should be equal to 1 if 0<x<1
):
f = Sum((2/(lambda_m*besselj(1, lambda_m)))*besselj(0,x*lambda_m), (m, 1, oo))
where lambda_m
is the m
-th zero of besselj(0,x)
.
Now, mpmath
has a function besseljzero(0,m,0)
which computes exactly this.
Unfortunately, if I replace (manually, I mean...) lambda_m
by besseljzero(0,m,0)
in the upper formula, SymPy gives me an error because m
is not an integer...
I imagine solving this issues by creating a function which should:
- return
j0(m)
ifm
does not evaluate to an integer - return
besseljzero(0,m,0)
if it does
But I do not know how to proceed.
Is this a good idea, and can somebody help me?