besselKx

Evaluates a sequence of modified Bessel functions of the second kind with real order and complex arguments.

Synopsis

besselKx (xnu, z, n)

Required Arguments

float xnu (Input)
The lowest order desired. The argument xnu must be greater than −1/2.
complex z (Input)
Argument for which the sequence of Bessel functions is to be evaluated.
int n (Input)
Number of elements in the sequence.

Return Value

The n values of the function through the series. Element i contains the value of the Bessel function of order xnu + i for \(i=0, \ldots,n-1\).

Description

The Bessel function \(K_v(z)\) is defined to be

\[K_v(z) = \tfrac{\pi}{2} e^{v \pi i/2} \left[iJ_v\left(ze^{\pi i/2}\right) - Y_v\left(ze^{\pi i/2}\right)\right] \text{ for } -\pi < \arg z \leq \tfrac{\pi}{2}\]

This function is based on the code BESSCC of Barnett (1981) and Thompson and Barnett (1987).

For moderate or large arguments, z, Temme’s (1975) algorithm is used to find \(K_v(z)\). This involves evaluating a continued fraction. If this evaluation fails to converge, the answer may not be accurate. For small z, a Neumann series is used to compute \(K_v(z)\). Upward recurrence of the \(K_v(z)\) is always stable.

Example

In this example, \(K_{0.3+n-1}(1.2+0.5i)\), \(\nu=1,\ldots,4\) is computed and printed.

from __future__ import print_function
from numpy import *
from pyimsl.math.besselKx import besselKx

n = 4
xnu = 0.3
z = 1.2 + 0.5j
sequence = besselKx(xnu, z, n)
for i in range(0, n):
    print("K sub %4.2f ((%4.2f,%4.2f)) = (%5.3f,%5.3f)"
          % (xnu + i, z.real, z.imag, sequence[i].real, sequence[i].imag))

Output

K sub 0.30 ((1.20,0.50)) = (0.246,-0.200)
K sub 1.30 ((1.20,0.50)) = (0.336,-0.362)
K sub 2.30 ((1.20,0.50)) = (0.587,-1.126)
K sub 3.30 ((1.20,0.50)) = (0.719,-4.839)