# [SciPy-user] special's Bessel functions and *plt

el corto elcortostrash at gmx.net
Tue Mar 23 09:16:19 CST 2004

```Hi

I'm using Python 2.3, PythonWin, SciPy-0.2.1_253.3724.win32,
Scipy_core-0.2.2_alpha_104.1488.win32
(for those who are interested in version numbers)

When I plot the Bessel function scipy.special.jv(n,x) (where x can be
complex) with gplt

from scipy.special import *
x=arange(-10,10,.1)

from scipy import gplt
gplt.plot(x,jv(3,x))

I get some "cuts" at -4 and +4 where the curve isn't smooth. When I try to
give complex arguments like

gplt.plot(x,jv(3,x+0j))

gplt refuses to plot and shows some errors which means that it isn't able to
handle complex y-values as

jv(3,x+0j)

gives complex and

jv(3,x)

real values. Trying the same with xplt

from scipy import xplt
xplt.plot(x,jv(3,x))

shows the same cuts as with gplt  but

xplt.plot(x,jv(3,x+0j))

does not due to xplt.plot's the ability of handling complex y-values
(ignoring imaginary parts).  Do these "cuts" mean that

jv(3,x)

is unable to evaluate the correct function values when fed with a real x or
is it a problem with the plotting routines anyway (with jv(3,x)) ??

============

Another strange thing:

Plotting the Bessel function scipy.special.jn(n,x) (where x must be real,
gives real y-values) with gplt

from scipy.special import *
x=arange(-10,10,.1)

from scipy import gplt
gplt.plot(x,jn(2,x))

shows also some kind of "cut" at x = 0 down to y = -1 as it evaluates

jn(2,0)
-1.#IND

(what doest "#IND"  mean !!??) where the function value should be 0 at x = 0
which is evaluated and plotted correctly in Maple.

Plotting the same with xplt

from scipy import xplt
xplt.plot(x,jn(2,x))

shows no such "peak" at x = 0. Why is that even though jn(2,0) evaluates to
a wrong function value ?