besselExpK0¶
Evaluates the exponentially scaled modified Bessel function of the second kind of order zero.
Synopsis¶
besselExpK0 (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 K_0(x)\). If no solution can be computed, NaN is returned.
Description¶
The argument must be greater than zero for the result to be defined. The Bessel function \(K_0(x)\) is defined to be
\[K_0(x) = \int_0^{\infty} \cos (x \sinh t) dt\]
Example¶
The expression
\[\sqrt{e} K_0 (0.5)\]
is computed directly by calling besselExpK0
and indirectly by calling
besselK0
. The absolute difference is printed. For large x
, the
internal scaling provided by besselExpK0
avoids underflow that may occur
in besselK0
.
from __future__ import print_function
from numpy import *
from pyimsl.math.besselExpK0 import besselExpK0
from pyimsl.math.besselK0 import besselK0
x = 0.5
ans = besselExpK0(x)
print("(e**(0.5))K0(0.5) = %f" % (ans))
error = abs(ans - (exp(-x) * besselK0(x)))
print("Error = %e" % (error))
Output¶
(e**(0.5))K0(0.5) = 1.524109
Error = 9.634209e-01