正在加载图片...
200 Chapter 5.Evaluation of Functions #define NFEW.. #define NMANY . float *c,*d,te,a,bi Economize NMANY power series coefficients e[0..NMANY-1]in the range (a,b)into NFEW coefficients d[o..NFEW-1]. c=vector(0,NMANY-1); d=vector(0,NFEW-1); e=vector(0,NMANY-1); pcshft((-2.0-b-a)/(b-a),(2.0-b-a)/(b-a),e,MANY); pccheb(e,c,NMANY); Here one would normally examine the Chebyshev coefficients c[0..NMANY-1]to decide how small NFEW can be. chebpc(c.d.NFEW): 鱼 18881892 pcshft(a,b,d,NFEW); 士/ 100 In our example,by the way,the 8th through 10th Chebyshev coefficients turn out to be on the order of-7 x 107 3 x 107',and-9 x 107,so reasonable truncations (for single precision calculations)are somewhere in this range,yielding a polynomial with 8- from NUMERICAL RECIPES I 10 terms instead of the original 13. Replacing a 13-term polynomial with a (say)10-term polynomial without any loss of (Nort server accuracy-that does seem to be getting something for nothing.Is there some magic in this technique?Not really.The 13-term polynomial defined a function f(x).Equivalent to computer, America e University Press. 令 THE economizing the series,we could instead have evaluated f()at enough points to construct its Chebyshev approximation in the interval of interest,by the methods of $5.8.We would ART have obtained just the same lower-order polynomial.The principal lesson is that the rate of convergence of Chebyshev coefficients has nothing to do with the rate of convergence of 9 Programs power series coefficients;and it is the former that dictates the number of terms needed in a polynomial approximation.A function might have a divergent power series in some region of interest,but if the function itself is well-behaved,it will have perfectly good polynomial approximations.These can be found by the methods of $5.8,but not by economization of 、三马h馆 series.There is slightly less to economization of series than meets the eye. to dir OF SCIENTIFIC COMPUTING(ISBN CITED REFERENCES AND FURTHER READING: 1988-1992 Acton,F.S.1970,Numerica/Methods That Work;1990,corrected edition (Washington:Mathe- matical Association of America),Chapter 12. Arfken,G.1970,Mathematical Methods for Physicists,2nd ed.(New York:Academic Press), p.631.[1) Numerical Recipes 10-621 43108 (outside 5.12 Pade Approximants Software. A Pade approximant,so called,is that rational function (of a specified order)whose power series expansion agrees with a given power series to the highest possible order.If the rational function is M R(x)三 k=0 N (5.12.1)200 Chapter 5. Evaluation of 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). #define NFEW .. #define NMANY .. float *c,*d,*e,a,b; Economize NMANY power series coefficients e[0..NMANY-1] in the range (a, b) into NFEW coefficients d[0..NFEW-1]. c=vector(0,NMANY-1); d=vector(0,NFEW-1); e=vector(0,NMANY-1); pcshft((-2.0-b-a)/(b-a),(2.0-b-a)/(b-a),e,NMANY); pccheb(e,c,NMANY); ... Here one would normally examine the Chebyshev coefficients c[0..NMANY-1] to decide how small NFEW can be. chebpc(c,d,NFEW); pcshft(a,b,d,NFEW); In our example, by the way, the 8th through 10th Chebyshev coefficients turn out to be on the order of −7 × 10−6, 3 × 10−7, and −9 × 10−9, so reasonable truncations (for single precision calculations) are somewhere in this range, yielding a polynomial with 8 – 10 terms instead of the original 13. Replacing a 13-term polynomial with a (say) 10-term polynomial without any loss of accuracy — that does seem to be getting something for nothing. Is there some magic in this technique? Not really. The 13-term polynomial defined a function f(x). Equivalent to economizing the series, we could instead have evaluated f(x) at enough points to construct its Chebyshev approximation in the interval of interest, by the methods of §5.8. We would have obtained just the same lower-order polynomial. The principal lesson is that the rate of convergence of Chebyshev coefficients has nothing to do with the rate of convergence of power series coefficients; and it is the former that dictates the number of terms needed in a polynomial approximation. A function might have a divergent power series in some region of interest, but if the function itself is well-behaved, it will have perfectly good polynomial approximations. These can be found by the methods of §5.8, but not by economization of series. There is slightly less to economization of series than meets the eye. CITED REFERENCES AND FURTHER READING: Acton, F.S. 1970, Numerical Methods That Work; 1990, corrected edition (Washington: Mathe￾matical Association of America), Chapter 12. Arfken, G. 1970, Mathematical Methods for Physicists, 2nd ed. (New York: Academic Press), p. 631. [1] 5.12 Pade Approximants ´ A Pade approximant ´ , so called, is that rational function (of a specified order) whose power series expansion agrees with a given power series to the highest possible order. If the rational function is R(x) ≡ M k=0 akxk 1 + N k=1 bkxk (5.12.1)
<<向上翻页
©2008-现在 cucdc.com 高等教育资讯网 版权所有