正在加载图片...
4.1 Classical Formulas for Equally Spaced Abscissas 133 Notice that the integral from a =zo to b=x5 is estimated,using only the interior points 1,x2,z3,x4.In our opinion,formulas of this type are not useful for the reasons that(i)they cannot usefully be strung together to get"extended"rules,as we are about to do with the closed formulas,and(i)for all other possible uses they are dominated by the Gaussian integration formulas which we will introduce in $4.5. Instead of the Newton-Cotes open formulas,let us set out the formulas for estimating the integral in the single interval from o to z1,using values of the function f at 1,z2,....These will be useful building blocks for the "extended" open formulas. f=Al +O(h2f') (4.1.7) -n +(h3f") (4.1.8) f(z)dz=h +0(h4f3) (4.1.9) 令 f(x)dx=h 5 59 37 9 24- 42+ 243、 24 +Oh5f4)(4.1.10) America ART Perhaps a word here would be in order about how formulas like the above can 9 Progra be derived.There are elegant ways,but the most straightforward is to write down the basic form of the formula,replacing the numerical coefficients with unknowns,say p,q,r,s.Without loss of generality take zo =0 and=1,so h=1.Substitute in turn for f(x)(and for f1,f2,f3,fa)the functions f(x)=1,f(x)=,f(x)=x2, 6 and f()=z3.Doing the integral in each case reduces the left-hand side to a number,and the right-hand side to a linear equation for the unknowns p,q,r,s. Solving the four equations produced in this way gives the coefficients. OF SCIENTIFIC COMPUTING (ISBN 0-521- 1988-19920 Extended Formulas (Closed) If we use equation (4.1.3)N-1 times,to do the integration in the intervals Numerical Recipes -43198.5 (1,2),(x2,3),...,(N-1,N),and thenadd the results,we obtainan"extended" or "composite"formula for the integral from 1 to xN. (outside Extended trapezoidal rule: North Software. fer=hh+++ (4.1.11) .…+fN-1+2fN -a)3f" Here we have written the error estimate in terms of the interval b-a and the number of points N instead of in terms of h.This is clearer,since one is usually holding a and b fixed and wanting to know (e.g.)how much the error will be decreased4.1 Classical Formulas for Equally Spaced Abscissas 133 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). Notice that the integral from a = x0 to b = x5 is estimated, using only the interior points x1, x2, x3, x4. In our opinion, formulas of this type are not useful for the reasons that (i) they cannot usefully be strung together to get “extended” rules, as we are about to do with the closed formulas, and (ii) for all other possible uses they are dominated by the Gaussian integration formulas which we will introduce in §4.5. Instead of the Newton-Cotes open formulas, let us set out the formulas for estimating the integral in the single interval from x0 to x1, using values of the function f at x1, x2,... . These will be useful building blocks for the “extended” open formulas.  x1 x0 f(x)dx = h[f1] + O(h2f ) (4.1.7)  x1 x0 f(x)dx = h 3 2 f1 − 1 2 f2 + O(h3f) (4.1.8)  x1 x0 f(x)dx = h 23 12f1 − 16 12f2 + 5 12f3 + O(h4f(3)) (4.1.9)  x1 x0 f(x)dx = h 55 24f1 − 59 24f2 + 37 24f3 − 9 24f4 + O(h5f(4))(4.1.10) Perhaps a word here would be in order about how formulas like the above can be derived. There are elegant ways, but the most straightforward is to write down the basic form of the formula, replacing the numerical coefficients with unknowns, say p, q, r, s. Without loss of generality take x0 = 0 and x1 = 1, so h = 1. Substitute in turn for f(x) (and for f1, f2, f3, f4) the functions f(x)=1, f(x) = x, f(x) = x2, and f(x) = x3. Doing the integral in each case reduces the left-hand side to a number, and the right-hand side to a linear equation for the unknowns p, q, r, s. Solving the four equations produced in this way gives the coefficients. Extended Formulas (Closed) If we use equation (4.1.3) N − 1 times, to do the integration in the intervals (x1, x2),(x2, x3),...,(xN−1, xN ), and then add the results, we obtain an “extended” or “composite” formula for the integral from x1 to xN . Extended trapezoidal rule:  xN x1 f(x)dx = h 1 2 f1 + f2 + f3+ ··· + fN−1 + 1 2 fN + O (b − a)3f N2  (4.1.11) Here we have written the error estimate in terms of the interval b − a and the number of points N instead of in terms of h. This is clearer, since one is usually holding a and b fixed and wanting to know (e.g.) how much the error will be decreased
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有