c5-7 (779491), страница 2
Текст из файла (страница 2)
If your functionis fairly smooth, and you know that you will want to evaluate its derivative manytimes at arbitrary points in some interval, then it makes sense to construct aChebyshev polynomial approximation to the function in that interval, and to evaluatethe derivative directly from the resulting Chebyshev coefficients. This method isdescribed in §§5.8–5.9, following.Another technique applies when the function consists of data that is tabulatedat equally spaced intervals, and perhaps also noisy.
One might then want, at eachpoint, to least-squares fit a polynomial of some degree M , using an additionalnumber nL of points to the left and some number nR of points to the right of eachdesired x value. The estimated derivative is then the derivative of the resultingfitted polynomial.
A very efficient way to do this construction is via Savitzky-Golaysmoothing filters, which will be discussed later, in §14.8. There we will give aroutine for getting filter coefficients that not only construct the fitting polynomial but,in the accumulation of a single sum of data points times filter coefficients, evaluateit as well. In fact, the routine given, savgol, has an argument ld that determineswhich derivative of the fitted polynomial is evaluated.
For the first derivative, theappropriate setting is ld=1, and the value of the derivative is the accumulated sumdivided by the sampling interval h.CITED REFERENCES AND FURTHER READING:Dennis, J.E., and Schnabel, R.B. 1983, Numerical Methods for Unconstrained Optimization andNonlinear Equations (Englewood Cliffs, NJ: Prentice-Hall), §§5.4–5.6. [1]Ridders, C.J.F. 1982, Advances in Engineering Software, vol. 4, no. 2, pp. 75–76. [2]Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.
Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).}if (fabs(a[i][i]-a[i-1][i-1]) >= SAFE*(*err)) break;If higher order is worse by a significant factor SAFE, then quit early.190Chapter 5.Evaluation of Functions5.8 Chebyshev ApproximationThe Chebyshev polynomial of degree n is denoted Tn (x), and is given bythe explicit formula(5.8.1)This may look trigonometric at first glance (and there is in fact a close relationbetween the Chebyshev polynomials and the discrete Fourier transform); however(5.8.1) can be combined with trigonometric identities to yield explicit expressionsfor Tn (x) (see Figure 5.8.1),T0 (x) = 1T1 (x) = xT2 (x) = 2x2 − 1T3 (x) = 4x3 − 3x(5.8.2)T4 (x) = 8x4 − 8x2 + 1···Tn+1 (x) = 2xTn (x) − Tn−1 (x)n ≥ 1.(There also exist inverse formulas for the powers of x in terms of the Tn ’s — seeequations 5.11.2-5.11.3.)The Chebyshev polynomials are orthogonal in the interval [−1, 1] over a weight(1 − x2 )−1/2 .
In particular,Z1−1Ti (x)Tj (x)√dx =1 − x2(0π/2πi 6= ji=j=6 0i=j=0(5.8.3)The polynomial Tn (x) has n zeros in the interval [−1, 1], and they are locatedat the pointsx = cosπ(k − 12 )nk = 1, 2, . . . , n(5.8.4)In this same interval there are n + 1 extrema (maxima and minima), located atx = cosπknk = 0, 1, . . . , n(5.8.5)At all of the maxima Tn (x) = 1, while at all of the minima Tn (x) = −1;it is precisely this property that makes the Chebyshev polynomials so useful inpolynomial approximation of functions.Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.
Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).Tn (x) = cos(n arccos x).















