# Chapter 1

Solutions of Algebraic and
Transcendental Equations

1.1 Introduction
In engineering and sciences, a frequently occurring problem is that of determining
the solutions of equations of the form

f (x) = 0 (1.1)

where f (x) can be a linear, quadratic, cubic or quartic expression, in which case
algebraic methods of solution are available. However, when f (x) is a polynomial
of higher degrees, or a transcendental function, algebraic methods of solution are
not available, hence we have to look for approximate methods of solution. In this
section, we shall consider approximation methods such as the bisection method,
fixed-point iterative method, method of false position and the Newton-Raphson
method.

1

1.2 The Bisection Method
Recall from MTH103 the intermediate value theorem thus:

Theorem 1 If f (x) is a continuous function on [a, b], and if f (a) and f (b) are of
opposite signs, then there exists ξ ∈ (a, b) such that f (ξ)=0.

In particular, suppose that f (a) < 0 and f (b) > 0, then there is a root lying
between a and b. The approximate value of this root is given by

a+b
x0 = .
2

If f (x0 ) = 0, we conclude that x0 is the root of the equation (1.1). Otherwise, the
root lies between a and x0 or between x0 and b according as f (x0 ) is negative or
positive. Continuing, we bisect the interval and repeat the process until a root is
known to the desired accuracy. This process is shown in the diagram below:

Example 1
Find a real root of the equation x3 − x − 1 = 0.
Solution
Note that f (1) < 0 and f (2) > 0, thus a root lies between 1 and 2 and we thus
take
1+2 3
x0 = = .
2 2
Hence  
3 27 3 7
f (x0 ) = f = − − 1 = > 0.
2 8 2 8
Thus the root lies between 1 and 32 . We then obtain x1 = 1+1.5
2
= 1.25, and
f (x1 ) = − 19
64
< 0. We therefore conclude that the root lies between 1.25 and 1.5.
Continuing, one obtains

1.25 + 1.5
x2 = = 1.375.
2

2

The procedure is repeated and we obtain the successive approximations

x3 = 1.3125, x4 = 1.34375, x5 = 1.328125, . . .

Stop the iteration as soon as the required accuracy is attained.

1.3 Fixed Point Iteration Method
We transform the equation (1.1) algebraically into the form

x = φ(x) (1.2)

The solution of (1.2) is called a fixed point of φ, hence the name of the method.
From (1.1), we may get several forms of (1.2). For example, the equation

x3 + x2 − 1 = 0

can be expressed as

(i) x = √1
1+x

(ii) x = 1 − x2

3
(iii) x = 1 − x2 and so on.

Suppose x0 is an approximate value of the desired root ξ. Substituting it for x in
(1.3), we obtain the first and and successive approximations as

x1 = φ(x0 )

x2 = φ(x1 )

x3 = φ(x2 )

3

..
.

xn = φ(xn−1 )

and in general,
xn+1 = φ(xn ).

However, the sequence of successive approximations x0 , x1 , x2 , · · · , xn do not
always converge to some value ξ. For example, take the equation

x = 10x + 1.

If we take x0 = 0, x1 = 2, x2 = 102 +1 = 101, x3 = 10101 +1, · · · . This sequence
obviously diverges as n increases. When does the iteration converge?

Theorem 2 (Convergence of Fixed Point Iteration Method)
Let x = s be a solution of x = g(x) and suppose that g has a continuous derivative
in some interval I containing s. Then if |g ′(x)| ≤ K ≤ 1 in I, the iteration process
defined by x = g(x) converges for any s in I.

Example 2
Use the fixed point iteration method to find the solution of the equation
x3 + x − 1 = 0.
Solution:
1
The equation may be written in the form x = 1+x2
, while the iteration can be
expressed as
1
xn+1 = .
1 + x2n
A rough sketch indicates that there is a solution near x = 1, and taking x0 = 1,
we obtain the iterations

x1 = 0.5, x2 = 0.800, x3 = 0.610, x4 = 0.729, x5 = 0.653, x6 = 0.701, · · ·

4

