besselExpK1

Evaluates the exponentially scaled modified Bessel function of the second kind of order one.

Synopsis

besselExpK1 (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_1(x)\). If no solution can be computed, NaN is returned.

Description

The result

\[\mathrm{besselExpK1} = e^{\mathrm{X}} K_1(x) \approx \tfrac{1}{x}\]

overflows if x is too close to zero. The definition of the Bessel function

\[K_1(x) = \int_0^{\infty} \sin (x \sinh t ) \sinh t \phantom{.} dt\]

Example

The expression

\[\sqrt{e} K_1(0.5)\]

is computed directly by calling besselExpK1 and indirectly by calling besselK1. The absolute difference is printed. For large x, the internal scaling provided by besselExpK1 avoids underflow that may occur in besselK1.

from __future__ import print_function
from numpy import *
from pyimsl.math.besselExpK1 import besselExpK1
from pyimsl.math.besselK1 import besselK1

x = 0.5
ans = besselExpK1(x)
print("(e**(0.5))K1(0.5) = %f" % (ans))
error = abs(ans - (exp(x) * besselK1(x)))
print("Error = %e" % (error))

Output

(e**(0.5))K1(0.5) = 2.731010
Error = 0.000000e+00