besselExpI1¶
Evaluates the exponentially scaled modified Bessel function of the first kind of order one.
Synopsis¶
besselExpI1 (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_1(x)\). If no solution can be computed, NaN is returned.
Description¶
The function besselI1 underflows if \(|x|/2\) underflows. The Bessel
function \(I_1(x)\) is defined to be
\[I_1(x) = \tfrac{1}{\pi} \int_0^{\pi} e^{x \cos \theta} \cos \theta d \theta\]
Example¶
The expression \(e^{-4.5} I_0(4.5)\) is computed directly by calling
besselExpI1 and indirectly by calling besselI1. The absolute
difference is printed. For large x, the internal scaling provided by
besselExpI1 avoids overflow that may occur in besselI1.
from __future__ import print_function
from numpy import *
from pyimsl.math.besselExpI1 import besselExpI1
from pyimsl.math.besselI0 import besselI0
x = 4.5
ans = besselExpI1(x)
print("(e**(-4.5))I1(4.5) = %f" % (ans))
error = abs(ans - (exp(-x) * besselI0(x)))
print("Error = %e" % error)
Output¶
(e**(-4.5))I1(4.5) = 0.170959
Error = 2.323946e-02