c3-4 (779474), страница 2
Текст из файла (страница 2)
....· · · xNcNNy0 y1= . ..yN(3.5.2)This is a Vandermonde matrix, as described in §2.8. One could in principle solveequation (3.5.2) by standard techniques for linear equations generally (§2.3); howeverthe special method that was derived in §2.8 is more efficient by a large factor, oforder N , so it is much better.Remember that Vandermonde systems can be quite ill-conditioned. In such acase, no numerical method is going to give a very accurate answer. Such cases donot, please note, imply any difficulty in finding interpolated values by the methodsof §3.1, but only difficulty in finding coefficients.Like the routine in §2.8, the following is due to G.B.
Rybicki. Note that thearrays are all assumed to be zero-offset.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).Occasionally you may wish to know not the value of the interpolating polynomialthat passes through a (small!) number of points, but the coefficients of that polynomial. A valid use of the coefficients might be, for example, to computesimultaneous interpolated values of the function and of several of its derivatives (see§5.3), or to convolve a segment of the tabulated function with some other function,where the moments of that other function (i.e., its convolution with powers of x)are known analytically.However, please be certain that the coefficients are what you need.
Generally thecoefficients of the interpolating polynomial can be determined much less accuratelythan its value at a desired abscissa. Therefore it is not a good idea to determine thecoefficients only for use in calculating interpolating values. Values thus calculatedwill not pass exactly through the tabulated points, for example, while valuescomputed by the routines in §3.1–§3.3 will pass exactly through such points.Also, you should not mistake the interpolating polynomial (and its coefficients)for its cousin, the best fit polynomial through a data set.
Fitting is a smoothingprocess, since the number of fitted coefficients is typically much less than thenumber of data points. Therefore, fitted coefficients can be accurately and stablydetermined even in the presence of statistical errors in the tabulated values. (See§14.8.) Interpolation, where the number of coefficients and number of tabulatedpoints are equal, takes the tabulated values as perfect.
If they in fact contain statisticalerrors, these can be magnified into oscillations of the interpolating polynomial inbetween the tabulated points.As before, we take the tabulated points to be yi ≡ y(xi ). If the interpolatingpolynomial is written as.