Kathmandu 16
Numerical Methods
Puskar R. Pokhrel
Sagarmatha Engineering College,
TU Nepal
16. November 2016
Kathmandu 16
2. Solution of Non-linear
Equation
Puskar R. Pokhrel Numerical Methods 2/ 22
Kathmandu 16
Solution of Non-linear Equations
Polynomial function of degree n :
n
X
f (x) = ak x k = a0 + a1 x + a2 x 2 + + an1 x n1 + an x n ,
k=0
where a0 , a1 , a2 , , an are real constants and n is a positive integer
with an 6= 0, is called a polynomial in x of degree n.
Polynomial equation of degree n:
If f (x) = 0, then it is polynomial equation in x of degree n,
x 2 + x = 1, x 3 4x 2 + x + 6 = 0, x 6 2x 2 x = 0.
Transcendental equation:
If f (x) contains trigonometric, logarithmic, exponential, then f (x) = 0 is
called transcendental
equation.
x
x + sin x = 0, e + x cos x = , x log10 x 1.9 = 0.
Puskar R. Pokhrel Numerical Methods 3/ 22
Kathmandu 16
Abbildung: The graph of f (x) = 0
Puskar R. Pokhrel Numerical Methods 4/ 22
Kathmandu 16
Some Useful Observations
1 If the value of x = satisfies the equation f (x) = 0, then is called a
root of f (x) = 0
2 If x divides f (x), then is a root of f (x) = 0
3 If f (x) = (x )m g (x) = 0, where g (x) is bounded and g () 6= 0, then
is called a multiple root of order m
4 The total number of roots of an algebraic equation can have same as its
degree
5 An algebraic equation can have at most as many positive roots as the
number of changes of sign in f (x)
6 An algebraic equation can have at most as many negative roots as the
number of changes of sign in f (x)
Puskar R. Pokhrel Numerical Methods 5/ 22
Kathmandu 16
Some Useful Observations
1 In an algebraic equation with real coefficients, complex roots occur in
conjugate pairs
2 If f (x) = an x n + an1 x n1 + + a1 x + a0 with roots
1 , 2 , , n , then the following hold good
X an1
i = ,
an
i
X an2
i j = ,
an
i<j
Y a0
i = (1)n .
an
i
3 If f (x) is continuous in the interval [a, b] and f (a)f (b) < 0, then a root
must exist in the interval (a, b)
Puskar R. Pokhrel Numerical Methods 6/ 22
Kathmandu 16
Methods for Solving Non-linear equations
Analytical Method,
Graphical Method,
Trial and Error Method,
Iterative Method.
Puskar R. Pokhrel Numerical Methods 7/ 22
Kathmandu 16
Methods for Solving Non-linear equations
Analytic Method:
Analytical approach to solve the non -linear equations do not exist except
for certain simple cases,
is ax 2 + bx+ c = 0, a 6= 0 can be solved analytically
b b 2 4ac
x= ,
2a
cos x + x = 0 that cannot be solved analytically,
Graphical Method:
Graphical methods are also used to find an approximate value of the root,
This method involves plotting the given function and determining the
points where it crosses the axis of x.
Trial and Error Method:
Trial and error methods involve a series of guess for x,
Each time evaluating the function to see whether it is close to zero
Puskar R. Pokhrel Numerical Methods 8/ 22
Kathmandu 16
Iterative Method
Begin with an approximate value of the root known as the initial guess,
which is then successively corrected by iterations
The process of iterations comes to the end when the desired level of
accuracy is obtained
Bracketing method:
Bisection method
Regula Falsi or False position method.
Open end method
Newton-Raphson method
Secant method
Fixed point iteration method.
Definition
An iterative method has the rate of convergence p, if p is the largest positive
real number for which there exist a finite constant C 6= 0 such that
|k+1 | C |k |p , where k = xk .
Puskar R. Pokhrel Numerical Methods 9/ 22
Kathmandu 16
Bisection Method
Puskar R. Pokhrel Numerical Methods 10/ 22
Kathmandu 16
Bisection Method
One of the simplest bracketing method and most reliable of iterative
method for the solution of non -linear equations.
The basic idea of this method is to cut the interval of uncertainty in half
to each iterations.
This method is the application of Intermediate value theorem
Theorem
(Intermediate Value Theorem):If f (x) is real and continuous function in
the interval [a, b] with f (a) and f (b) are opposite signs, i. e. f (a) f (b) < 0,
then there exist at least one real root f (x) = 0 in the interval between a and
b
Puskar R. Pokhrel Numerical Methods 11/ 22
Kathmandu 16
Theorem
( Bisection Method) To find a real root of the equation f (x) = 0 using
bisection method
Abbildung: Illustration of Bisection Method.
Puskar R. Pokhrel Numerical Methods 12/ 22
Kathmandu 16
Bisection Method
If f (x) in C [a, b] with f (a) and f (b) are opposite signs, i. e.
f (a) f (b) < 0, one real root f (x) = 0 in the interval between a and b
a+b
the first approximate to the root is x0 =
2
If f (x0 ) = 0, then x0 is a root, and if f (x0 ) 6= 0, then there arises two
cases:
if f (a)f (x0 ) < 0, then there is a root between a and x0 ,
if f (x0 )f (b) < 0, then there is a root between x0 and b.
The new sub intervals [a, x0 ] or [x0 , b] and is exactly half of the the given
interval [a, b] and thus this method is also called half interval method.
This process can be continued until the interval containing the root is as
small as desired accuracy
This is illustrated in the figure 2.
Puskar R. Pokhrel Numerical Methods 13/ 22
Kathmandu 16
Bisection Algorithm
Step 1: Take initial values 0 a0 and 0 b
Step 2: Compute f (a) and f (b)
Step 3: If f (a) f (b) < 0, then continue else go to step 1
a+b
Step 4: Compute x0 = and f (x0 ) = f0
2
Step 5: If f (a) f (x0 ) < 0, then b = x0 else a = x0
Step 6: If |b a| < , then the root is (a + b)/2 else go to step 4
Step 7: Stop.
Puskar R. Pokhrel Numerical Methods 14/ 22
Kathmandu 16
Convergence of Bisection Method
If x0 is the mid-point of the interval [a, b], then
b x0 = b (a + b)/2 = (b a)/2,
If x1 is the approximate to the root, x1 is the mid point of the interval
[x0 , b], then (b a)/22 ,
If n iterations are performed, then a root lies within the interval of
length en = (b a)/2n
Let the given a positive error tolerance ,
ba
en = ,
2n
ba
or log log ,
2n
Puskar R. Pokhrel Numerical Methods 15/ 22
Kathmandu 16
Convergence of Bisection Method
PPPPPPPPPPP log(b a) log 2n log
or log(b a) log 2n log ,
or log(b a) log n log 2,
log(b a) log
n
log 2
|b a|
The error bound at nth iteration is en = .
2n
|b a| 1 |b a| 1
en+1 = = = en .
2n+1 2 2n 2
en+1 = (1/2)en . Thus, this method converges linearly.
Puskar R. Pokhrel Numerical Methods 16/ 22
Kathmandu 16
Find a root of the equation x 3 4x 9 = 0 using bisection method
correct to three decimal places 2068, Chaitra, B. E., IOE
Here, the equation is f (x) = x 3 4x 9 = 0.
f (2) = 8 8 9 = 9, f (3) = 27 12 9 = 6,
f (2) f (3) = 9 6 = 54 < 0.
Hence, the root lies between 2 and 3.
2+3
The first approximation to the root is x0 = = 2.5.
2
f (x0 ) = f (2.5) = (2.5)3 4(2.5) 9 = 3.375 < 0,
f (x0 )f (b) = f (2.5)f (3) = (3.375) 6 = 20.25 < 0, then the root
lies between 2.5 and 3.
The second approximation to the root is x1 = 2.5+3
2 = 2.75 Similarly, the
approximations to the root are as the following table and the root is
shown as in the figure ?? (a).
Puskar R. Pokhrel Numerical Methods 17/ 22
Kathmandu 16
Abbildung: Table of Bisection Method.
Puskar R. Pokhrel Numerical Methods 18/ 22
Kathmandu 16
Find at least one root of x 3 2x 5 = 0 with accuracy of 0.08%, using
bisection method 2067 Ashadh, B. E., IOE
Here f (x) = x 3 2x 5 = 0. Taking a = 2 and b = 3, and
= 0.08% = 0.0008, then
f (2) = 8 4 5 = 1, f (3) = 27 6 5 = 16,
f (2)f (3) = 1 16 = 16 < 0.
Hence, the root lies between 2 and 3. The first approximation to the
root is x0 = 2+3
2 = 2.5
f (x0 ) = f (2.5) = (2.5)3 2(2.5) 5 = 5.625,
f (a)f (x0 ) = f (2)f (2.5) = (1) 5.625 = 5.625 < 0,
then the approximation to the root lies between 2 and 2.5.
The second approximation to the root is x1 = 2+2.5
2 = 2.25. Similarly,
the approximations to the root are in the following table and shown in
the figure
Puskar R. Pokhrel Numerical Methods 19/ 22
Kathmandu 16
Abbildung: Table of Bisection Method.
Puskar R. Pokhrel Numerical Methods 20/ 22
Kathmandu 16
Abbildung: Table of Bisection Method.
Puskar R. Pokhrel Numerical Methods 21/ 22
Kathmandu 16
Exercise
Find a root of the equation cos x = xe x using bisection method correct
to four decimal places
root = 0.5178
Find an approximate root of the equation x sin x 1 = 0 that lies
between x = 1 and x = 1.5 (measured in radians) using bisection
method carry out computations up to the 7th stage root =1.1133
Find a positive real root of the equation x log10 x = 1.9 using bisection
method
root = 3.4961
Find the root of the equation e x 3x = 0 correct up to three decimal
places using bisection method 2068 Baishakh IOE
root = 0.6191
Estimate at least two possible real roots of the following nonlinear
equation using bisection method up to two decimal points
sin x x 2 x + 1 = 0 2064 Jestha, B. E., IOE
Puskar R. Pokhrel Numerical Methods 22/ 22