正在加载图片...
6.12 Hypergeometric Functions 273 #include "complex.h" #define ONE Complex(1.0,0.0) void hypser(fcomplex a,fcomplex b,fcomplex c,fcomplex z,fcomplex *series, fcomplex *deriv) Returns the hypergeometric series 2F1 and its derivative,iterating to machine accuracy.For z<1/2 convergence is quite rapid. void nrerror(char error_text[]); int n; fcomplex aa,bb,cc,fac,temp; http://www.nr. read able files Permission is der1v->r=0.0; deriv->1=0.0; fac=Complex(1.0,0.0) temp=fac; .com or call 1-800-872- (including this one) granted for i aa-a; bb=b cc=c for(n=1;n<=1000;n++){ fac=Cmul(fac,Cdiv(Cmul(aa,bb),cc)); deriv->r+=fac.r; deriv->i+fac.i; fac=Cmul(fac,RCmul(1.0/n,z)); *series=Cadd(temp,fac); if (series->r =temp.r&&series->i =temp.i)return 7423 (North America 电r:1s t tusers to make one paper 1988-1992 by Cambridge University Press.Programs from NUMERICAL RECIPES IN C: THE temp=*series; aa=Cadd(aa,ONE); bb=Cadd(bb,ONE); cc=Cadd(cc,ONE); only), copy for their nrerror("convergence failure in hypser"); #include "complex.h" #define ONE Complex(1.0,0.0) email to directcustsen extern fcomplex aa,bb,cc,z0,dz; Defined in hypgeo ART OF SCIENTIFIC COMPUTING(ISBN 0-521- void hypdrv(f1oats,float yy☐,float dyyds[☐) Computes derivatives for the hypergeometric equation,see text equation (5.14.4). fcomplex z,y[3],dyds [3]; @cambridge.org To order Numerical Recipes books or personal use.Further reproduction,or 1988-1992 by Numerical Recipes y[1]=Cop1ex(yy[1],yy[2]); -431085 y[2]=Complex(yy [3],yy [4]); z=Cadd(z0,RCmul(s,dz)); dyds [1]=Cmul(y [2],dz); dyds [2]=Cmul(Csub(Cmul(Cmul(aa,bb),y[1]),Cmul(Csub(cc. Software. Cmul(Cadd(Cadd(aa,bb),ONE),z)),y[2])), Cdiv(dz,Cmul(z,Csub(ONE,z)))); dyyds[1]-dyds[1].r; (outside North America) dyyds [2]=dyds[1].i; dyyds[3]=dyds[2].r; machine dyyds [4]=dyds [2].i; CITED REFERENCES AND FURTHER READING: Abramowitz,M.,and Stegun,I.A.1964,Handbook of Mathematical Functions,Applied Mathe- matics Series.Volume 55 (Washington:National Bureau of Standards:reprinted 1968 by Dover Publications,New York).[1]6.12 Hypergeometric Functions 273 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). #include "complex.h" #define ONE Complex(1.0,0.0) void hypser(fcomplex a, fcomplex b, fcomplex c, fcomplex z, fcomplex *series, fcomplex *deriv) Returns the hypergeometric series 2F1 and its derivative, iterating to machine accuracy. For |z| ≤ 1/2 convergence is quite rapid. { void nrerror(char error_text[]); int n; fcomplex aa,bb,cc,fac,temp; deriv->r=0.0; deriv->i=0.0; fac=Complex(1.0,0.0); temp=fac; aa=a; bb=b; cc=c; for (n=1;n<=1000;n++) { fac=Cmul(fac,Cdiv(Cmul(aa,bb),cc)); deriv->r+=fac.r; deriv->i+=fac.i; fac=Cmul(fac,RCmul(1.0/n,z)); *series=Cadd(temp,fac); if (series->r == temp.r && series->i == temp.i) return; temp= *series; aa=Cadd(aa,ONE); bb=Cadd(bb,ONE); cc=Cadd(cc,ONE); } nrerror("convergence failure in hypser"); } #include "complex.h" #define ONE Complex(1.0,0.0) extern fcomplex aa,bb,cc,z0,dz; Defined in hypgeo. void hypdrv(float s, float yy[], float dyyds[]) Computes derivatives for the hypergeometric equation, see text equation (5.14.4). { fcomplex z,y[3],dyds[3]; y[1]=Complex(yy[1],yy[2]); y[2]=Complex(yy[3],yy[4]); z=Cadd(z0,RCmul(s,dz)); dyds[1]=Cmul(y[2],dz); dyds[2]=Cmul(Csub(Cmul(Cmul(aa,bb),y[1]),Cmul(Csub(cc, Cmul(Cadd(Cadd(aa,bb),ONE),z)),y[2])), Cdiv(dz,Cmul(z,Csub(ONE,z)))); dyyds[1]=dyds[1].r; dyyds[2]=dyds[1].i; dyyds[3]=dyds[2].r; dyyds[4]=dyds[2].i; } CITED REFERENCES AND FURTHER READING: Abramowitz, M., and Stegun, I.A. 1964, Handbook of Mathematical Functions, Applied Mathe￾matics Series, Volume 55 (Washington: National Bureau of Standards; reprinted 1968 by Dover Publications, New York). [1]
<<向上翻页
©2008-现在 cucdc.com 高等教育资讯网 版权所有