Modified Bessel function, third kind, integer order.

You're viewing an older version of this page (#168). View the current version.

View versions (1)

Interface

#include <codecogs/maths/special/bessel/k/k.h>

using namespace Maths::Special::Bessel::K;

The modified Bessel function of the third kind (or Weber Function) is a linear combination of Bessel functions of the first and second kinds. These are called the Hankel functions of the first and second kinds, and are one of two types of functions known as Hankel functions. The other type of Hankel function is defined by a contour integral.

Modified Bessel function of the 2nd/3rd kind
Modified Bessel function of the 2nd/3rd kind

See also hankel

This function returns modified Bessel function of the third kind of order n of the argument.

The range is partitioned into the two intervals [0,9.55] and (9.55, infinity). An ascending power series is used in the low range, and an asymptotic expansion in the high range.

Algorithm for Kn.

K_v (x) = 0.5 \left ( \frac{x}{2} \right )^{-v} \sum_{k=0}^{v-1} \frac{(v-k-1)!}{k!} \left ( \frac{-x^2}{4} \right )^{k} + (-1)^v 0.5 \left ( \frac{x}{2} \right ) ^v \cdot
(1)
\cdot \sum_{k=0}^\infty \left ( p(k+1) + p(v+k+1) - 2 log(x/2) \right ) \frac{x}{2}  \frac{ \left ( \frac{x^2}{4} \right)^{k} }{k! (v+k)!}
(2)

where p(m) is the psi function: p(1) = -EUL and

p(m)  =  -EUL + \sum_{k=1}^{m-1}  \frac{1}{k}
(3)

For large x,

K_v (z)  =  \sqrt(pi/2z) \exp(-z) \left ( 1 + \frac{(u-1)^2}{1} + \frac{(u-1)^2 (u-3)^2}{2} + ... \right )
(4)

asymptotically, where

u=4v^2
(5)

Accuracy:

<pre> Relative error: arithmetic domain # trials peak rms DEC 0,30 3000 1.3e-9 5.8e-11 IEEE 0,30 90000 1.8e-8 3.0e-10 </pre> Error is high only near the crossover point x = 9.55 between the two expansions used.

References

Cephes Math Library Release 2.8: June, 2000

Example 1

#include <stdio.h>
#include <codecogs/maths/special/bessel/k/k.h>

int main()
{
printf("\n  x      v=0      v=1      v=2      v=3      v=4      v=5");
for(double x=1; x<7; x++)
{
  printf("\nx=%.1lf",x);
  for(int v=0;v<=5;v++)
    printf(" %8.6lf", Maths::Special::Bessel::K::K(x,v));
}
return 0;
}

Output:

x      v=0      v=1      v=2      v=3      v=4      v=5
x=1.0 0.421024 0.601907 1.624839 7.101263 44.232416 360.960590
x=2.0 0.113894 0.139866 0.253760 0.647385 2.195916 9.431049
x=3.0 0.034740 0.040156 0.061510 0.122170 0.305851 0.937774
x=4.0 0.011160 0.012483 0.017401 0.029885 0.062229 0.154343
x=5.0 0.003691 0.004045 0.005309 0.008292 0.015259 0.032706
x=6.0 0.001244 0.001344 0.001692 0.002472 0.004164 0.008024

Parameters

x
input argument
v
order
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

x
v
Result