Microsoft KB Archive/90546

= Microsoft Knowledge Base =

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

Article ID: Q90546

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 BESSELI function, which is equivalent to the BESSELJ function, evaluated for purely imaginary arguments.

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

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

{

float ax, ans; double y;

if ((ax=fabs(x)) < 3.75) { y=x/3.75; y*=y; ans=1.0+y*(3.5156229+y*(3.0899424+y*(1.2067492              +y*(0.2659732+y*(0.360768e-1+y*0.45813e-2))))); } else { y=3.75/ax; ans=(exp(ax)/sqrt(ax))*(0.39894228+y*(0.1328592e-1 +y*(0.225319e-2+y*(-0.157565e-2+y*(0.916281e-2              +y*(-0.2057706e-1+y*(0.2635537e-1+y*(-0.1647633e-1 +y*0.392377e-2)))))))); }    return ans; }

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

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

{

float ax, ans; double y;

if ((ax=fabs(x)) < 3.75) { y=x/3.75; y*=y; ans=ax*(0.5+y*(0.87890594+y*(0.51498869+y*(0.15084934

+y*(0.2658733e-1+y*(0.301532e-2+y*0.32411e-3)))))); } else { y=3.75/ax; ans=0.2282967e-1+y*(-0.2895312e-1+y*(0.1787654e-1 -y*0.420059e-2)); ans=0.39894228+y*(-0.3988024e-1+y*(-0.362018e-2 +y*(0.163801e-2+y*(-0.1031555e-1+y*ans)))); }    return x < 0.0 ? -ans : ans; }

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


 * 1) include 

float bessi(n,x)
 * 1) define ACC 40.0
 * 2) define BIGNO 1.0e10
 * 3) define BIGNI 1.0e-10

int n; float x;

{

int j;    float bi, bim, bip, tox, ans; float bessi0; void nrerror;

if (n <2) nrerror(&quot;Index n less than 2&quot;); if (x == 0.0) return 0.0; else { tox=2.0/fabs(x); bip=ans=0.0; bi=1.0; for ( j=2*(n+(int)sqrt(ACC*n)); j>0; j--) { bim=bip+j*tox*bi; bip=bi; bi=bim; if (fabs(bi)>BIGNO) { ans *= BIGNI; bi *= BIGNI; bip *= BIGNI; }              if (j==n) ans=bip; }         ans *= bessi0(x)/bi; return x < 0.0 && n%2 == 1 ? -ans : ans; } }