Microsoft KB Archive/90288

= Microsoft Knowledge Base =

Excel: ATP Definition: BESSELK
Last reviewed: January 30, 1996

Article ID: Q90288

The information in this article applies to:


 * Microsoft Excel for Windows 95, version 7.0
 * Microsoft Excel for Windows, versions 4.0, 5.0
 * Microsoft Excel for the Macintosh, versions 4.0, 5.0

SUMMARY
The versions of Microsoft Excel listed above provide a set of special analysis tools called the Analysis ToolPak. This article is part of a series of articles that provide information on the underlying formulas used in the Analysis ToolPak functions.

This article covers the following functions:

BESSELK (Equivalent to the BESSELJ and BESSELY functions, evaluated for purely imaginary arguments)

Note: This function calls C subroutines which are detailed in the ATP Definition for the BESSELI function.

MORE INFORMATION
The following C routine is used to calculate the modified Bessel K function where n=0 and x is any positive real number:

float bessk0(x) float x;
 * 1) include 

{

double y, ans; float bessi0;

if ( x <= 2.0) { y=x*x/4.0; ans=(-log(x/2.0)*bessi0(x))+(-0.57721566+y*(0.42278420 +y*(0.23069756+y*(0.3488590e-1+y*(0.262698e-2              +y*(0.10750e-3+y*0.74e-5)))))); } else { y=2.0/x; ans=(exp(-x)/sqrt(x))*(1.25331414+y*(-0.7832358e-1 +y*(0.2189568e-1+y*(-0.1062446e-1+y*(0.587872e-2              +y*(-0.251540e-2+y*0.53208e-3)))))); }    return ans; }

The following C routine is used to calculate the modified Bessel K function where n=1 and x is any positive real number:

float bessk1(x) float x;
 * 1) include 

{

double y, ans; float bessi1;

if ( x <= 2.0 ) { y=x*x/4.0; ans=a(log(x/2.0)*bessi1(x))+(1.0/x)*(1.0+y*(0.15443144

+y*(-0.67278579+y*(-0.18156897+y*(-0.1919402e-1              +y*(-0.110404e-2+y*(-0.4686e-4))))))); } else { y=2.0/x; ans=(exp(-x)/sqrt(x))*(1.25331414+y*(0.23498619 +y*(-0.3655620e-1+y*(0.1504268e-1+y*(-0.780353e-2              +y*(0.325614e-2+y*(-0.68245e-3))))))); }    return ans; }

The following C routine is used to calculate the modified Bessel K function where n>=2 and x is any positive real number:

float bessk(n,x)

int n; float x;

{

int j;    float bk, bkm, bkp, tox; float bessk0, bessk1; void nrerror;

if (n < 2) nrerror(&quot;Index n less than 2&quot;); tox=2.0/x; bkm=bessk0(x); bk=bessk1(x); for ( j=1; j<n; j++) { bkp=bkm+j*tox*bk; bkm=bk; bk=bkp; }    return bk; }