正在加载图片...
5.11 Economization of Power Series 199 4.Convert back to a polynomial in y. 5.Change variables back to z. All of these steps can be done numerically,given the coefficients of the original power series expansion.The first step is exactly the inverse of the routine pcshft(85.10),which mapped a polynomial from y(in the interval [-1,1])to z(in the interval [a,b]).But since equation (5.8.10)is a linear relation between r and y,one can also use pcshft for the inverse.The inverse of pcshft(a,b,d,n) turns out to be (you can check this) pcshft -2-b-a2-b-a ’b-a ,d,n b-a 鱼 granted for 18881892 The second step requires the inverse operation to that done by the routine chebpc (which 1800 took Chebyshev coefficients into polynomial coefficients).The following routine,pccheb, accomplishes this,using the formula[1] from NUMERICAL RECIPESI (5.11.2) where the last term depends on whether k is even or odd America Press. k (k-1)/2 Ti(=)(k odd), + To()(k even) (5.113) IENTIFIC void pccheb(f1oatd☐,float c☐,intn) Inverse of routine chebpc:given an array of polynomial coefficients d[o..n-1],returns an equivalent array of Chebyshev coefficients c[O..n-1]. int j,jm,jp,k; float fac,pow; 1920 COMPUTING(ISBN Will be powers of 2. v@cam pow=1.0; c[0]=2.0*d[0]; 021 for (k=1;k<n;k++) Loop over orders of x in the polynomial c[k]=0.0; Zero corresponding order of Chebyshev. Numerical Recipes 43108 fac=d[k]/pow; jm=k; jp=1; (outside for(jk;j>=0;j-=2,jm--,jp++){ 膜 Increment this and lower orders of Chebyshev with the combinatorial coefficent times Software. d[k];see text for formula. c[i]+fac; fac *=((float)jm)/((float)jp); pow +pow; 2 The fourth and fifth steps are accomplished by the routines chebpc and pcshft, respectively.Here is how the procedure looks all together:5.11 Economization of Power Series 199 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). 4. Convert back to a polynomial in y. 5. Change variables back to x. All of these steps can be done numerically, given the coefficients of the original power series expansion. The first step is exactly the inverse of the routine pcshft (§5.10), which mapped a polynomial from y (in the interval [−1, 1]) to x (in the interval [a, b]). But since equation (5.8.10) is a linear relation between x and y, one can also use pcshft for the inverse. The inverse of pcshft(a,b,d,n) turns out to be (you can check this) pcshft −2 − b − a b − a ,2 − b − a b − a ,d,n The second step requires the inverse operation to that done by the routine chebpc (which took Chebyshev coefficients into polynomial coefficients). The following routine, pccheb, accomplishes this, using the formula [1] xk = 1 2k−1  Tk(x) + k 1 Tk−2(x) + k 2 Tk−4(x) + ··· (5.11.2) where the last term depends on whether k is even or odd, ··· + k (k − 1)/2 T1(x) (k odd), ··· + 1 2 k k/2 T0(x) (k even). (5.11.3) void pccheb(float d[], float c[], int n) Inverse of routine chebpc: given an array of polynomial coefficients d[0..n-1], returns an equivalent array of Chebyshev coefficients c[0..n-1]. { int j,jm,jp,k; float fac,pow; pow=1.0; Will be powers of 2. c[0]=2.0*d[0]; for (k=1;k<n;k++) { Loopover orders of x in the polynomial. c[k]=0.0; Zero corresponding order of Chebyshev. fac=d[k]/pow; jm=k; jp=1; for (j=k;j>=0;j-=2,jm--,jp++) { Increment this and lower orders of Chebyshev with the combinatorial coefficent times d[k]; see text for formula. c[j] += fac; fac *= ((float)jm)/((float)jp); } pow += pow; } } The fourth and fifth steps are accomplished by the routines chebpc and pcshft, respectively. Here is how the procedure looks all together:
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有