The Chemistry Maths Book, Second Edition

(Grace) #1

562 Chapter 20Numerical methods


20.3 Solution of ordinary equations


An ordinary equation (an equation not involving derivatives or integrals) in one


variable can be written in the form


f(x) 1 = 10 (20.4)


wheref(x)is a function of x. The solutions of the equation are those values of xfor


which (20.4) is true; they are the zerosof the functionf(x). For example, a quadratic


equation is a special case of the algebraic (polynomial) equation


f(x) 1 = 1 a


0

1 + 1 a


1

x 1 + 1 a


2

x


2

1 +1-1+ 1 a


n

x


n

1 = 10 (20.5)


and the solutions are the roots of the polynomial. The general formula for the roots of


the quadratic function was discussed in Chapter 2 and Example 20.3 but, although


exact formulas exist for the roots of cubics and quartics, the general algebraic


equation must be solved numerically. Similarly, the solutions of a transcendental


equation (one that involves transcendental functions) such as


e


−x

1 = 1 tan 1 x or f(x) 1 = 1 e


−x

1 − 1 tan 1 x 1 = 10 (20.6)


cannot normally be written in terms of a finite number of known functions, and the


equation must be solved numerically.


All numerical methods of solving equations proceed by iteration whereby, given


an initial approximate solution,x


0

say, an algorithm exists that usesx


0

to give a new,


hopefully more accurate solutionx


1

. The same algorithm is then applied tox


1

to give


x


2

, and so on:


(20.7)


The iterative process is terminated when a given accuracy has been achieved; for


example, when the change|x


n+ 1

1 − 1 x


n

|is less than a predetermined value. The success


of a numerical procedure often depends on a good choice of initial approximation,


and this can usually be obtained from a graph of the function or from a tabulation of


values of the function.


We consider here two simple methods that are widely used, and that also form


the basis for more sophisticated methods. We note that methods for equations in


one variable can be generalized for several variables and, sometimes, for systems of


simultaneous equations.


The bisection method


The starting point for this ancient method are two values of xfor which the function


is known to lie on opposite sides of zero. As in Figure 20.1, letf(x


1

) 1 < 10 andf(x


2

) 1 > 10 ,


and let the function be continuous in the intervalx


1

tox


2

. We evaluate the function


at the midpoint of the interval,


(20.8)
xxx

312

1


2


=+()


xxn


nn

numerical


algorithm


→


+

,=,,,


1

0123 ...

Free download pdf