17.11.2012 Views

Numerical recipes

Numerical recipes

Numerical recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.1 Classical Formulas for Equally Spaced Abscissas 135<br />

Extended Formulas (Open and Semi-open)<br />

We can construct open and semi-open extended formulas by adding the closed<br />

formulas (4.1.11)–(4.1.14), evaluated for the second and subsequent steps, to the<br />

extrapolative open formulas for the first step, (4.1.7)–(4.1.10). As discussed<br />

immediately above, it is consistent to use an end step that is of one order lower<br />

than the (repeated) interior step. The resulting formulas for an interval open at<br />

both ends are as follows:<br />

Equations (4.1.7) and (4.1.11) give<br />

�<br />

3<br />

f(x)dx = h<br />

x1<br />

2 f2 +f3 +f4 +···+fN−2 + 3<br />

2 fN−1<br />

�<br />

Equations (4.1.8) and (4.1.12) give<br />

� � xN<br />

23<br />

f(x)dx = h<br />

x1<br />

12 f2 + 7<br />

12 f3 + f4 + f5+<br />

···+ fN−3 + 7<br />

12 fN−2 + 23<br />

�<br />

1<br />

+ O<br />

N 3<br />

�<br />

� xN<br />

12 fN−1<br />

Equations (4.1.9) and (4.1.13) give<br />

� � xN<br />

27<br />

f(x)dx = h<br />

x1<br />

12 f2 +0+ 13<br />

12 f4 + 4<br />

3 f5+<br />

···+ 4<br />

3 fN−4 + 13<br />

12 fN−3 +0+ 27<br />

�<br />

1<br />

+ O<br />

N 4<br />

�<br />

�<br />

1<br />

+O<br />

N 2<br />

�<br />

�<br />

12 fN−1<br />

�<br />

(4.1.15)<br />

(4.1.16)<br />

(4.1.17)<br />

The interior points alternate 4/3 and 2/3. If we want to avoid this alternation,<br />

we can combine equations (4.1.9) and (4.1.14), giving<br />

� � xN<br />

55<br />

f(x)dx = h<br />

x1<br />

24 f2 − 1<br />

6 f3 + 11<br />

8 f4 + f5 + f6 + f7+<br />

···+ fN−5 + fN−4 + 11<br />

8 fN−3 − 1<br />

6 fN−2 + 55<br />

24 fN−1<br />

�<br />

�<br />

1<br />

+ O<br />

N 4<br />

�<br />

(4.1.18)<br />

We should mention in passing another extended open formula, for use where<br />

the limits of integration are located halfway between tabulated abscissas. This one is<br />

known as the extended midpoint rule, and is accurate to the same order as (4.1.15):<br />

� xN<br />

x1<br />

f(x)dx = h[f 3/2 + f 5/2 + f 7/2+<br />

�<br />

1<br />

···+ fN−3/2 + fN−1/2] +O<br />

N 2<br />

� (4.1.19)<br />

Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)<br />

Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by <strong>Numerical</strong> Recipes Software.<br />

Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable<br />

files (including this one) to any server computer, is strictly prohibited. To order <strong>Numerical</strong> Recipes books or CDROMs, visit website<br />

http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!