正在加载图片...
782 Chapter 17.Two Point Boundary Value Problems v1[1]=n*(n+1)-m*(m+1)+c2/2.0: Initial guess for eigenvalue and function value v2[2]=v1[1]; v2[1]=gmma*(1.0-(v2[2]-c2)*dx/(2*(m+1))); x1=-1.0+dx; Set range of integration x2=1.0-dx: xf=0.0; Fitting point. newt (v,NTOT,&check,shootf); Find v that zeros function f in score. if (check){ printf("shootf failed;bad initial guess\n"); else printf("\tmu(m,n)\n"); pr1ntf("%12.6f\n",v[1]); http://www.nr. read able files free_vector(v,1,NTOT); return 0; void loadi(float x1,float vi,float y]) .com or call 1-800-872- (including this one) granted for 19881992 Supplies starting values for integration at =-1+dx float y1 (n-m&1 -gmmagmma); y[3]=v1[1]: y[2]=-(y[3]-c2)*y1/(2*(m+1)); y[1]=y1+y[2]*dx: 7423 (North America 电r:1s t tusers to make one paper from NUMERICAL RECIPES IN C: THE void load2(float x2,float v20],float y]) Supplies starting values for integration at x =1-dx only), by Cambridge University Press.Programs y[3]=v2[2]; y[1]=v2[1]; y[2]=(y[3]-c2)*y[1]/(2*(m+1)); void score(f1 oat xf,f1oaty▣,f1oatf0) Tests whether solutions match at fitting point =0. int i; for(i=1;i<=3;i+)f[i]y[1]; @cambri 1988-1992 by Numerical Recipes ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) CITED REFERENCES AND FURTHER READING: Flammer,C.1957,Spheroida/Wave Functions(Stanford.CA:Stanford University Press).[1] (outside 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 Software. Dover Publications,New York),$21.[2] Morse,P.M.,and Feshbach.H.1953.Methods of Theoretical Physics.Part ll (New York:McGraw- Ame Hil),Pp.1502ff.[3] visit website machine782 Chapter 17. Two Point Boundary Value Problems 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). v1[1]=n*(n+1)-m*(m+1)+c2/2.0; Initial guess for eigenvalue and function value. v2[2]=v1[1]; v2[1]=gmma*(1.0-(v2[2]-c2)*dx/(2*(m+1))); x1 = -1.0+dx; Set range of integration. x2=1.0-dx; xf=0.0; Fitting point. newt(v,NTOT,&check,shootf); Find v that zeros function f in score. if (check) { printf("shootf failed; bad initial guess\n"); } else { printf("\tmu(m,n)\n"); printf("%12.6f\n",v[1]); } } free_vector(v,1,NTOT); return 0; } void load1(float x1, float v1[], float y[]) Supplies starting values for integration at x = −1 + dx. { float y1 = (n-m&1? -gmma : gmma); y[3]=v1[1]; y[2] = -(y[3]-c2)*y1/(2*(m+1)); y[1]=y1+y[2]*dx; } void load2(float x2, float v2[], float y[]) Supplies starting values for integration at x = 1 − dx. { y[3]=v2[2]; y[1]=v2[1]; y[2]=(y[3]-c2)*y[1]/(2*(m+1)); } void score(float xf, float y[], float f[]) Tests whether solutions match at fitting point x = 0. { int i; for (i=1;i<=3;i++) f[i]=y[i]; } CITED REFERENCES AND FURTHER READING: Flammer, C. 1957, Spheroidal Wave Functions (Stanford, CA: Stanford University Press). [1] 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), §21. [2] Morse, P.M., and Feshbach, H. 1953, Methods of Theoretical Physics, Part II (New York: McGraw￾Hill), pp. 1502ff. [3]
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有