0% found this document useful (0 votes)
17 views2 pages

Nonlinear Equation Solving Using Bisection Method

Uploaded by

Aziz Reza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Nonlinear Equation Solving Using Bisection Method

Uploaded by

Aziz Reza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.1 Experiment No.

: 02
1.2 Experiment Name

Nonlinear equation solving using Bisection Method

1.3 Objectives:
i) To gain knowledge about bisection method.
ii) To solve a nonlinear equation using bisection method.

1.4 Theory

The bisection method is used to find the roots of a polynomial equation. It separates the interval and
subdivides the interval in which the root of the equation lies. The principle behind this method is the
intermediate theorem for continuous functions. It works by narrowing the gap between the positive and
negative intervals until it closes in on the correct answer. This method narrows the gap by taking the
average of the positive and negative intervals. It is a simple method and it is relatively slow. The
bisection method is also known as interval halving method, root-finding method, binary search method
or dichotomy method.

To solve bisection method problems, given below is the step-by-step explanation of the working of the
bisection method algorithm for a given function f(x):

Step 1:Choose two values, a and b such that f(a) > 0 and f(b) < 0 .

Step 2:Calculate a midpoint c as the arithmetic mean between a and b such that c = (a + b) / 2. This is
called interval halving.

Step 3:Evaluate the function f for the value of c.

Step 4:The root of the function is found only if the value of f(c) = 0.

Step 5:If (c) ≠ 0, then we need to check the sign:we replace a with c if f(c) has the same sign as f(a)
and we keep the same value for bwe replace b with c if f(c) has the same sign as f(b), and we keep the
same value for a.

To get the right value with the new value of a or b, we go back to step 2 And recalculate c.

1.5 Required software

MATLAB

1.6 MATLAB CODE

A nonlinear equation f=x.^2-4*x-10

clc
clear all
f=@(x)x.^2-4*x-10;
x1=5;
x2=6;
e=0.001;
i=0;
fprintf(' Bisection Method\n\n\nIteration No.
Roots');
while abs(x1-x2)>e,
x=(x1+x2)/2;
if f(x)>0
x2=x
else
x1=x;
end
i=i+1;
fprintf('\n %.2f %.8f',i,x);
end
fprintf('\nThe root of the equation is %.8f',x)

1.7 Output

Bisection Method

Iteration No. Roots


1.00 5.50000000
x2 =

5.7500

2.00 5.75000000
3.00 5.62500000
4.00 5.68750000
5.00 5.71875000
6.00 5.73437500
x2 =

5.7422

7.00 5.74218750
8.00 5.73828125
9.00 5.74023438
10.00 5.74121094
The root of the equation is 5.74121094>>

1.5 Discussion & Conclusion


From this experiment the nonlinear equation was solved using bisection method.The number of iteration
was 10.And the answered was 5.74121094 when the error was taken 0.001.So the solution was
determined using bisection method,the purpose of this experiment was full filled.

You might also like