Microsoft KB Archive/89403

= Microsoft Knowledge Base =

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

Article ID: Q89403

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.

This article covers the following functions:

BESSELY (Returns the nth order of the Bessel function Y(x), also called the Weber function or the Neumann function)

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

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

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

{

float z;    double xx, y, ans, ans1, ans2; float bessj0;

if ( x < 8.0) {   // Rational function approximation y=x*x; ans1=-2957821389.0+y*(7062834065.0+y*(-512359803.6 +y*(10879881.29+y*(-86327.92757+y*228.4622733)))); ans2=40076544269.0+y*(745249964.8+y*(7189466.438 +y*(47447.26470+y*(226.1030244+y*1.0)))); ans=(ans1/ans2)+0.636619772*bessj0(x)*log(x); } else { // Fitting function z=8.0/x; y=z*z; xx=x-0.785398164; ans1=1.0+y*(-0.1098628627e-2+y*(0.2734510407e-4 +y*(-0.2073370639e-5+y*0.2093887211e-6))); ans2=-0.1562499995e-1+y*(0.1430488765e-3           +y*(-0.6911147651e-5+y*(0.7621095161e-6            +y*0.934935152e-7))); ans=sqrt(0.636619772/x)*(sin(xx)*ans1+z*cos(xx)*ans2); }    return ans; }

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

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

{

float z;    double xx, y, ans, ans1, ans2; float bessj1;

if (x < 8.0) {   // Rational function approximation y=x*x; ans1=x*(-0.4900604943e13+y*(0.1275274390e13 +y*(-0.5153438139e11+y*(0.7349264551e9 +y*(-0.4237922726e7+y*0.8511937935e4))))); ans2=0.2499580570e14+y*(0.4244419664e12           +y*(0.3733650367e10+y*(0.2245904002e8            +y*(0.1020426050e6+y*(0.3549632885e3+y))))); ans=(ans1/ans2)+0.636619772*(bessj1(x)*log(x)-1.0/x); } else { z=8.0/x; y=z*z; xx=x-2.356194491; ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4 +y*(0.2457520174e-5+y*(-0.240337019e-6)))); ans2=0.04687499995+y*(-0.2002690873e-3           +y*(0.8449199096e-5+y*(-0.88228987e-6            +y*0.105787412e-6))); ans=sqrt(0.636619772/x)*(sin(xx)*ans1+z*cos(xx)*ans2); }    return ans; }

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

float bessy(n,x)

int n; float x;

{

int j;    float by, bym, byp, tox; float bessy0, bessy1; void nrerror;

if(n < 2) nrerror(&quot;Index n less than 2&quot;); tox=2.0/x; by=bessy1(x); bym=bessy0(x); for ( j=1; j<n; j++ ) { // Recurrence byp=j*tox*by-bym; bym=by; by=byp; }    return by; }