Pages

Friday, September 18, 2015

Bisection Method to find the root of the non-linear equation


Bisection Method [Linear Convergence]

1)   Decide initial values for x1 and x2 and accuracy level E.
2)   Compute f1 = f(x1) and f2 = f(x2).
3)   If (f1*f2) > 0, x1 and x2 do not bracket any root and go to step number 7; otherwise continue.
4)   Compute x0 = (x2-x1)/ x2 and compute f0 = f(x0).
5)   If (f1 = f0) > 0
{
Set x1 = x0
Set f1 = f0
}
Otherwise
{
Set x2 = x0
}
            6)   If absolute value of (x2-x1)/ x2 < E
{
root = (x2-x1)/2 and write the value of root
go to step number 7.
}
Otherwise
{
go to step number 4.
}
            7)   Stop.

Example: Find the root of the equation x2-4x-10 = 0, where root lies between 5 and 6 using bisection method.
Soln: Here given, f(x) = x2-4x-10 and root lies between 5 and 6.
Step 1: Initial value for x1 = 5, x2 = 6 and accuracy level (error criteria) E = 0.01(you can assume yourself as per your need).
Step 2: Computing f1 and f2
            f1 = f(x1) = f(5) = 52-4*5-10 = 25 – 20 – 10 = -5
            f2 = f(x2) = f(6) = 62-4*6-10 = 36 -24 -10 = 2
Step 3: Checking Existence of root
            f1*f2 = -5*2 = -10
It shows that f1*f2 < 0. Thus required root of equation exists between 5 and 6.
Step 4: Iteration I:
                        Computing mid-point x0 = (x1+x2)/2 and compute f0 = f(x0).
                        x0 = (5+6)/2 = 11/2 = 5.5
                        f0 = f(5.5) = (5.5)2 - 4*5.5 – 10 = -1.75
Step 5: Checking, where (left or right) root lays form mid-point?
            f1 * f0 = -5 * -1.75 = 8.75
            Here f1 * f0 > 0 so,
            x1 = x0 = 5.5 and f1 = f0 = -1.75
Step 6: Checking error criteria, absolute value of (x2-x1)/ x2 < E
                        (x2-x1)/x2 = (6-5.5)/6 = 0.0833
                        Or 0.0833 < 0.01
                        Error criteria not satisfied. So go to step number 4.
            Iteration II:
                        Computing mid-point x0 = (x1+x2)/2 and compute f0 = f(x0).
                       
Repeat the iterations until error criteria satisfied.
If error criteria is satisfied then,
Compute root using,
               root = (x2-x1)/2 and write the value of root and stop.



No comments:

Post a Comment