正在加载图片...
6.6 Modified Bessel Functions of Integer Order 239 The recurrence relation for In(x)and Kn(x)is the same as that for n(z) and Yn(z)provided that ix is substituted for x.This has the effect of changing a sign in the relation. In+1(x)= In(z)+In-1(z) (6.6.4) Kn+1()=+ 2n Kn(z)+Kn-1(x) These relations are always unstable for upward recurrence.For Kn,itself growing, this presents no problem.For In,however,the strategy of downward recursion is 83g therefore required once again,and the starting point for the recursion may be chosen 18881992 in the same manner as for the routine bessj.The only fundamental difference is 1.00 that the normalization formula for I(x)has an alternating minus sign in successive terms.which again arises from the substitution of ix for x in the formula used Z.l0e三eme previously for from NUMERICAL RECIPES I 1=Io(x)-2I2(x)+2I4(x)-2I6(x)+· (6.6.5) (Nort server to make UnN电.t 令 America computer one paper THE In fact,we prefer simply to normalize with a call to bessio. With this simple modification,the recursion routines bess j and bessy become ART the new routines bessi and bessk: Programs float bessk(int n,float x) send Returns the modified Bessel function Kn(x)for positive x and n 2. st st float bessko(float x); float bessk1(float x); void nrerror(char error_text[]); int j; float bk,bkm,bkp,tox; if (n 2)nrerror("Index n less than 2 in bessk"); tox=2.0/x; bkm=bessk0(x); Upward recurrence for all x... bk=bessk1(x); email to directcustserv@cambridge.org 1988-1992 by Numerical Recipes OF SCIENTIFIC COMPUTING(ISBN 0-521-43108-5) for (j=1;j<n;j++) ..and here it is. bkp=bkm+j*tox*bk; bkm=bk; bk=bkp; return bk; (outside North America) Software. #include <math.h> machine #define ACC 40.0 Make larger to increase accuracy. #define BIGNO 1.0e10 #define BIGNI 1.0e-10 float bessi(int n,float x) Returns the modified Bessel function In(x)for any real x and n 2 float bessio(float x); void nrerror(char error-text☐);6.6 Modified Bessel Functions of Integer Order 239 Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). The recurrence relation for In(x) and Kn(x) is the same as that for Jn(x) and Yn(x) provided that ix is substituted for x. This has the effect of changing a sign in the relation, In+1(x) = − 2n x  In(x) + In−1(x) Kn+1(x)=+ 2n x  Kn(x) + Kn−1(x) (6.6.4) These relations are always unstable for upward recurrence. For K n, itself growing, this presents no problem. For In, however, the strategy of downward recursion is therefore required once again, and the starting point for the recursion may be chosen in the same manner as for the routine bessj. The only fundamental difference is that the normalization formula for In(x) has an alternating minus sign in successive terms, which again arises from the substitution of ix for x in the formula used previously for Jn 1 = I0(x) − 2I2(x)+2I4(x) − 2I6(x) + ··· (6.6.5) In fact, we prefer simply to normalize with a call to bessi0. With this simple modification, the recursion routines bessj and bessy become the new routines bessi and bessk: float bessk(int n, float x) Returns the modified Bessel function Kn(x) for positive x and n ≥ 2. { float bessk0(float x); float bessk1(float x); void nrerror(char error_text[]); int j; float bk,bkm,bkp,tox; if (n < 2) nrerror("Index n less than 2 in bessk"); tox=2.0/x; bkm=bessk0(x); Upward recurrence for all x... bk=bessk1(x); for (j=1;j<n;j++) { ...and here it is. bkp=bkm+j*tox*bk; bkm=bk; bk=bkp; } return bk; } #include <math.h> #define ACC 40.0 Make larger to increase accuracy. #define BIGNO 1.0e10 #define BIGNI 1.0e-10 float bessi(int n, float x) Returns the modified Bessel function In(x) for any real x and n ≥ 2. { float bessi0(float x); void nrerror(char error_text[]);
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有