besselExpI0¶
Evaluates the exponentially scaled modified Bessel function of the first kind of order zero.
Synopsis¶
besselExpI0 (x)
Required Arguments¶
- float
x
(Input) - Point at which the Bessel function is to be evaluated.
Return Value¶
The value of the scaled Bessel function \(e^{-|x|} I_0(x)\). If no solution can be computed, NaN is returned.
Description¶
The Bessel function \(I_0(x)\) is defined to be
\[I_0(x) = \tfrac{1}{\pi} \int_0^{\pi} \cosh (x \cos \theta) d \theta\]
Example¶
The expression \(e^{-4.5} I_0(4.5)\) is computed directly by calling
besselExpI0
and indirectly by calling besselI0
. The absolute
difference is printed. For large x
, the internal scaling provided by
besselExpI0
avoids overflow that may occur in besselI0
.
from __future__ import print_function
from numpy import *
from pyimsl.math.besselExpI0 import besselExpI0
from pyimsl.math.besselI0 import besselI0
x = 4.5
ans = besselExpI0(x)
print("(e**(-4.5))I0(4.5) = %f" % (ans))
error = abs(ans - (exp(-x) * besselI0(x)))
print("Error = %e" % (error))
Output¶
(e**(-4.5))I0(4.5) = 0.194198
Error = 2.775558e-17