[Numpy-discussion] no ordinary Bessel functions?
Mon Dec 14 22:39:36 CST 2009
On Mon, Dec 14, 2009 at 22:30, Dr. Phillip M. Feldman
> When I issue the command
> I get the following:
> Search results for 'bessel'
> Modified Bessel function of the first kind, order 0.
> Return the Kaiser window.
> Draw samples from a von Mises distribution.
> I assume that there is an ordinary (unmodified) Bessel function in NumPy,
Nope. i0() is only in numpy to support the kaiser() window. Our policy
on special functions is to include those which are exposed by C99 with
a few exceptions for those that are necessary to support other
functions in numpy. scipy.special is the place to go for general
special function needs.
> but have not been able to figure out how to access it. Also, I need to
> operate sometimes on scalars, and sometimes on arrays. For operations on
> scalars, are the NumPy Bessel functions significantly slower than the SciPy
> Bessel functions?
I recommend using the %timeit magic in IPython to test such things:
In : from scipy import special
In : %timeit numpy.i0(1.0)
1000 loops, best of 3: 921 µs per loop
In : %timeit special.i0(1.0)
100000 loops, best of 3: 5.6 µs per loop
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion