正在加载图片...
270 Chapter 6. Special Functions #include <math.h> #define CA 0.0003 The accuracy is the square of CA void sncndn(float uu,float emmc,float *sn,float *cn,float *dn) Returns the Jacobian elliptic functions sn(u,ke),cn(u,ke),and dn(u,ke).Here uu =u,while emmc =2 float a,b,c,d,emc,ui float em[14],en[14]; int i,ii,l,bo; emc=emmc; Permission is Sample page usuu; if (emc){ bo=(emc<0.0); if (bo){ d=1.0-emc; emc /=-1.0/d; u*=(d=sqrt(d)); a=1.0; *dn=1.0; for(i=1:1<=13:1++)[ 1=1; http://www.nr.com or call 1-800-872-7423 (North America em[i]=a; en[i]=(emc=sqrt(emc)); c=0.5*(a+emc); if (fabs(a-emc) <CA*a)break; emc *a; granted for internet users to make one paper copy for their a=c: u=C; *sn=sin(u): 米cn=cos(u); if (*sn){ a=(*cn)/(*sn); c米=a; for(11=1;11>=1;ii--)[ b=em[ii]; Copyright (C)1988-1992 by Cambridge University Press.Programs Copyright(C)1988-1992 by Numerical Recipes from NUMERICAL RECIPES IN C:THE ART OF SCIENTIFIC COMPUTING(ISBN 0-521-43108-5) c*=(*dn); *dn=(en[ii]+a)/(b+a): a=c/b; a=1.0/sqrt(c*c+1.0); *sn=(*sn>=0.0?a:-a) *cn=c*(*sn); if (bo){ a=(*dn); only),orsend email to directcustserv@cambridge.org(outside North America). *dn=(*cn); Software. *cn=a; *sn /d; else ying of machine *cn=1.0/cosh(u); *dn=(*cn); 来gn=tanh (u)270 Chapter 6. Special Functions 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 <math.h> #define CA 0.0003 The accuracy is the square of CA. void sncndn(float uu, float emmc, float *sn, float *cn, float *dn) Returns the Jacobian elliptic functions sn(u, kc), cn(u, kc), and dn(u, kc). Here uu = u, while emmc = k2 c . { float a,b,c,d,emc,u; float em[14],en[14]; int i,ii,l,bo; emc=emmc; u=uu; if (emc) { bo=(emc < 0.0); if (bo) { d=1.0-emc; emc /= -1.0/d; u *= (d=sqrt(d)); } a=1.0; *dn=1.0; for (i=1;i<=13;i++) { l=i; em[i]=a; en[i]=(emc=sqrt(emc)); c=0.5*(a+emc); if (fabs(a-emc) <= CA*a) break; emc *= a; a=c; } u *= c; *sn=sin(u); *cn=cos(u); if (*sn) { a=(*cn)/(*sn); c *= a; for (ii=l;ii>=1;ii--) { b=em[ii]; a *= c; c *= (*dn); *dn=(en[ii]+a)/(b+a); a=c/b; } a=1.0/sqrt(c*c+1.0); *sn=(*sn >= 0.0 ? a : -a); *cn=c*(*sn); } if (bo) { a=(*dn); *dn=(*cn); *cn=a; *sn /= d; } } else { *cn=1.0/cosh(u); *dn=(*cn); *sn=tanh(u); } }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有