Chapter 5.Evaluation of Functions 5.0 Introduction NUMERICAL The purpose of this chapter is to acquaint you with a selection of the techniques that are frequently used in evaluating functions.In Chapter 6,we will apply and Cambridge illustrate these techniques by giving routines for a variety of specific functions. The purposes of this chapter and the next are thus mostly in harmony,but there is nevertheless some tension between them:Routines that are clearest and most illustrative of the general techniques of this chapter are not always the methods of 、鱼 compu Press. C:THEA choice for a particular special function.By comparing this chapter to the next one, you should get some idea of the balance between"general"and"special"methods that occurs in practice. Insofar as that balance favors general methods,this chapter should give you ideas about how to write your own routine for the evaluation of a function which, while "special"to you,is not so special as to be included in Chapter 6 or the SCIENTIFIC standard program libraries 6 CITED REFERENCES AND FURTHER READING: Fike,C.T.1968,Computer Evaluation of Mathematical Functions(Englewood Cliffs,NJ:Prentice- Hall). r Numerical Lanczos,C.1956,Applied Analysis;reprinted 1988(New York:Dover),Chapter 7. Further Numerical (ISBN 0-521- Recipes 491069 5.1 Series and Their Convergence North Software. Everybody knows that an analytic function can be expanded in the neighborhood of a point zo in a power series, America). f)=ak(-xo) (5.1.1) k=0 Such series are straightforward to evaluate.You don't,of course,evaluate the kth power ofxr-zo ab initio for each term;rather you keep the k-1st power and update it with a multiply.Similarly,the form of the coefficients a is often such as to make use of previous work:Terms like k!or(2k)!can be updated in a multiply or two. 165
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 machinereadable 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). Chapter 5. Evaluation of Functions 5.0 Introduction The purpose of this chapter is to acquaint you with a selection of the techniques that are frequently used in evaluating functions. In Chapter 6, we will apply and illustrate these techniques by giving routines for a variety of specific functions. The purposes of this chapter and the next are thus mostly in harmony, but there is nevertheless some tension between them: Routines that are clearest and most illustrative of the general techniques of this chapter are not always the methods of choice for a particular special function. By comparing this chapter to the next one, you should get some idea of the balance between “general” and “special” methods that occurs in practice. Insofar as that balance favors general methods, this chapter should give you ideas about how to write your own routine for the evaluation of a function which, while “special” to you, is not so special as to be included in Chapter 6 or the standard program libraries. CITED REFERENCES AND FURTHER READING: Fike, C.T. 1968, Computer Evaluation of Mathematical Functions (Englewood Cliffs, NJ: PrenticeHall). Lanczos, C. 1956, Applied Analysis; reprinted 1988 (New York: Dover), Chapter 7. 5.1 Series and Their Convergence Everybody knows that an analytic function can be expanded in the neighborhood of a point x0 in a power series, f(x) = ∞ k=0 ak(x − x0) k (5.1.1) Such series are straightforward to evaluate. You don’t, of course, evaluate the kth power of x−x0 ab initio for each term; rather you keep the k −1st power and update it with a multiply. Similarly, the form of the coefficients a is often such as to make use of previous work: Terms like k! or (2k)! can be updated in a multiply or two. 165