Unit - III Numerical Methods Notes
Unit - III Numerical Methods Notes
Numerical Methods
Numerical methods are techniques to approximate mathematical procedures (e.g.,
integrals). Approximations are required because we either cannot solve the procedure
analytically (e.g., solving transcendental equations) or because the analytical method is
intractable (e.g., solving a set of a thousand simultaneous linear equations for a thousand
unknowns). By end of this chapter, students will be able to apply the numerical methods
for the following mathematical procedures and topics: Integration, solutions of
nonlinear equations and simultaneous linear equations, and first order ordinary
differential equations.
Root Finding:
One of the most common mathematical tasks we encounter is the need to solve
equations. That is to say, for some function f(x) and a value b, we wish to know for
which x it is true that f(x)=b.
In fact, this problem can be reduced to the special case of finding the values of x
for which a given function takes the value zero. Suppose we wish to solve f(x)=b. We
can simply define a new function g(x)= f (x) – b with the result that our problem is now
to solve g(x) = 0.
Quite a lot of the algebra which you learned at school is directed to solving this
problem for particular sorts of functions. For example, if g(x) is of the form 𝑎𝑥 2 + 𝑏𝑥 +
𝑐 then the quadratic formula can be used to solve g(x) = 0. However, for some functions
an algebraic solution may be difficult to find or may not even exist, or we might not
have an algebraic representation of our function at all! In these cases, how do we solve
the equation?
Intermediate Value Theorem: Suppose f(x) is any continuous function on a closed
interval [a, b] and if u is any number between f(a) and f(b) then there exist at least one
number c in [a, b] such that f(c)=u.
Consequently,
If f(x) is any continuous function on a closed interval [a, b] and if f(a) and f(b)
are of opposite signs then there exists a root x=c of f(x)=0 in [a, b].
This method consists in locating the roots of the equation f(x)=0 between a and
b. If f(x) is continuous between a and b, and f(a) and f(b) are of opposite signs then
there is a root between a and b.
For definiteness, let f(a) be negative and f(b) be positive. Then the first
𝑎+𝑏
approximation to the root is 𝑥1 = .
2
If 𝑓(𝑥1 ) = 0, then x1 is a root of f(x)=0. Otherwise, the root lies between a and
x1 or x1 and b according as f(x1) is positive or negative.
Then we bisect the interval as before and continue the proess until the root is
found to desired accuracy.
x1=1.5
Newton – Raphson Method:
Repeating this process, we approach to the root ξ quite rapidly. Hence the method consists
in replacing the part of the curve between the point A0 and the x-axis by means of the tangents
to the curve at A0.
Example 1: Find a root of 𝒆𝒙 𝐬𝐢𝐧 𝒙 = 𝟏 near x = 1 using Newton Raphson’s method.
Example 2. Find a real root of the equation 𝟑𝒙 − 𝐜𝐨𝐬 𝒙 − 𝟏 = 𝟎 using Newton
Raphson method.
Numerical Integration
The method of finding the value of an integral ݂ ሺ ݔሻ݀ ݔby using numerical techniques is called
“Numerical Integration”.
A definite integral of the form ݂ ሺ ݔሻ݀ ݔrepresents the area under the curve y = f(x) enclosed between
the limits x = a and x = b. This integration is possible only if f(x) is explicitly given and if it is
integrable.
The problem of numerical integration can be stated as, “Given a set of (n+1) points (xi, yi), i = 0, 1, 2,
௫
…, n for the function y = f(x) where f(x) is not known explicitly, it is required to evaluate ௫ ݂ ሺ ݔሻ݀ݔ.
బ
The problem of numerical integration is solved by replacing f(x) with an interpolating polynomial P n(x)
௫ ௫
and obtaining ௫ ܲ ሺ ݔሻ݀ ݔwhich is approximately taken as the value of ௫ ݂ ሺ ݔሻ݀ݔ.
బ బ
We have to understand that while analytical methods give exact answers, the numerical techniques
provide us only approximate answers.
ଵ
The integrals of some functions, like ܵ݅݊ ݔଶ ǡ ୪୬ ௫ ܽ݊݀ξͳ ݔସ , have no elementary formulas. When
we cannot find a workable integral for a function ƒ that we have to integrate, we can partition the
interval of integration, replace ƒ by a closely fitting polynomial on each subinterval, integrate the
polynomials, and add the results to approximate the definite integral of ƒ. This procedure is an example
of numerical integration. In this section we study two such methods, the Trapezoidal Rule and
Simpson’s Rule.
Trapezoidal Approximations
The Trapezoidal Rule for the value of a definite integral is based on approximating the region between
a curve and the x-axis with trapezoids instead of rectangles, as in Figure. It is not necessary for the
subdivision points ݔ ǡ ݔଵ ǡ ݔଶ ǡ ǥݔ in the figure to be evenly spaced, but the resulting formula is
ି
simpler if they are evenly spaced. We therefore assume that the length of each subinterval is ο ݔൌ
Using Trapezoidal and Simpson’s rules estimate the following integrals with n = 4 and n = 6
ଵ
1. ିଵሺ ݔଶ ͳሻ݀ݔ
2. ିଶሺ ݔଶ െ ͳሻ݀ݔ
ଶ ଵ
3. ଵ ݀ݏ
௦మ
ସ ଵ
4. ଶ ݀ݏ
ሺ௦ିଵሻమ
ଷ
5. ξ ݔ ͳ ݀ݔ
ଷ ଵ
6. ݀ݔ
ξ௫ାଵ
ଶ
7. ሺ ݔ ͳሻ ݀ݔ
ଵ
8. ିଵ ሺ ݔ ߨሻ ݀ݔ
Application Questions on Numerical Integration:
2. Wing design: The design of a new airplane requires a gasoline tank of constant cross-
sectional area in each wing. A scale drawing of a cross-section is shown here. The tank
must hold 5000 lb of gasoline, which has a density of 42 lb/ft3. Estimate the length of
the tank by Simpson’s Rule.
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
A number of numerical methods are available for the first order differential
dy
equations of the form: = f ( x, y ) , given y( x0 ) = y0 .
dx
Euler’s Method:
dy
Consider a first order differential equation = f ( x, y ) with y( x0 ) = y0 .
dx
the property that in a small interval, a curve is nearly a straight line. Thus at ( x0 , y0 ) , we
i.e., In the interval ( x0 , x1 ) we approximate the curve y(x) by the tangent line at
dy
( x0 , y0 ) whose slope is = f ( x0 , y0 )
dx ( x0 , y0 )
y − y0 = f ( x0 , y0 ) ( x − x0 ) .
(or) y1 = y0 + hf ( x0 , y0 ) h = x1 − x0
dy
curve y(x) by the tangent line at ( x1 , y1 ) whose slope is = f ( x1 , y1 ) .
dx ( x , y ) 1 1
(or) y2 = y1 + hf ( x1 , y1 ) h = x2 − x1
yn +1 = yn + hf ( xn , yn ) , n=0,1,2,…
This is the Euler’s method of finding the approximate solution of the equation
dy
= f ( x, y )
dx
Problems:
1) Solve by Euler’s method, y' = x + y, y(0) = 1 and find y(0.3) taking step size
h=0.1. Compare the result obtained by this method with the result obtained
analytically.
dy
2) Using Euler’s method, solve for y at x=2 from = 3x 2 + 1 , y(1)=2, taking step
dx
size (i) h = 0.5 and (ii) h = 0.25.
dy
Consider the first order differential equation = y = f ( x, y ) with the initial
dx
condition y( x0 ) = y0 .
To find y ( x1 ) = y1 at x = x1 = x0 + h :
We have y1(0) = y0 + hf ( x0 , y0 )
h
The first approximation of y1 is, y1(1) = y0 + f ( x0 , y0 ) + f ( x1 , y1(0) )
2
h
The second approximation of y1 is, y1(2) = y0 + f ( x0 , y0 ) + f ( x1 , y1(1) )
2
h
The third approximation of y1 is, y1(3) = y0 + f ( x0 , y0 ) + f ( x1 , y1(2) )
2
…
h
The nth approximation of y1 is, y1( n ) = y0 + f ( x0 , y0 ) + f ( x1 , y1( n −1) )
2
This process should be continued till two successive approximations are sufficiently
close to each other.
dy
Now we have = y = f ( x, y ) with the condition y ( x1 ) = y1 .
dx
To find y( x2 ) = y2 at x = x2 = x1 + h :
h
The first approximation of y 2 is, y2(1) = y1 + f ( x1 , y1 ) + f ( x2 , y2(0) )
2
h
The second approximation of y 2 is, y2(2) = y1 + f ( x1 , y1 ) + f ( x2 , y2(1) )
2
h
The third approximation of y 2 is, y2(3) = y1 + f ( x1 , y1 ) + f ( x2 , y2(2) )
2
h
The nth approximation of y 2 is, y2( n ) = y1 + f ( x1 , y1 ) + f ( x2 , y2( n −1) )
2
dy
Consider the first order differential equation = y = f ( x, y ) with y( x0 ) = y0 .
dx
To find y ( x1 ) = y1 at x = x1 = x0 + h :
1
y1 = y0 + ( K1 + 2K 2 + 2K3 + K 4 )
6
Where K1 = hf ( x0 , y0 )
h K
K 2 = hf x0 + , y0 + 1
2 2
h K
K3 = hf x0 + , y0 + 2
2 2
K 4 = hf ( x0 + h, y0 + K 3 )
dy
Now we have = y = f ( x, y ) with y ( x1 ) = y1 .
dx
To find y( x2 ) = y2 at x = x2 = x1 + h :
1
y2 = y1 + ( K1 + 2 K 2 + 2K3 + K 4 )
6
Where K1 = hf ( x1, y1 )
h K
K 2 = hf x1 + , y1 + 1
2 2
h K
K3 = hf x1 + , y1 + 2
2 2
K 4 = hf ( x1 + h, y1 + K 3 )