The Chemistry Maths Book, Second Edition

(Grace) #1

20.5 Numerical integration 573


Figure 20.8. This demonstrates that curve fitting with splines produces a continuous


curve that closely follows the straight lines of piecewise linear interpolation. This


does notguarantee however that the computed curve is a true representation of the


function of which the nodes are a sample. Thus in the present case, the points in


Table 20.4 have been computed from the functionf(x) 1 = 111 − 1 (x 1 − 1 1)


2

(x 1 − 1 3) 1 sin 1 πx.


This has many local maxima and minima. The ‘unrealistic’ 8th degree polynomial fit


shown in Figure 20.7 is in fact, quite fortuitously, a fairly good representation of the


function, whereas the spline fit is only as good as the poor sample of points allows.*


20.5 Numerical integration


Numerical integration (quadrature) is the numerical evaluation of the integral


(20.31)


when the integrandf(x)is either given by a table of numbers or when the integral


cannot be evaluated by the methods described in Chapters 5 and 6 in terms of a finite


number of standard functions. Geometrically, the problem is to estimate the area


under the curve. The standard method is to replace the functionf(x)by a different


function that can be integrated, and one way is to use the interpolation formulas


discussed in the previous section. This gives the class of numerical integration methods


called Newton–Cotes quadratures, of which the trapezoidal rule and Simpson’s rule


are the simplest examples.


5

The trapezoidal rule. Linear interpolation


The simplest estimate of an integral (20.31), as an area, is obtained by dividing


the intervala 1 ≤ 1 x 1 ≤ 1 binto nequal subintervals each of widthh 1 = 1 (b 1 − 1 a) 2 n, and


approximating the integrand by piecewise linear interpolation; that is, by joining the


corresponding adjacent points on the graph by straight lines as shown in Figure 20.9.


Ifxdx


a

b

=Z ()


*Garbage in, Garbage out(Wilf Hey, d. 2007, computer programmer and writer).


5

The Newton–Cotes formulas first appeared in Newton’s letter to Leibniz of 24 October 1676 and in the


Principia, although particular examples were known long before. They were included in the collection of work


by Cotes, the Harmonia mensurarum, published posthumously in 1722. Roger Cotes (1682–1716), Cambridge


mathematician, spent much of 1709–1713 preparing the second edition of the Principia. His work includes one of


the earliest discussions of the calculus of logarithmic and trigonometric functions, with tables of integrals.






















.

..

..
...
..
...
...
..
...
...
..

.
...
..
...
...
..
...
...
..

.....
.......
........
.....

......

.........

.......

f


0

f


1

f


2

f


n− 1

f


n

···


x


0

=ax


1

x


2

x


n− 1

x


n

=b


y


x


y=f(x)


.

...

...

..

...

...

...

..

....

..

...

...

...

...

...

...

...

...

..

....

...

...

...

...

...

...

...

...

....

...

...

....

...

....

....

...

....

....

....

....

.....

....

.....

.......

......

........

.............

..........................
................
..........
........
........
.......
......
.......
......
......
.......
.....
.......
......
......
.....
.......
.......
......
........
.......
.........
...........
..................
...............

...............

..........

......

......

......

....

.....

.....

...

....

....

....

...

....

....

...

....

...

...

...

...

...

....

...

...

...

...

...

...

...

...

...

...

...

...

..

...

...

...

...

...

..

..

.

....

....

.....

.....

....

.....

....

....

.....

.....

.....

....

....

.....

....

.....

.....

....

....

.....

.....

....

.....

....

.....

....

.....

....

.....

....

.....

...........................

..................................

...................................

...

.....

.....

......

.....

......

.....

......

.....

.....

......

.....

.....

......

......

.....

......

.....

.....

......

.....

.....

......

...

Figure 20.9

Free download pdf