Professional Documents
Culture Documents
ComputationalMathematics - Chapter 5 PDF
ComputationalMathematics - Chapter 5 PDF
Contents
1 Numerical Methods 2
1.1 Solution of Algebraic and Transcendental Equations . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Bisection Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Secant Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Newton-Raphson Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.5 Solution of linear system equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5.1 Gauss Elimination (Direct method) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5.2 Gauss-Seidel method(Iterative method) . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.6 Rayleigh’s Power method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.7 Numerical Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.7.1 Finite differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.8 Newton-Cotes quadrature formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.8.1 Trapezoidal Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.8.2 Simpson’s one-third rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.8.3 Simpson’s three-eighth rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.9 Numerical Solutions of First order ordinary differential equations . . . . . . . . . . . . . . . 13
1.9.1 Tayor series method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.9.2 Runge-Kutta method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1
Numerical Methods
1. Numerical Methods
f (x) = 0.
We have algebraic formulas, to express the roots in terms of the coefficients, if f (x) is a quadratic, cubic
or a bi-quadratic expression.
Algebraic functions of the form
1. Every polynomial equation of the nth degree has n and only n roots.
2. If n is odd, the polynomial equation has atleast one real root whose sign is opposite to that of the
last term.
3. If n is even and the constant term is negative, then the equation has atleast one positive root and
atleast one negative root.
• A polynomial equation f (x) = 0 cannot have more number of positive real roots than the
number of changes of sign in the coefficients of f (x).
• In the above point, f (x) = 0 cannot have more number of negative real roots than the number
of changes of sign in the coefficients of f (− x).
Theorem 1.1 (Intermediate Value Theorem). If f (x) is continuous in [a, b], and if f (a) and f (b) are of
opposite signs, then f (ξ) = 0 for at least one number ξ such that a < ξ < b.
Lecture Notes 2
1.2 Bisection Method
1. Choose two real numbers a and b such that f (a) f (b) < 0
a+ b
2. Set xr = 2 .
3. Now,
• if f (a) f (xr ) < 0, then the root lies in the interval (a, xr ). Then, set b = xr and go to step 2
above.
• if f (a) f (xr ) > 0, then the root lies in the interval (xr , b). Then, set a = xr and go to step 2.
• if f (a) f (xr ) = 0, it means that xr is a root of the equation f (x) = 0 and the computation may
be terminated.
Practically, the roots may not be exact so that the third condition in step 3 is never satisfied. In such
a case, we bisect the interval as before and continue the process until the root is found to the desired
accuracy.
Exercise 1.3. Find a real root of the equation f (x) = x3 + x2 + x + 7 = 0 correct to three decimal places.
Exercise 1.4. Find the positive root between 0 and 1 of the equation x = e− x correct to 3 decimal places.
Lecture Notes 3
1.3 Secant Method
Exercise 1.5. Find a root, correct to 3 decimal places and lying between 0 and 0.5 of the equation
4e− x sinx − 1 = 0.
Exercise 1.7. Find a root, correct to 3 decimal places of the equation 5x log10 x − 6 = 0.
Exercise 1.8. Find a root, correct to 3 decimal places of the equation x2 + x − cosx = 0.
f (x) = a 0 x + a 1 = 0 (1.2)
−a 1
x= (1.3)
a0
where a 0 ̸= 0 and a 1 are arbitrary parameters to be determined by prescribing two appropriate
conditions on f (x) and/or its derivatives.
If xk and xk−1 are two approximations to the root, then a 0 and a 1 are found using the conditions,
f (xk−1 ) = a 0 xk−1 + a 1 ,
f (xk ) = a 0 xk + a 1 .
On solving, we get,
f (xk ) − f (xk−1 )
a0 =
xk − xk−1
and
xk f (xk−1 ) − xk−1 f (xk )
a1 = (1.4)
xk − xk−1
From equations (5.3) and (5.4), the next approximation xk+1 is given by
xk − xk−1
xk+1 = xk − f (xk ).
f (xk ) − f (xk−1 )
This is called the secant or the chord method.
Exercise 1.9. Use secant method to determine the root of the equation, cosx − xe x = 0.
Lecture Notes 4
1.4 Newton-Raphson Method
Exercise 1.10. Use secant method to determine a real root of the equation, x3 − 2x − 5 = 0.
Exercise 1.11. Use secant method to determine a real root of the equation, xe x − 1 = 0.
Exercise 1.12. Use secant method to determine the root, between 5 and 8, of the equation, x2.2 = 69.
Exercise 1.13. Use secant method to determine a real root of the equation, x = e− x .
Exercise 1.14. Use secant method to determine a real root of the equation, 3x + sinx − e x = 0 to an
accuracy of 4 decimal places.
Exercise 1.15. Use secant method to determine a real root of the equation, x4 − x − 10 = 0.
Exercise 1.16. Use secant method to determine a real root of the equation, x − e− x = 0.
Exercise 1.17. Use secant method to determine a real root of the equation, e− x (x2 − 5x + 2) − 1 = 0.
Exercise 1.18. Use secant method to determine a real root of the equation, x − sinx − 12 = 0.
Exercise 1.19. Use secant method to determine a real root of the equation, e− x = 3 log x.
h2 ′′
f (x0 ) + h f ′ (x0 ) + f (x0 ) + ... = 0.
2!
f (x0 ) + h f ′ (x0 ) = 0,
which gives
f (x0 )
h=− .
f ′ (x0 )
Successive approximations are given by x2 , x3 , ..., xn+1 , where
f (xn )
xn+1 = xn − .
f ′ (xn )
Exercise 1.21. Use Newton-Raphson method to determine a root of the equation, xsinx + cosx = 0.
x
Exercise 1.23. Use Newton-Raphson method to determine a root of the equation, sinx = 2 correct to 3
π
decimal places given that the root lies between 2 and π.
Lecture Notes 5
1.5 Solution of linear system equations
Exercise 1.24. Use Newton-Raphson method to determine a root of the equation, 4e− x sinx − 1 = 0 correct
to 3 decimal places given that the root lies between 0 and 0.5.
Exercise 1.25. Use Newton-Raphson method to compute a real root of the equation, x2 + 4sinx = 0.
Exercise 1.26. Use Newton-Raphson method to derive a formula for finding the kth root of a positive
1
number N and hence compute the value of 25 4 .
Exercise 1.27. Use Newton-Raphson method to determine a root of the equation, x sin2 − 4 = 0 correct to
3 decimal places.
Exercise 1.28. Use Newton-Raphson method to determine a root of the equation, e x = 4x correct to 3
decimal places.
Exercise 1.29. Use Newton-Raphson method to determine a root of the equation, x3 − 5x + 3 = 0 correct
to 3 decimal places.
Exercise 1.30. Use Newton-Raphson method to determine a root of the equation, xe x = cosx correct to 3
decimal places.
1+ cosx
Exercise 1.31. Use Newton-Raphson method to determine a root of the equation, x = 3 correct to 3
decimal places.
Exercise 1.32. Use Newton-Raphson method to determine a root of the equation, cotx = − x correct to 3
decimal places.
a 11 x1 + a 12 x2 + · · · + a 1n xn = b1
a 21 x1 + a 22 x2 + · · · + a 2n xn = b2
a n1 x1 + a n2 x2 + · · · + a nn xn = bn
Lecture Notes 6
1.5 Solution of linear system equations
−a 21
To eliminate x1 from the second equation of (1.5), we multiply the first equation by a 11 and add it
to second equation, we obtain
¡ a 21 ¢ ¡ a 21 ¢ ¡ a 21 ¢ a 21
a 22 − a 12 x2 + a 23 − a 13 x3 + · · · + a 2 n − a 1 n xn = b 2 − b 1 ,
a 11 a 11 a 11 a 11
In a similar fashion, we can eliminate x1 from the remaining equations and after eliminating x1 from
the last equation of (1.5), we obtain the system
a 11 x1 + a 12 x2 + a 13 x3 + · · · + a 1n xn = b1
We next eliminate x2 from the last (n − 2) equations of the system (1.6). Now to eliminate x2 from
−a′32
the third equation of (1.6), we multiply the second equation by a′22
and add it to the third equation.
Repeating this process with remaining equations, we obtain the system
a 11 x1 + a 12 x2 + a 13 x3 + · · · + a 1n xn = b1
In equation (1.7), the “double primes" indicate that the elements have changed twice. It is easily seen
that this procedure can be continued to eliminate x3 from the fourth equation onwards, x4 from the fifth
equation onwards etc. till we finally obtain the upper-triangular form:
a 11 x1 + a 12 x2 + a 13 x3 + · · · + a 1n xn = b1
Lecture Notes 7
1.5 Solution of linear system equations
Step 2: We now have to obtain the required solution from the system (1.8). From the last equation of
the system, we obtain
b(nn−1)
xn = n−1)
a(nn
This is then substituted in the (n − 1)th equation to obtain xn−1 and the process is repeated to compute
the other unknowns by back substitution.
Use Gauss elimination method to solve the following system of equations
1. x1 + 2x2 − x3 = 2
3x1 + 6x2 + x3 = 1
3x1 + 3x2 + 2x3 = 3
2. 2x1 + x2 + x3 = 10
3x1 + 2x2 + 3x3 = 18
x1 + 4x2 + 9x3 = 16
3. 10x − y + 2z = 4
x + 10y − z = 3
2x + 3y + 20z = 7
a 11 x1 + a 12 x2 + · · · + a 1n xn = b1
a 21 x1 + a 22 x2 + · · · + a 2n xn = b2
a n1 x1 + a n2 x2 + · · · + a nn xn = bn
In which the diagonal elements a ii do not vanish and large compared to other co-efficients in the equa-
tion. If this is not the case, then equations should be arranged so that this condition is satisfied. Now
we rewrite the system (1.9) as
b 1 a 12 a 13 a 1n
x1 = − x2 − x3 − · · · − xn
a 11 a 11 a 11 a 11
b 2 a 21 a 23 a 2n
x2 = − x1 − x3 − · · · − xn
a 22 a 22 a 22 a 22
··· ··· ··· ··· ··· ··· ··· (1.10)
bn a n1 a n2 a n(n−1)
xn = − x1 − x2 − · · · − xn−1
a nn a nn a nn a nn
Lecture Notes 8
1.6 Rayleigh’s Power method
1. 6x + y + z = 20
x + 4y − z = 6
x − y + 5z = 7
2. 2x − y = 7
− x + 2y − z = 1
− y + 2z = 1
3. 10x + 2y + z = 9
2x + 20y − 2z = −44
− 2x + 3y + 10z = 22
Lecture Notes 9
1.7 Numerical Integration
|λ1 | > |λ2 | > · · · > |λn |. To find |λ1 | follow the following method Let v0 be the initial eigen vector. Find
Av0 = y1 = m 1 v1 , where m 1 is the largest element in magnitude of y1
Av1 = y2 = m 2 v2
.
.
.
Avk = y + k + 1 = m k+1 vk+1
As k → ∞, m k+1 → |λ1 | and vk+1 is the corresponding eigen vector. The process is repeated till we get
numerically largest eigen value of desired degree of accuracy. The initial vector is usually chosen as a
1 1
vector v0 =
1 , 0.
1 0
Find the numerically largest eigen value and the corresponding eigen vectors using Rayleigh’s power
method for the following matrices
−15 4 3
1.
10 −12 6
20 −4 2
1 6 1
2.
1 2 0
0 0 3
2 −1 0
3.
−1 2 −1
0 −1 2
Before visiting Newton-Cotes quadrature formula, let us look into some of the basic important notions.
Lecture Notes 10
1.8 Newton-Cotes quadrature formula
where ∆ is called the forward difference operator and ∆ y0 , ∆ y1 , ..., are called first forward differ-
ences. The differences of the first forward differences are called second forward differences and are
denoted by ∆2 y0 , ∆2 y1 , ... Similarly, one can define third forward differences, fourth forward differences,
etc. Thus,
∆2 y0 = ∆ y1 − ∆ y0 = y2 − y1 − (y1 − y0 ) = y2 − 2y1 + y0 ,
Backward differences: The differences y1 − y0 , y2 − y1 , ..., yn − yn−1 are called first backward differ-
ences if they are denoted by ∇ y1 , ∇ y2 , ..., ∇ yn respectively, so that
∇ y1 = y1 − y0 , ∇ y2 = y2 − y1 , ..., ∇ yn = yn − yn−1 ,
where ∇ is called the backward difference operator. In a similar way, one can define backward
differences of higher orders. Thus we obtain,
∇2 y2 = ∇ y2 − ∇ y1 = y2 − y1 − (y1 − y0 ) = y2 − 2y1 + y0
Note: Given a set of n + 1 values, viz., (x i , yi ), i = 0, 1, 2, .., n of x and y, it is required to find yn (x), a
polynomial of the nth degree such that y and yn (x) agree at the tabulated points. Let the values of x be
equidistant i.e., let
x i = x0 + ih, i = 0, 1, 2, ..., n.
Lecture Notes 11
1.8 Newton-Cotes quadrature formula
Lecture Notes 12
1.9 Numerical Solutions of First order ordinary differential equations
1. Trapezoidal Rule
Exercise 1.37. Find, from the following table, the area bounded by the curve and the x-axis from x = 7.47
to x = 7.52
x f(x) x f(x)
If y(x) is the exact solution of equation (1.14) then by taylor series expansion about x0 , we get
(x − x0 )2 ′′ (x − x0 )3 ′′′
y(x) = y0 + (x − x0 )y0′ + y0 + y0 + − − − − −
2! 3!
Where y0 = y(x0 )
y0′ = f (x0 , y0 )
y0′′ = f x (x0 , y0 ) + f y (x0 , y0 )y0′
y0′′′ = f xx (x0 , y0 ) + f x y (x0 , y0 )y0′ + f yx (x0 , y0 )y0′ + f yy (x0 , y0 )y0′2 + f y (x0 , y0 )y0′′
Lecture Notes 13
1.9 Numerical Solutions of First order ordinary differential equations
Exercise 1.38. From the Taylor series for y(x) find y(0.1) correct to four decimal places, if y′ = x −
y2 , y(0) = 1.
Exercise 1.39. Find by Taylor series method the value of y at x = 0.1 and x = 0.2 correct to 5 decimal
dy
placces. Given dx = x2 y − 1, y(0) = 1.
Exercise 1.40. Find y at x = 0.2 by Tayolor series method. Given y′ = log(x y), y(1) = 2.
Exercise 1.41. Apply Runge-Kutta method, to find an approximate value of y when x = 0.2 given that
dy
dx = x + y, y(0) = 1
dy y2 −2 x
Exercise 1.42. Given that dx = y2 + x
and y = 1 at x = 0. Find y for x = 0.1, 0.2 using Runge-Kutta
method.
dy 3 x+ y
Exercise 1.43. Use Runge-Kutta method to find y at x = 1.1, given dx = x+2 y and y(1) = 1.
****END****
Lecture Notes 14