The Newton-Raphson method is used to improve the results obtained by previous methods. f (x0 ) x1 = x0 + h ⇒ x1 = x0 − f ′ (x0 ) f (x1 ) x2 = x1 − f ′ (x1 ) f (x2 ) x3 = x2 − f ′ (x2 ) .The solution to 6 places of decimals is 0. Neglecting the second and higher order derivatives.3) f ′ (xn ) If f ′ (xn ) = 0. Exercise Use the fixed point iteration method to determine the solution of the equation x2 − x = 0. Suppose x = x0 + h is the correct root of (1. then expanding f (x0 + h) in Taylor series leads to f (x0 + h) = f (x0 ) + hf ′ (x0 ) + · · · = 0.682328. then use a different starting value. 1. . We then have the iteration scheme f (xn ) xn+1 = xn − (1.1). 5 . on obtains f (x0 ) h=− ..4 Newton-Raphson Method This is another iteration method for solving equation (1. f ′ (x0 ) Therefore.1). where f is assumed to have a continuous first derivative f ′ . Compare your solution with the exact solution.

Example 4 Find the root of the equation x sin x + cos x = 0 using the Newton-Raphson method. f (xn ) x3 + xn − 1 ∴ xn+1 = xn − ′ = xn − n 2 .68604651.7986 x3 = 2. 3x21 + 1 and iterate to convergence to the required degree of accuracy. Example 3 Determine the solution of the equation x3 + x − 1 = 0 using the Newton-Raphson method.7984 x4 = 2.7984. f ′ (x) = x cos x. f (xn ) 3xn + 1 taking x0 = 1. Solution: f (x) = x3 + x − 1.823 x2 = 2.75. f ′(x) = 3x2 + 1. Solution: f (x) = x sin x + cos x. Note the convergence of the solution above to 4 places of decimals. xn cos xn Take x0 = π and then obtain x1 = 2. 3x20 + 1 x31 + x1 − 1 x2 = x1 − = 0. The iteration formula then becomes xn sin xn + cos xn xn+1 = xn − . 6 . one obtains x30 + x0 − 1 x1 = x0 − = 0.

1. f (xn ) ′ f (xn ) Using Newton-Raphson iteration formula. |f ′ (x)| ≥ ǫ.1).4. for some ǫ > 0 in a suitable neighbourhood of ξ. Assignment Obtain a root of each of the equations 1. we note that f (ξ) = 0 so that Taylor’s expansion gives 1 f (xn ) + (ξ − xn )f ′ (xn ) + (ξ − xn )2 f ′′ (xn ) + · · · = 0 2 from which we get 1 2 (ξ − xn )2 f ′′ (xn ) f (xn ) (ξ − xn ) + =− ′ . Newton-Raphson method still converges. Hence by theorem 1. f ′ (x) and f ′′ (x) are continuous and bounded on any interval containing the root x = ξ of equation (1. Within this neighbourhood. We assume f (x). but slowly when ξ is a multiple root.4) f ′ (ξ) Hence Newton-Raphson method has a second order or quadratic convergence. and since f ′ (x) is continu- ous. provided the initial approximation is sufficiently close to ξ. If ξ is a simple root. then f ′ (ξ) 6= 0.1 Convergence of Newton-Raphson Method f (x) f (x)f ′′ (x) Consider φ(x) = x − f ′ (x) . 2x = 3 + cos x 7 . we obtain 1 2 (ξ − xn )2 f ′′ (xn ) xn+1 − ξ = f ′ (xn ) and setting ǫn = xn − ξ. we can select an interval such that |f (x)f ′′(x)| < ǫ2 and this is possible since f (ξ) = 0 and since f (x) is continuously twice differentiable. in this interval we have |φ′ (x)| < 1. we have 1 2 ′′ ǫ f (ξ) 2 n ǫn+1 = (1. thus φ′ (x) = (f ′ (x))2 . Newton-Raphson method converges. To determine the rate of convergence of the method. Thus.

ex − tan−1 x − 2 =0 3. although the result could be valid for non-integral values for some cases. x 6= α.5 Numerical Evaluation of Multiple Roots of Algebraic Equations We say that the function f (x) has a root α of multiplicity p > 1 if f (x) = (x − α)p h(x) (1.5) with h(α) 6= 0 and h(x) continuous at x = α. Compare the three results in tabular form.5). 1. 1. Thus f (x) xn+1 = g(xn ). We restrict p to be a positive integer.5) is obtained as f ′ (x) = (x − α)p h′ (x) + p(x − α)p−1h(x) 8 . We now investigate this for Newton-Raphson method as a fixed point method with f (x) satisfying (1. x2 + cos x − xe−x = 0 correct to 3 places of decimals using (a) the bisection method (b) fixed point iteration method (c) Newton-Raphson method. 3 2. f ′ (x) The expression for g(x) on using (1. g(x) = x − .1 Newton-Raphson Method and Multiple Roots Most of the rootfinding methods considered so far perform poorly when the root being sought is multiple.5.

4x3 + 10.12x − 8. Therefore the root has multiplicity 3.954x + 2. You can then find p for any given α.4x3 + 10.954x + 2.069406530.6698244 which yields p = 3.56x2 − 8. x3 = 1. · · · Thus f (x) g(x) = x − .7951. Solution: f (x) = x4 − 5.6 Solutions of Systems of Nonlinear Equations We consider in this section the numerical solution of simultaneous equations by two methods: 9 . x4 = 1. p−1 thus we solve the equation p = 0. Example 5 Determine the multiplicity of the root of the equation x4 − 5.02869144. (x − α)p h(x) (x − α)h(x) ∴ g(x) = x − = x − .6698244. (x − α)p−1 [(x − α)h′ (x)] ph(x) + (x − α)h′ (x) One then obtains   ′ h(x) d h(x) g (x) = 1 − − (x − α) ph(x) + (x − α)h′ (x) dx ph(x) + (x − α)h′ (x) and g ′(α) = 1 − p1 6= 0 for p > 1.2x2 + 21. f ′ (x) = 4x3 − 16. we obtain g ′ (1. x5 = 1.086) = 0. f ′ (x) Now taking x ≈ 1.086286231. This shows p−1 that Newton-Raphson Method is a linear method with rate of convergence p .7951 = 0 lying in the interval 1 ≤ x ≤ 2. 1. x2 = 1.56x2 − 8.032352941.086 as the approximate root.054435334.079501623. Hence p ≈ 3.954 ∴ x1 = 1.

(a) Fixed Point Iteration method and (b) Newton-Raphson Method We shall consider the case of two equations in two unknowns only. y) where F and G satisfy the conditions of convergence .7) y = G(x. y) (1.1 Fixed Point Iteration Method Consider the nonlinear system of equations f (x. y) = 0 Re-write the system in the form x = F (x.6) g(x. 1. y) = 0 (1.6.

.

.

.

.

∂F .

.

∂G .

.

∂x .

.

∂x .

< 1 .

.

+.

.

and .

.

.

.

.

∂F .

.

∂G .

.

∂y .

+ .

∂y .

< 1 .

.

.

.

y1 = G(x1 . y2 ). y0 ) is the initial approximation to the root. y3 = G(x3 . y0 ). y1 ). in the neighbourhood of the root. Then the sequence of successive approximations becomes x1 = F (x0 . y2 ). y1 ). y1 = G(x2 . 10 . x3 = F (x2 . x2 = F (x1 . Suppose (x0 . y0 ).

and if (x0 + h. .9249155367.2 Newton-Raphson Method Suppose the initial approximation to the root of the system is (x0 . Iterate to convergence. 11 . 1. y0 + k) = 0. y4 = 0. y0 ) = (1. y5 = 0. Example 6 Find the root of the system of equations x2 + y 2 − 1 = 0 (1.3779687984 We have then achieved 3 places of decimals accuracy.9258059728. yn+1 = G(xn+1 . Trans- forming the equations lead to the iteration scheme r p 1 x2n+1 xn+1 = 1 − yn2 .9185586535. y0 + k) is the exact root of the system.3952847075 x3 = 0. g(x0 + h. 1). yn+1 = − . then we must have that f (x0 + h.8) 2 x + 4y 2 − 1 = 0 (1. y6 = 0. y0 + k) = 0.9257070778. 4 8 Thus we obtain the iterations x1 = 0. y1 = 0.3801726581 x4 = 0. That is x ≈ 0. y2 = 0.. xn+1 = F (xn . y ≈ 0.5 x2 = 0. y0 ).926. .866025404.6.3782412011 x5 = 0.378.9) 2 correct to 3 places of decimals using the initial value (x0 . yn ). y2 = 0.3779990751 x6 = 0. yn ).

828. y1 = y0 + k. The process is repeated until the required accuracy is attained. However.162 and y = 6 = 2. g0 = g(x0 . = . = .10) ∂x0 ∂y0 ∂g ∂g g0 + h +k +··· = 0 ∂x0 ∂y0 where     ∂f ∂f ∂f ∂f f0 = f (x0 .9) can be solved for h and k to obtain the new solution as x1 = x0 + h.11) ∂x0 ∂y0 ∂g ∂g h +k = −g0 ∂x0 ∂y0 The system (1. y0). this is obtained from a rough graph.449. To apply the Newton-Raphson method. in general. we can expand them in Taylor’s series as ∂f ∂f f0 + h +k +··· = 0 (1. 12 . we replace the hyperbola by its asymptote y = x. ∂x0 ∂x x=x0 ∂y0 ∂y y=y0 Neglecting the second and higher order terms. √ This produces the initial values x0 = y0 = 2 2 = 2. Example 6 Find the real roots of the equations x2 − y 2 = 4 x2 + y 2 = 16 Solution: √ √ This system has the solutions x = 10 = 3. we obtain the system of linear equations ∂f ∂f h +k = −f0 (1. y0).If f and g are sufficiently differentiable.

354.474. Thus to obtain the solution to the system f (x. y1 = y0 + k = 2. ∂f ∂y ∂g = −2x. yn ) and J(xn ) =   and J −1 (xn ) is the inverse of ∂g ∂g ∂xn ∂yn 13 .354. 1].12) J(xn )   ∂f ∂f ∂xn ∂yn where Xn = (xn . y0 ] = [1.707 h+k =0 which have the solutions h = 0. y) = x2 + y 2 − 1 = 0 x2 g(x. ∂x = 2x. g = x2 + y 2 − 16 ∂f ⇒ ∂x = 2x.162. ∂f √ ∂f √ ∂g √ ∂g √ ∴ ∂x 0 = 2x 0 = 4 2. we replace f ′ (x) in the Newton-Raphson iteration scheme with the Jacobian J(x) of the system. ∂g ∂y = 2y.Taking f = x2 − y 2 − 4. and f0 = x20 − y02 − 4 = −4. ∂y 0 = 4 2. the procedure is modified accordingly. Thus the iteration scheme becomes f (xn ) xn+1 = xn − = xn − f (xn )J −1 (xn ) (1. The second approximation is then given by x1 = x0 + h = 3. g0 = x20 + y02 − 16 = 0.182. y1 ) and repeating the process. y) = + 4y 2 − 1 = 0 2 subject to the initial approximation [x0 . For a system of equations. y2 = y1 + k = 2. ∂x 0 = 4 2. ∂y 0 = 2x0 = −4 2.450. k = −0. Thus one obtains the equations h − k = 0. Using (x1 . k = −0.0242 and thus x2 = x1 + h = 3.0204. we obtain h = −0.

yn ).57142857 −0.07142857 0.378. x2 + 4y 2 − 1 (xn+1 . Thus the iteration scheme becomes (f (xn .13) ∂f ∂f  ∂xn ∂yn  ∂g ∂g ∂xn ∂yn Hence. 3. Obtain a root for each of the following equations using the bisection method (a) x3 + x2 + x + 7 = 0 (b) x3 − x2 − 1 = 0 14 .926. xn+1 ) = (xn .5)   2 2 −0.67857143. we obtain  2  x2 + y 2 − 1.37794889) Hence we have achieved convergence to three places of decimals.92613160 0.92581236 0. that is x ≈ 0. y1 ) = (1. Class Exercise: Use the fixed point iteration method to obtain the solution of example 6 above. (x1 y1 ) = (0. for the above system. 1) −   = (1.41999860) (x3 y3 ) = (0.5) 0. yn ) −   (1. General Exercises 1. 3.14285714 (x1 . g(xn . yn ) −   2x 2yn  n  xn 8yn Taking x0 = (1.92764766 0. y ≈ 0.64285714). yn )) (xn+1 .14285714   1 8 = (0.64285714) (x2 y2 ) = (0.14) (x4 y4 ) = (0. 1) leads to the following sequence of approximations:   (1. 1) − (1. yn+1 ) = (xn .88305212 0.38043036) (1. 0.J(xn ).37779498) (x5 y5 ) = (0.67857143 0.

Use Newton-Raphson method to solve the equation (a) x4 − x3 − 2x − 34 = 0 (b) tan x = 4x.2.f. 1 (a) cos x = 3x − 1 (b) x = (1+x)2 3. Use the fixed point iteration method to find a root of each of the following equations correct to 4 s. 15 .

2. the major problem of numerical anal- ysis is the converse. 1. · · · . given the set of tabular values (x0 . Suppose that we are required to recover the values of f (x) for some intermediate values of x or to obtain the derivative of f (x) for some x in the range x0 < x < xn .1 Finite Differences Assuming we have a table of values (xi . (x1 . say x0 . 1. If φ(x) is a polynomial. i. n of any function y = f (x). 2. that is. i = 0. x1 . i = 0. However. xn . the values of x being equally spaced. y2 ). yn ) satisfying the relation y = f (x) where the explicit nature of f (x) is unknown. can easily be computed and tabulated. 16 . (x2 .e. x2 . y1 ). and assuming that f (x) is single-valued and continuous and that it is known explicitly. (xn . xi = x0 +ih. 2.Chapter 2 Interpolation Given a function f (x) defined on the interval x0 < x < xn . then the val- ues of f (x) corresponding to certain given values of x. · · · . it is required to find a simpler function φ(x) such that f (x) and φ(x) agree at the set of tabulated points. y0 ). n. Such a process is known as interpolation. yi ). then the process is called poly- nomial interpolation and φ(x) is called the interpolating polynomial. · · · . · · · .

where ∆ is called the forward difference operator and ∆y0 . ∆y1 . Similarly. y2 . The differences of the first forward differences are called second forward differences and are denoted by ∆2 y0 .1 Forward Differences If y0 . · · · . y3 − y2 . · · · . one can define the third and higher differences. ∆2 y2 . y2 − y1 . yn − yn−1 are called the differences of y. ∆y2 = y3 − y2 . y1. ∆y1 = y2 − y1 . ∆4 y0 = ∆3 y1 − ∆3 y0 = y4 − 4y3 + 6y2 − 4y1 + y0 . yn denote a set of values of y. Note that the coefficients in the above expansions are binomial coefficients. ∆yn−1 = yn − yn−1 . ∆yn−1 respectively. Denoting the differences by ∆y0 . · · · . ∆2 y0 = ∆(y1 − y0 ) = ∆y1 − ∆y0 = y2 − 2y1 + y0 ∆3 y0 = ∆2 y1 − ∆2 y0 = ∆y2 − ∆y1 − (∆y1 − ∆y0 ) = y3 − y2 − (y1 − y0 ) − [y2 − y1 − (y1 − y0 )] = y3 − 3y2 + 3y1 − y0 . then y1 − y0 . ∆y2 . · · · . Similarly. 2. ∆y1 . · · · are called first forward differences.The methods for the solution of these problems are based on the concept of the differences of a function which we now proceed to define. ∆y2 .1. Thus. · · · . ∆2 y1 . we have ∆y0 = y1 − y0 . 17 .

1. y3 − y2 . 2. ∇3 y3 = ∇2 y3 − ∇2 y2 = y3 − 3y2 + 3y1 − y0 . and so forth. the central difference table can be formed thus 18 . 2 2 2 Higher order central differences can be obtained in a similar manner. x y ∆ ∆2 ∆3 ∆4 ∆5 ∆6 x0 y0 ∆y0 x1 y1 ∆y1 ∆2 y0 ∆3 y0 x2 y2 ∆y2 ∆2 y1 ∆3 y1 ∆4 y0 x3 y3 ∆y3 ∆2 y2 ∆3 y2 ∆4 y1 ∆5 y0 x4 y4 ∆y4 ∆2 y3 ∆3 y3 ∆4 y2 ∆5 y1 ∆6 y0 x5 y5 ∆y5 ∆2 y4 ∆3 y4 ∆4 y3 x6 y6 ∆y6 ∆2 y5 Table 2.1. In a similar way. Using the values from the two tables above. Thus we have ∇2 y2 = ∇y2 − ∇y1 = y2 − 2y1 + y0 . ∇y2 . 2. one can define backward differ- ences of higher orders. ∇y2 = y2 − y1 .2 Backward differences The differences y1 − y0 . ∇y3. yn − yn−1 are called first back- ward differences if the are denoted by ∇y1 .3 Central Differences The central difference operator is defined by the relations δy 1 = y1 − y0 . δyn− 1 = yn − yn−1 . δy 3 = y2 − y1 . y2 − y1 . · · · . · · · . · · · . ∇yn = yn − yn−1 . where ∇ is called the backward difference operator. · · · .1: The table of forward differences. ∇yn respectively so that ∇y1 = y1 − y0 .

2 ∆3 y2 = ∇3 y5 = δ 3 y 7 .3: The table of central differences. 2 and so on.2: The table of backward differences. x y δ δ2 δ3 δ4 δ5 δ6 x0 y0 δy 1 2 x1 y1 δy 3 δ 2 y1 δ3y 3 2 2 2 3 x2 y2 δy 5 δ y2 δ y5 δ 4 y2 δ5y 5 2 2 2 2 3 4 5 x3 y3 δy 7 δ y3 δ y7 δ y3 δ y7 δ 6 y3 2 2 2 x4 y4 δy 9 δ 2 y4 δ3y 9 δ 4 y2 2 2 x5 y5 δy 11 δ 2 y5 2 x6 y6 Table 2. 19 . Note from the three tables that ∆y0 = ∇y1 = δy 1 . x y ∇ ∇2 ∇3 ∇4 ∇5 ∇6 x0 y0 x1 y1 ∇y1 x2 y2 ∇y2 ∇2 y 2 x3 y3 ∇y3 ∇2 y 3 ∇3 y 3 x4 y4 ∇y4 ∇2 y 4 ∇3 y 4 ∇4 y 4 x5 y5 ∇y5 ∇2 y 5 ∇3 y 5 ∇4 y 5 ∇5 y 5 x6 y6 ∇y6 ∇2 y 6 ∇3 y 6 ∇4 y 6 ∇5 y 6 ∇6 y 6 Table 2.

Also. This implies that the effect of E on y0 is the same as that of the operator (1 + ∆) on y0 .1. The following relations can also be established from the definitions ∇y0 = y0 − E −1 y0 = (1 − E −1 )y0 ⇒ ∇ ≡ 1 − E −1 .1) Now. 1 1 1 1 δy0 = E 2 y0 − E − 2 = (E 2 − E − 2 )y0 1 1 ∴ δ ≡ E 2 − E− 2 . The higher order forward differences in terms of the given function values are ∆2 y0 = (E − 1)2 y0 = (E 2 − 2E + 1)y0 = E 2 y0 − 2Ey0 + E 0 y0 = y2 − 2y1 + y0 . Hence 1 ∆ ≡ ∇E ≡ δE 2 . The shift operator E is defined by Eyi = yi+1 E 2 yi = E(Eyi ) = E(yi+1) = yi+2 and in general E n (yi ) = yi+n (2. ∆3 y0 = (E − 1)3 y0 = (E 3 − 3E 2 + 3E − 1)y0 = y3 − 3y2 + 3y1 − y0 .4 symbolic Relations We can establish difference formulae by using the shift operator E in addition to the operators ∆. a relationship between ∆ and E can be derived as follows: ∆y0 = y1 − y0 = Ey0 − y0 = (E − 1)y0 . ∇ and δ defined above. 20 .2. Hence ∆ = E − 1 or E = 1 + ∆.

3) = a0 nhxn−1 + a′1 xn−2 + · · · + a′n 21 . then these indicators can be used to detect errors in difference tables as can be seen from table (2. if we introduce an error e in a tabulated values of zeroes. we can notice how the error propagates fanwise at higher differences and also gets magnified. 2.2 Differences of a Polynomial Suppose y(x) is a polynomial of degree n so that y(x) = a0 xn + a1 xn−1 + a2 xn−2 + · · · + an (2.2) We then obtain the difference of y(x) as ∆y(x) = y(x + h) − y(x) = a0 [(x + h)n − xn ] + a1 (x + h)n−1 − xn−1 + · · ·   (2.4) below.5 Detecting Errors by Use of Difference Tables Errors in tabulated values can easily be detected using difference tables. For ex- ample.2. The following characteristics of error propagation can be deduced from the table that follows: (i) Error increases with the order of the differences (ii) The errors in any one column are the binomial coefficients with alternating signs (iii) The algebraic sum of the errors in any difference column is zero (iv) The maximum error occurs opposite the function value containing the error.1. Suppose an error e is introduced into the table of values of a given function.

consider the polynomial y(x) = ax2 + bx + c. y ∆ ∆2 ∆3 ∆4 ∆5 0 0 0 0 0 0 0 0 0 0 e 0 0 0 e e -5e 0 e e -3e -4e 10e e -e -2e 3e 6e -10e 0 0 e -e -4e 5e 0 0 0 0 e -e 0 0 0 0 0 0 0 0 0 0 Table 2. For example.4: Error spread in a difference table which shows that the difference of a polynomial of degree n is a polynomial of degree n−1. The first and second forward differences become ∆y(x) = y(x + h) − y(x) = a(x + h)2 + b(x + h) + c − ax2 − bx − c = (2ax + ah + b)h ∆2 y(x) = ∆y(x + h) − ∆y(x) = 2ah2 22 . the second difference will be a polynomial of degree n−2 and ∆n y(x) will then be a constant. Similarly.

(x0 . 3!h3 4!h4 n!hn Setting x = x0 + ph and substituting for a0 . Suppose the values of x are equidistant. y2 ). an = . 2h2 2h2 Similarly. · · · . a2 . i.5) p(p − 1)(p − 2) · · · ()p − n + 1 n +···+ ∆ y0 n! 23 . a4 = . of x and y. an in (2. x1 − x0 h y2 = a0 + a1 (x2 − x1 ) + a2 (x2 − x0 )(x2 − x1 ) y1 − y0 = y0 + (x2 − x0 ) + a2 h(x2 − x0 ) x1 − x0 y2 − y0 ∆y0 ∴ = + a2 h x2 − x0 h   1 y2 − y0 y1 − y0 ⇒ a2 = − h 2h h y2 − 2y1 + y0 ∆2 y0 = = . y1 = a1 (x1 − x0 ) + y0 ⇒ a1 = = .e y(xi ) = yi (xi ). it is required to find yn (x). (x1 . · · · . a1 . (x2 . 1.4) above gives p(p − 1) 2 p(p − 1)(p − 2) 3 yn (x) = y0 + p∆y0 + ∆ y0 + ∆ y0 2! 3! (2. yn ). Since yn (x) is a polynomial of degree n. · · · . ∆3 y0 ∆4 y0 ∆n y0 a3 = . n.4) Now. we impose the condition that y and yn (x) should agree at the set of tabulated points. y0). y1 ). a polynomial of degree n such that y and yn (x) agree at the tabulated points. (xn . it may be written as yn (x) = a0 + a1 (x − x0 ) + a2 (x − x0 )(x − x1 ) + · · · + an (x − x0 )(x − x1 ) · · · (x − xn−1 ) (2.2.1 Newton’s Interpolation Formulae Given the set of n + 1 values. · · · .2. i = 0. we obtain y1 − y0 ∆y0 y0 = a0 . and let xi = x0 + ih. 2.

produces 1 1 y ′(x) = [y(x + h) − y(x)] = ∆y(x).6) is not useful in practice. · · · . x0 .8) 24 . we obtain in a similar manner as above p(p + 1) 2 p(p + 1) · · · (p + n − 1) n yn (x) = yn + p∇yn + ∇ yn + · · · + ∇ yn 2! n! (2. However. xn−1 . (2. x2 . xn−2 .6) can then be written as p(p − 1)(p − 2) · · · (p − n) n+1 y(x) − yn (x) = ∆ y(ξ) (2. In any case.4) in the form yn (x) = a0 +a1 (x−xn )+a2 (x−xn )(x−xn−1 )+· · ·+an (x−xn )(x−xn−1 ) · · · (x−x1 ) and then impose the condition that y(x) and yn (x) should agree at the tabulated points xn . a useful estimate of the derivative can be obtained thus: We obtain the Taylor’s series expansion of y(x + h) as h2 ′′ y(x + h) = y(x) + hy ′(x) + y (x) + · · · 2! and neglecting the term containing h2 and higher powers of h.This is called Newton’s forward interpolation formula and it is useful for interpo- lation near the beginning of a set of tabular values. since we have no information concerning y (n) (x). Equation (2. x1 . if y (n) (x) does not vary rapidly in the interval.7) (n + 1)! a form suitable for computation. h h 1 Thus y (n+1) (x) = hn+1 ∆n+1 y(x).6) (n + 1)! for x0 < ξ < xn . If we assume (2. The error committed in replacing the function y(x) by the polynomial yn (x) can be obtained as (x − x0 )(x − x1 ) · · · (x − xn ) (n+1) y(x) − yn (x) = y (ξ) (2.

25 . Thus substituting for p in (2.5). x−xn where p = h . one obtains x = 0 + p = p. y(4) can be obtained by substituting x = 4 in the polynomial obtained above. The error is estimated as p(p + 1)(p + 2) · · · (p + n) n+1 n+1 y(x) − yn (x) = h y (ξ) (2.9) (n + 1)! where x0 < ξ < xn and x = xn + ph. Using x = x0 + ph and choosing x0 = 0. Solution: We form the forward difference table thus: x y ∆ ∆2 ∆3 0 1 -1 1 0 1 2 2 1 9 8 6 3 10 Here. Note that this process of obtaining the value of y for some value of x outside the given range is called extrapolation and this demonstrates the fact that if a tabulated function is a polynomial. h = 1 (from the forward difference table). This formula is useful for inter- polation near the end of tabulated values. then interpolation and extrapolation would yield exact values. one obtains x(x − 1) x(x − 1)(x − 2) y(x) = 1 + x(−1) + (2) + (6) = x3 − 2x2 + 1. Example 7 Find the cubic polynomial which takes the following values: x 0 1 2 3 y 1 0 1 10 Hence or otherwise obtain y(4). This is called Newton’s backward difference interpolating for- mula and it uses tabular values to the left of yn . 2! 3! which is the polynomial from which we obtained the tabulated values above.

2027 0.0014 0.0526 0. 6 24 (i) To obtain tan(0. We now use Newton’s backward interpolation formula (2.26).10 ≤ x ≤ 0.5) yields 0.8).26 = 0. and using (2.25 0.0002 0.05p ⇒ p = 0.0008) 2 0.20 0.10 + 0.50).0540 (i) Taking x = x0 + ph. Example 8 The table below gives the values of tan x for 0.0516 0. h = 0.4 − 1)(0.2553 0.4 − 3) + (0.26) (c) tan(0. thus to find the value of tan(0.4.25 0.0508) + (0.4 − 1)(0.4(0.3093 0.0002 0.1003 + 0.0508 0.0002) = 0. where x0 = 0.12).1511 0.12 = 0.12) (b) tan(0.2553 0.8.10. we have that 0.05) ⇒ p = −0. since we are estimating a value at 26 .4(0.12) = 0.05.1511 0.1003 0. x 0.4 − 2) 0.0010 0.30 + p(0.3093 Find: (a) tan(0.10 0.1003 0. Solution: The table of froward differences is x y ∆ ∆2 ∆3 ∆4 0.0004 0.20 0.40) (d) tan(0.0002) + (0.10 0.1205.4 − 1) tan(0. we have 0.4(0.30.15 0.30 y = tan x 0.4 − 2)(0.30 0.2027 0.15 0.4(0.0008 0.

8 + 2) 0. y0 ). (x1 .5543. then extrapolation very far from the table limits would be dan- gerous. (xn . 0.50) are re- spectively 0. · · · .0540) − (0.e uniform grids).8(−0. they possess a major disadvantage of re- quiring the values of the independent variable to be equally spaced (i.26).5463. Using formula (2.2662.1 Lagrange’s interpolation formula Let y(x) be continuous and differentiable (n+1) times in the interval (a. y1 ).the end of the data.8 + 1)(−0.8(−0.0004) − (0.40) = 0.0014) 2 0. 0.8 + 1)(−0. b). We discuss in this section Lagrange’s interpolation formula which uses only the function values.8 + 1) tan(0.40).8(0. Hence one obtains 0.8 + 3) − (0.3093 − 0. yn ).1206.8 + 2)(−0.2660.4241 and (iv) tan(0.8(−0. tan(0. tan(0.50) = 0.5) and proceeding as in (i).0002) 6 24 = 0.12). say 27 . 2. although interpolation can be carried out very accurately. one gets (iii) tan(0. tan(0.26) = 0.4228 and 0.3. we derived interpolation formulae and discussed their practical use in some detail. Note that the actual values of tan(0. 2.3 Interpolation with unevenly spaced points In the previous section. (x2 . y2 ). However. Thus if the tabulated function is not a polynomial. It is therefore desirable to have interpolation formulae with unequally spaced values of the argument (non-uniform grids). where the values of x need not necessarily be equally spaced. we wish to find a polynomial of degree n. Given the n+1 points (x0 .

. n (2.12) . i = 0. 2.. yn = a0 + a1 xn + a2 x2n + · · · + an xnn The system (2. ··· .10) into (2. . . .φn (x) such that φi (xi ) = y(xi ) = yi .11).12) will have a solution if the determinant . . . 1... . we obtain the system of equations y0 = a0 + a1 x0 + a2 x20 + · · · + an xn0 y1 = a0 + a1 x1 + a2 x21 + · · · + an xn1 y2 = a0 + a1 x2 + a2 x22 + · · · + an xn2 (2.10) Let φn (x) = a0 + a1 x + a2 x2 + · · · + an xn (2. Substituting the condition (2.. · · · ..11) be the desired polynomial. .

.

2 .

1 x0 x0 · · · x0 .

.

n .

.

.

.

1 x1 x21 · · · xn1 .

.

.

.

.

.

1 x2 x22 · · · xn2 .

6= 0 (2.13) .

.

.

. . . .. ... .

.

.

.

. . ··· . . .

.

.

.

1 xn x2n · · · xnn .

.

.

The value of this determinant called Vandermonde’s determinant is (x0 − x1 )(x0 − x2 ) · · · (x0 − xn )(x1 − x2 ) · · · (x1 − xn ) · · · (xn−1 − xn ). 28 .

12). a1 .11) and (2.Eliminating a0 . we obtain . an from equations (2. · · · . a2 .

.

2 .

φn (x) 1 x x · · · x .

.

n .

.

.

2 n .

y0 1 x0 x0 · · · x0 .

.

.

.

.

2 n .

.

= 0 (2.14) .

y1 1 x1 x1 · · · x1 .

.

.. . ... . . . .

.

.

.

. .. . . . · · · .

.

.

1 xn x2n · · · xnn .

.

.

.

1. yn which shows that φn (x) is a linear combination of y0 . Hence Li (x) may be written as (x − x0 )(x − x1 ) · · · (x − xi−1 )(x − xi+1 ) · · · (x − xn ) Li (x) = (2. n. (x − xi )π ′ (xi ) Hence (2. · · · . 2.15) yields n X π(x) φn (x) = yi . y1 . The function π(x) = (x − x0 )(x − x1 ) · · · (x − xi−1 )(x − xi+1 ) · · · (x − xn ) Y n = (x − xi ) (2.  if i = j where δij is the Kronecker delta.  if i 6= j δij = Li (xj ) = 1. equation (2. Since φj (xj ) = yj for j = 0.15) gives  Li (xj ) = 0.17) i=0 may be used to express the Lagrange multiplier function in the more compact form π(x) Li (x) = . yn . (2.18) i=0 (x − xi )π ′ (xi ) 29 .16) (xi − x0 )(xi − x1 ) · · · (xi − xi−1 )(xi − xi+1 ) · · · (xi − xn ) which satisfies the condition above. Hence we write n X φn (x) = Li (x)yi (2.15) i=0 where Li (x) are polynomials in x of degree n. y2. · · · .

18). (2. The Li (x) are called Lagrange’s interpolation coefficients. For a quadratic interpolation. (x − x0 )(x0 − x1 )(x0 − x2 ) (x0 − x1 )(x0 − x2 ) (x − x0 )(x − x1 )(x − x2 ) (x − x0 )(x − x2 ) L1 (x) = = (x − x1 )(x1 − x0 )(x1 − x2 ) (x1 − x0 )(x1 − x2 ) and (x − x0 )(x − x1 )(x − x2 ) (x − x0 )(x − x1 ) L2 (x) = = . we have φ2 (y) = L0 (x)y0 + L1 (x)y1 + L2 (x)y2 (2.which is known as Lagrange’s interpolation formula. From (2. It is important to note that the Lagrange’s interpolation polynomial is unique.18) yields the formula n X π(y) φn (y) = xi . (x0 − x1 )(x0 − x2 ) (x1 − x0 )(x1 − x2 ) (x2 − x0 )(x2 − x1 ) Example 9 Obtain a linear Lagrange’s polynomial for the tabulated values for y = ln x. Interchanging x and y in (2.19) i=0 (y − yi )π ′ (yi ) which is useful for inverse interpolation. we note that φ1 (x) = L0 (x)y0 + L1 (x)y1 (2. 30 .21) where (x − x0 )(x − x1 )(x − x2 ) (x − x1 )(x − x2 ) L0 (x) = = .20) where π(x) (x − x0 )(x − x1 ) x − x1 L0 (x) = = = (x − x0 )π (x) ′ (x − x0 )(x0 − x1 ) x0 − x1 π(x) (x − x0 )(x − x1 ) x − x0 L1 (x) = = = (x − x1 )(x0 − x1 ) (x − x1 )(x0 − x1 ) x1 − x0 x − x1 x − x0 ∴ φ(x) = y0 + y1 . (x − x2 )(x2 − x0 )(x2 − x1 ) (x2 − x0 )(x2 − x1 ) (x − x1 )(x − x2 ) (x − x0 )(x − x2 ) (x − x0 )(x − x1 ) ∴ φ2 (x) = y0 + y1 + y2 . x0 − x1 x1 − x0 This is a linear interpolation formula.

5x + 85.4800 (9. L0(9.0 x − 9.5 y = ln x 2.2513 2.5 − 11.5 0. Thus linear interpolation is not sufficient to get 4 d.0 − 9. y0 = 2.2513 Solution: Here. y1 = 2.1972) + (2. x − x1 x − x0 ∴ φ1 (x) = L0 (x)y0 + L1 (x)y1 = y0 + y1 x0 − x1 x0 − x1 x − 9.5 ∴ error = 2.2513) = 2. L1 (9. accuracy. x1 = 9.1972 2. −0.1972) + (2.0004.5400 (9.0 9.2) = −0.0) (x − 9.0.5.2) correct to 4 places of decimals.0) 3 (x − 9.0 ∴ φ1 (9.2 − 9.3979 Solution: (x − 9.0)(x − 9.5).5 x − 9.Hence find the value of y(9.5 11.5)(x − 11.2 − 9.0 − 9.0 y = ln x 2.5 9.5) 3 31 .5 − 9.5 0.5 − 9. (11.5.0 9.1972.0) L0 (x) = = x2 − 20. x0 = 9.0)(x − 11.0)(9.2188 = 0.5 x − 9.1972 2.0) 4 L1 (x) = = − (x2 − 20x + 99).0 = ln(9.2188.0 − 9.0 −0.2) = 0.2513) 9.0) + ln(9.0)(11. it would suffice for 3 d.5) = (2.p. Example 10 Obtain the value of ln(9.2) using the quadratic interpolation polynomial using the data below: x 9. and determine the error in the estimate.5 9.5) 1 L2 (x) = = (x2 − 18.2513.5x − 104. x 9.2192 − 2.2) = (2.2) = 0.5)(9.5 9.p.0 − 11. accuracy. L2 (9.0 − 9.0200.

This is the same polynomial we have earlier obtained using Newton’s forward interpolation. (x3 − x0 )(x3 − x1 )(x3 − x2 ) 3 ∴ φ3 (x) = L0 (x)y0 + L1 (x)y1 + L2 (x)y2 + L3 (x)y3 1 1 5 = − (x−1)(x−2)(x−3)+0− x(x−1)(x−3)+ x(x−1)(x−2) = (x−1)(x2 −x−1) 6 2 3 ∴ φ3 (x) = x3 − 2x + 1.2) = 0. 2.2513)−0.4800(2. Example 11 Fit a cubic Lagrange’s interpolation polynomial to the data below: x 0 1 2 3 y 1 0 1 10 Solution: (x − x1 )(x − x2 )(x − x3 ) 1 L0 (x) = y0 = − (x − 1)(x − 2)(x − 3) (x0 − x1 )(x0 − x2 )(x0 − x3 ) 6 (x − x0 )(x − x2 )(x − x3 ) L1 (x) = y1 = 0 (x1 − x0 )(x1 − x2 )(x1 − x3 ) (x − x0 )(x − x2 )(x − x3 ) 1 L2 (x) = y2 = x(x − 1)(x − 3) (x2 − x0 )(x2 − x1 )(x2 − x3 ) 2 (x − x0 )(x − x1 )(x − x2 ) 5 L3 (x) = y3 = x(x − 1)(x − 2).1972)+0.p. 32 .2) = ln(9.4 Least Squares Method for Curve Fitting The least squares method is one of the most systematic procedures for fitting a unique curve through given data points and is widely used in practical computa- tions.3979) = 2.0200(2.2192 which is exact to 4 d.∴ φ2 (9.5400(2.

we have S = [y1 − (a0 + a1 x1 )]2 + [y2 − (a0 + a1 x2 )]2 + · · · + [ym − (a0 + a1 xm )]2 (2. Then. corre- sponding to equation (2. If ei is the error of approximation at x = xi . and let the curve given by y = f (x) be fitted to this data. · · · . i = 0. the experimental (or observed) value of the ordinate is yi and the corresponding value on the fitting curve is f (xi ). At x = xi .4. 1.Let the set of data points be (xi .23) = e21 + e22 + · · · + e2m . we have ∂S = −2[y1 − (a0 + a1 x1 )] − 2[y2 − (a0 + a1 x2 )] − · · ·− 2[ym − (a0 + a1 xm )] = 0 ∂a0 and ∂S = −2x1 [y1 −(a0 +a1 x1 )]−2x2 [y2 −(a0 +a1 x2 )]−· · ·−2xm [ym −(a0 +a1 xm )] = 0 ∂a1 Simplifying the above equations yield ma0 + a1 (x1 + x2 + · · · + xm ) = y0 + y1 + y2 + · · · + ym 33 . that is the sum of the squares of the errors. yi ).22) Now.1 Fitting a straight line Let y = a0 + a1 x be the straight line to be fitted to the given data.24) For S to be minimum. if we let S = [y1 − f (x1 )]2 + [y2 − f (x2 )]2 + · · · + [ym − f (xm )]2 (2. m.23). 2. then we have ei = yi − f (xi ) (2. then the method of least squares consists of minimising S. 2.

and can be solved for the unknowns a0 and a1 . We also note that ∂a20 ∂2S and ∂a21 are both positive at the points a0 and a1 . m x2i − ( xi )2 P P Since the xi and yi are known quantities.25) by m yields a0 + a1 x̄ = ȳ (2. Thus these values provide a minimum of S. If l = a + bT .9 801.4 800. Now. the equations (2. T 20 30 40 50 60 70 l 800.25) are called the normal ∂2S equations.0 34 .3 800. Example 12 The table below gives the temperatures T (in ◦ C) and lengths l (in mm) of heated rod. Hence the fitted straight line passes through the centroid of the data points.26) where (x̄. ȳ) is the centroid of the given data points. We then have the equations m X m X ma0 + a1 xi = yi (2. find the best values for a and b that approximate the data of the table below. dividing the first of equations (2.25) i=1 i=1 m X m X m X a0 xi + a1 x2i = xi yi i=1 i=1 i=1 where yi )( x2i ) − ( xi )( xi yi ) P P P P ( a0 = m x2i − ( xi )2 P P and P P P m xi yi − ( xi )( yi ) a1 = .7 800.and a0 (x1 + x2 + · · · + xm ) + a1 (x21 + x22 + · · · + x2m ) = x1 y1 + x2 y2 + · · · + xm ym .6 800.

4 900 24012 40 800. Solution: T l T2 lT 20 800. Thus the procedure outlined above can be followed to obtain the values of a0 and a1 .7 2500 40035 60 800.28) 35 .3 400 16006 30 800.0 4900 56070 270 4803.6 1600 32024 50 800. hence α and c can be calculated.0146.4.2 Nonlinear curve fitting A nonlinear function y = αxc can be fitted to the given set of data points. a1 = c and X = log x. Now consider the parabola y = a0 + a1 x + a2 x2 (2. a0 = log α.0146b. Taking the logarithms of both sides yields Y = a0 + a1 X (2.27) where Y = log y.9 3600 48054 70 801. 2.9 13900 216201 Using the normal equations. ∴ l = 800 + 0. one obtains 6a + 270b = 4803.9 270a + 13900b = 216201 which lead to a = 800 and b = 0.

45x .28). n has the equation (2. X X X y = na0 + a1 x + a2 x2 X X X X xy = a0 x + a1 x2 + a2 x3 (2. a = ln α and b = β.40 2. This is of the form y = a + bx.95 2. · · · . 36 .28). Thus the curve becomes Y = 4. i = 0. yi ). Similarly.The least squares parabola approximating the set of points (xi .48 and β = 0. 1. since an estimate of y is obtained for any given value of x.29) X X X X x2 y = a0 x2 + a1 x3 + a2 x4 The equations (2. Thus we fit a least squares line to the data x 1 2 3 3 y 1. This parabola is said to be the regression curve of y on x. we can have a regression equation of x on y. a1 and a2 can be determined by solving simultaneously the equations. Example 13 Fit a curve of the form Y = αeβx to the data below x 1 2 3 4 Y 7 11 17 27 Solution: Taking the natural logarithms of both sides leads to ln y = ln α + βx. The constants a0 .29) are called the normal equations for the least squares parabola (2. 2. where y = ln Y.30 and one obtains α = 4.83 3.45.48e0.

9 7.7 7.8 3.5 2.1 8.8 4.2 6.8 7.6 9.Exercise Obtain a quadratic curve which fits the data in the table below. x 1.5 5.1 4.7 37 .8 y 4.2 1.9 5.0 7. using the least squares method.

y0 ). can we find a polynomial yn (x) of the lowest degree such that y(x) and yn (x) agree at the set of tabulated points? In this chapter. Differ- entiating the Newton’s forward interpolating formula yn (x) = y0 + (p1 ) ∆y0 + (p2 ) ∆2 y0 + (p3 ) ∆3 y0 + · · · + (pn ) ∆n y0 (3. (xn .1 Introduction In chapter 2. 3. yn ) of x and y. (x1 . we considered the problem of interpolation. y1 ). xn ]. we are concerned with numerical differentiation and inte- gration. given a set of tab- ulated values (x0 . that is.Chapter 3 Numerical Differentiation and Integration 3. · · · . This involves deriving formulae for derivatives and integrals from given set of tabulated values of x and y in the interval [x0 .1) 38 .2 Numerical Differentiation A straightforward method for deriving numerical differentiation formulae is to differentiate the interpolation formulae obtained in the previous chapter.

2) .5) h For tabulated value x0 . p = 0 and hence equations (3.2) h 2 6 12 6p2 − 18p + 11 4   ′′ 1 2 3 yn (x) = 2 ∆ y0 + (p − 1)∆ y0 + ∆ y0 + · · · (3.(3.8) h 2 Using only the first terms of the formulae above.6) h 2 3 4   ′′ 1 2 3 11 4 yn (x) = 2 ∆ y0 − ∆ y0 + ∆ y0 + · · · (3. leads to the following results: 3p2 − 6p + 2 3 2p3 − 9p2 + 11p − 3 4     1 1 2 yn′ (x) = ∆y0 + p − ∆ y0 + ∆ y0 + ∆ y0 + · · · (3.4) simplify to   ′ 1 1 2 1 3 1 4 yn (x) = ∆y0 − ∆ y0 + ∆ y0 − ∆ y0 + · · · (3. we obtain other formulae using Newton’s backward differ- 39 .3) h 12   ′′′ 1 3 2p − 3 4 yn (x) = 3 ∆ y0 + ∆ y0 + · · · (3.4) h 2 1 yn(iv) (x) = 4 [∆4 y0 + · · · ](3. In a similar vein. one obtains the forward finite difference approximations to the following derivatives: 1 y(x + h) − y(x) y ′(x) = ∆y0 = h h 1 2 y(x + 2h) − 2y(x + h) + y(x) y ′′ (x) = ∆ y 0 = h2 h2 1 y(x + 3h) − 3y(x + 2h) + 3y(x + h) − y(x) y ′′′(x) = 3 ∆3 y0 = h h3 and so on. p! where (pr ) = (p−r)!r! .7) h 12   ′′′ 1 3 3 4 yn (x) = 3 ∆ y0 − ∆ y0 + · · · (3.

p = 0 and the formulae listed in (3.0250 Solution: We construct the difference table for the tabulated values as follows 40 .4 1.6 1.2. obtain the value of (i) y ′(x) and (ii) y ′′ (x) at the point x = 1.2 y 2.12) h 2 Similar finite difference approximations to the derivatives can be obtained from the first terms of the above formulae as in the case of forward differences.2 1.0 2.9) simplify to   ′ 1 1 2 1 3 1 4 yn (x) = ∇yn + ∇ y0 + ∆ yn + ∇ yn + · · · (3.0496 7.3201 4.0552 4.9) For tabulated value x = xn .8) as 3p2 + 6p + 2 3 2p3 + 9p2 + 11p + 3 4     ′ 1 1 2 yn (x) = ∇yn + p + ∇ yn + ∇ yn + ∇ yn + · · · h 2 6 12 6p2 + 18p + 11 4   ′′ 1 2 3 yn (x) = 2 ∇ yn + (p + 1)∇ yn + ∇ yn + · · · h 12   ′′′ 1 3 2p + 3 4 yn (x) = 3 ∇ yn + ∇ yn + · · · h 2 1 yn(iv) (x) = 4 [∇4 yn + · · · ] h (3. Example 14 From the table of values below.8 2.7183 3.11) h 12   ′′′ 1 3 3 4 yn (x) = 3 ∇ yn + ∇ yn + · · · (3.0 1.10) h 2 3 4   ′′ 1 2 3 11 4 yn (x) = 2 ∇ yn + ∇ yn + ∇ yn + · · · (3.3891 9.ence interpolating formula (2. x 1.9530 6.

0096 0.1627) + 13 (0.6359 0.0001 From the difference table.0013 2.0080 0.6 4.008) − 12 (0.7351 0.1333 1. 3.1988 0.0496 1.008) + 15 (0.8978 0.2 3.0441 0. we obtain 1 0. Geometrically.2 ≈ 3. Thus the integral becomes Z xn I= y(x)dx.0552 0.0014)   (i) y ′ (1.1627 0. b] into n subintervals such that a = x0 < x1 < x2 < · · · < xn = b where xn = x0 + nh.4 4. we divide the interval [a.0535 0.0361 0. x y ∆ ∆2 ∆3 ∆4 ∆5 ∆6 1.2429 0.13) a where y(x) is a function given analytically by a formula or empirically by a table of values.0361) − 14 (0.2 9.3395 0.2) = 0.6018 1.3203 1 11 10   (ii) y ′′ (1.3891 1.0014)) ≈ 3.0966 0. the integral is the area under the graph of y(x) between a and b.0 2. x0 41 .2)2 0.9530 0.2) = (0.8 6.0 7.7351 − 12 (0.0294 1.1627 − 0.7183 1.0250 1.3 Numerical Integration Numerical integration refers to the evaluation of the integral Z b I= y(x)dx (3.0014 0.3201 0. To determine this area.3192.0067 2.2964 0.0361 + 12 (0.

xn ] as Z x2 h y(x)dx = [y1 + y2 ] x1 2 . 3.15) which on simplification yields Z xn n(n − 2)2 3   n n(2n − 3) 2 y(x)dx = nh y0 + ∆y0 + ∆ y0 + ∆ y0 + · · · x0 2 12 24 (3. all differences higher than the first become zero and one obtains x1   1 Z h y(x)dx = h y0 + ∆y0 = [y0 + y1 ] x0 2 2 Similarly. 3.14) Since x = x0 + ph. [xn−1 .14) becomes Z n  p(p − 1) 2 p(p − 1)(p − 2) 3 I=h y0 + p∆y0 + ∆ y0 + ∆ y0 + · · · dp 0 2! 3! (3. dx = hdp and so the integral (3.1 The Trapezoidal Rule Putting n = 1 into (3. Z xn h y(x)dx = [yn−1 + yn ] xn−1 2 42 .Approximating y(x) by Newton’s forward difference interpolating formula leads to the integral Z xn   p(p − 1) 2 p(p − 1)(p − 2) 3 I= y0 + p∆y0 + ∆ y0 + ∆ y0 + · · · dx x0 2! 3! (3. x2 ].3.16) Equation (3. We derive from this general formula a few important numerical integration formulae such as the trapezoidal and Simpson’s rules. we deduce for the remaining intervals [x1 . · · · . ..16).16) is a general formula from which one can obtain different integra- tion formulae by putting n = 1. · · · . 2.

yn ).19) 2 4 From (3.18) 2 6 In a similar vein. we obtain the errors in the remaining subintervals [x1 . · · · . we obtain the formula Z xn h y(x)dx = [y0 + 2y1 + 2y2 + 2y3 + · · · + yn ] (3.Combining these integrals.17) x0 2 which is normally referred to as the trapezoidal rule. y1 ) and (x2 .(x1 . h2 ′′ h3 ′′′   h h ′ [y0 + y1 ] = y0 + y0 + hy0 + y0 + y0 + · · · 2 2 2 6 2 h h3 = hy0 + y0′ + y0′′ + · · · (3. [xn−1 . y2 ). The geometrical interpreta- tion of this rule is that the curve y = f (x) is replaced by n straight lines joining the points (x0 .2 Error bounds and estimate for the Trapezoidal Rule The error of the trapezoidal formula can be estimated as follows: Let y = f (x) be continuous and many times differentiable in [x0 . The area bounded by the curve y = f (x).3. we get Z xn Z xn  (x − x0 )2 ′′  ′ f (x)dx = y0 + (x − x0 )y0 + y0 + · · · dx x0 x0 2! h2 h3 = hy0 + y0′ + y0′′ + · · · (3. x2 ]. hence the name of the formula. xn ]. xn ]. x3 ]. y1 ). the ordinates x = x0 and x = xn and the x−axis is then approximately equivalent to the sum of the areas of the n trapeziums obtained [see fig. [x2 . y0 ) and (x1 .(xn−1 . 43 .18) and (3.]. x1 ]. Thus expanding f (x) in Taylor series about x = x0 . Continuing in a similar way. yn−1 ) and (xn .19) we obtain Z xn h h3 f (x)dx − [y0 + y1 ] ≈ − y0′′ + · · · (3.· · · .20) x0 2 12 which is the error in the interval [x0 . 3.

we get h3 ′′ (b − a) 2 ′′ ǫ≈− ny (x̄) ≈ − h y (x̄) (3. 3. x6 ] · · · .3. [xn−2 .3 Simpson’s Rule To obtain Simpson’s rule. one obtains Z x4 h y(x)dx = [y2 + 4y3 + y4 ] x2 3 Z x6 h y(x)dx = [y4 + 4y5 + y6 ] x4 3 .Summing all these. otherwise called Simpson’s 13 -rule. in the interval of integration. Simpson’s 13 -rule can easily be obtained from (3.22) 12 12 where nh = b − a. Z xn h y(x)dx = [yn−2 + 4yn−1 + yn ]. xn−2 3 44 .16) by substituting n = 2. Error bounds can now be obtained by taking the largest value for y ′′ (x̄).. hence KML ≤ ǫ ≤ KMU . for the remaining intervals [x2 . one obtains the error ǫ as h3 ′′ ǫ≈− [y + y1′′ + y2′′ + · · · + yn−1 ′′ ] (3. . xn ]. say MU and the smallest value ML . where K = − b−a 12 h2 . This leads to the relation Z x2   1 2 h y(x)dx = 2h y0 + ∆y0 + ∆ y0 = [y0 + 4y1 + y2 ] (3. x4 ].21) 12 0 Taking y ′′ (x̄) as the largest value of the n quantities on the right hand side of (3.21).23) x0 6 3 Similarly. [x4 . Thus. we need to divide the interval of integration a ≤ x ≤ b into an even number of subintervals n = 2m.

25) 3h = [y0 + 3y1 + 3y2 + y3 ] 8 Computing the integrals for the remaining subintervals [x3 . we obtain the composite Simpson’s 13 -rule as Z xn h y(x)dx = [y0 + 4y1 + 2y2 + 4y3 + 2y4 + · · · + 2yn−2 + 4yn−1 + yn ] x0 3 (3. Using the Trapezoidal. we 45 .125. the composite Simpson’s 38 -rule as xn 3h Z y(x)dx = [y0 + 3y1 + 3y2 + 2y3 + 3y4 + 3y5 + 2y6 + · · · + 2yn−3 + 3yn−2 + 3yn−1 + yn ] x0 8 (3. [x6 . xn ].4 Simpson’s 38 -Rule The scheme is obtained from (3. 0. Simpson’s 13 .and 38 -rules for h = 0.3. 3. · · · . thus yielding Z x3   3 3 2 1 3 y(x)dx = 3h y0 + ∆y0 + ∆ y0 + ∆ y0 x0 2 4 8 (3.25 and 0. x6 ].16) by substituting n = 3.5. hence it is rarely used for computations. Example 15 R1 dx Evaluate I = 0 1+x2 . x9 ].26) Simpson’s 83 -rule has the error term 3 5 (4) ǫ≈− h f (x̄) 80 and it is much less accurate than the Simpson’s 13 -rule. correct to 4 places of decimals. [xn−3 .Summing the above integrals.24) Simpson’s 13 -rule has the error term (b − a) 4 (4) ǫ≈− h f (x̄) 180 and it is highly accurate for most problems.

71910 0.80000 + 0.50000 (i) Using Trapezoidal rule.25 I= [1.94118 0.80000) + 0.78539 3 (c) h = 0.80000 0.64000 0. The tabulated data become x 0 0.64000) + 2(0.87671+0.5.94118+0.98452+0.125 0.50000) = 0.80000 0.00000 0.00 y 1.500+2(0.56637 0.0 y 1.00000 0.375 0.80000 + 0.80000 0.500 0. one obtains 0.125.78333 3 (b) h = 0.6400+0.87671 0.125 I= [1. The values are tabulated below x 0 0.875 1.25.5 1.5 I= (1.00000 0.78474 2 (ii) Simpson’s 13 -rule yields 46 .77500 2 (ii) Simpson’s 13 -rule yields 0.25 I= [1.94118 0.00000 + 4(0.94118 + 0.64000 0.25 0.000 y 1.00000 + 4 × 0. The values are tabulated thus x 0 0.78280 2 (ii) Simpson’s 13 -rule gives 0.5 I= (1.50000] = 0.50 0.80000 + 0.71910+0.50000 (i) Trapezoidal rule yields 0.64000) + 0.50000 (i) Trapezoidal rule yields 0.00000 + 2 × 0.75 1.00000 + 2(0.56637)] = 0.50000) = 0.98452 0.94118 + 0.50000] = 0.750 0.have the following results: (a) h = 0.250 0.625 0.8000+0.

037901) = 0.697676 4 0.367879 + 2 × 3.50000+3(0.000000 1 0.71910 + 0.375 (iii) I = 8 [1.80000+0.0 1.64000)] = 0.367879 Σ 1.2 I= (1.50000 + 4(0. thus 0.87671 + 0.94118+0.98452+0.2.744368. Note that the exact solution correct to 5 places of decimals is I ≈ 0. Solution: 2 n xn x2n f (xn ) = e−xn 0 0 0 1. 2 47 .94118 + 0.8 0.2 0.71910)+ 2(0.6 0.80000 + 0.04 0.16 0.56637)+3(0.78538 Simpson’s 83 -rule can now be applied to obtain 0.125 I= 3 [1.78540. using (i) Trapezoidal rule with n = 5 (ii) Trapezoidal rule with n = 10 (iii) Simpson’s 13 -rule with n = 10 (iv) Simpson’s 38 -rule with n = 10.64 0.36 0.64000)] = 0. 0.037901 (i) Note that h = 0.960789 2 0.852144 3 0.98452 + 0.56637) + 2(0.527292 5 1.367879 3.77657.00 0. Example 16 R1 2 Evaluate the integral I = 0 e−x dx.4 0.87671 + 0.

0.00 0.000000 1 0.8 0.367879 6.3 0.527292 9 0.49 0.9 0.2 0.612626 8 0. 2 n xn x2n f (xn ) = e−xn 0 0 0 1.852144 5 0.266882 + 2 × 2.4 0.960789 3 0.367879 Σ 1.0 1.01 0.037901) = 0. 3 (iv) Simpson’s 83 -rule produces 0.7 0.36 0.09 0.367879 + 3 × 2.736722.367879 + 2 × 6.740266 + 2 × 3.1.64 0.1 0.056465) = 0.913931 4 0.778167) = 0.746211.25 0.1 I= (1.367879 + 4 × 3. thus 0.746825.3 I= (1. 8 48 .1 I= (1.16 0.6 0.444858 10 1.81 0.45482 + 3 × 2.778167 (ii) Here. h = 0.778801 6 0.5 0.99050 2 0. 2 (iii) For Simpson’s 31 -rule.697676 7 0.04 0.