Mathematical Tools for Physics - Department of Physics - University

(nextflipdebug2) #1
11—Numerical Analysis 273

This is more fully explained in section1.6, and it is the basis for the various methods of numerical
evaluations of integrals.


The simplest choices to evaluate the integral off(x)over the domainx 0 tox 0 +hwould be to


take the position ofξat one of the endpoints or maybe in the middle (herehis small).


∫x 0 +h

x 0

f(x)dx≈f(x 0 )h (a)


or f(x 0 +h)h (b)


or f(x 0 +h/2)h (midpoint rule) (c)


or

[

f(x 0 ) +f(x 0 +h)


]

h/ 2 (trapezoidal rule) (d)


(11.15)


The last expression is the average of the first two.


I can now compare the errors in all of these approximations. Setx 0 = 0.


∫h

0

dxf(x) =


∫h

0

dx


[

f(0) +xf′(0) +


1

2

x^2 f′′(0) +


1

6

x^3 f′′′(0) +···


]

=hf(0) +


1

2

h^2 f′(0) +


1

6

h^3 f′′(0) +


1

24

h^4 f′′′(0) +···


This immediately gives the error in formula (a):


error (a)=hf(0)−


∫h

0

dxf(x)≈−


1

2

h^2 f′(0). (11.16)


The error for expression (b) requires another expansion,


error (b)=hf(h)−


∫h

0

dxf(x)


=h


[

f(0) +hf′(0) +···


]


[

hf(0) +


1

2

h^2 f′(0) +···


]


1

2

h^2 f′(0) (11.17)


Since this is the opposite sign from the previous error, it is immediately clear that the error in (d) will
be less, because (d) is the average of (a) and (b).


error (d)=

[

f(0) +f(0) +hf′(0) +


1

2

h^2 f′′(0) +···


]h


2


[

hf(0) +


1

2

h^2 f′(0) +


1

6

h^3 f′′(0) +···


]


(

1

4


1

6

)

h^3 f′′(0) =


1

12

h^3 f′′(0) (11.18)


Similarly, the error in (c) is


error (c)=h


[

f(0) +


1

2

hf′(0) +


1

8

h^2 f′′(0) +···


]


[

hf(0) +


1

2

h^2 f′(0) +


1

6

h^2 f′′(0) +···


]

≈−

1

24

h^3 f′′(0) (11.19)

Free download pdf