0% found this document useful (0 votes)
222 views7 pages

Solution of Algebraic and Transcendental Equation Using Bisection Method

The document describes using the bisection method to find approximate solutions to algebraic and transcendental equations. It provides the steps of the bisection method algorithm and then works through examples of applying the method to solve different equations. The key aspects are: 1) The bisection method iteratively narrows down the range that a root must lie in until reaching the desired accuracy. 2) Several examples apply the method to equations like x3 - 9x + 1 = 0 and xex = 1 to find approximate roots within given intervals and accuracy thresholds. 3) The method is demonstrated to converge on solutions to within 0.001 accuracy over multiple iterations for each example problem.

Uploaded by

Subhranil Sarkar
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)
222 views7 pages

Solution of Algebraic and Transcendental Equation Using Bisection Method

The document describes using the bisection method to find approximate solutions to algebraic and transcendental equations. It provides the steps of the bisection method algorithm and then works through examples of applying the method to solve different equations. The key aspects are: 1) The bisection method iteratively narrows down the range that a root must lie in until reaching the desired accuracy. 2) Several examples apply the method to equations like x3 - 9x + 1 = 0 and xex = 1 to find approximate roots within given intervals and accuracy thresholds. 3) The method is demonstrated to converge on solutions to within 0.001 accuracy over multiple iterations for each example problem.

Uploaded by

Subhranil Sarkar
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/ 7

Solution of algebraic and transcendental equation

using bisection method


Bishwajit Paul

January 14, 2019

1 Algorithm:
We can find the approximate root of an algebraic equation by the following steps

i Consider a continuous function f (x) that contains a zero (f (x) = 0 for any value of x) in
the interval [a : b].

ii First calculate the value of f (x) at the right end point b, that is, compute f (b).

iii Then calculate the value of f (x) at the left end point a, that is, compute f (a).

iv Then determine the product f (a)f (b), and find whether it satisfy condition f (a)f (b) < 0.
(Geometrically, this means that if f (a)f (b) < 0, then the curve f (x) has to cross the
x−axis at some point in between the interval [a : b]).

v Calculate the midpoint of the interval [a : b] as x1 = 12 (a + b).

vi Compute the value of f (x) at the midpoint, that is, compute f (x1 ).

vii If f (x1 ) = 0, then stop the iteration process. Then x1 is the exact root.

viii Confirm the accuracy criteria by b−a2 < ǫ, where ǫ is the arbitrary small number. [If half
of the length of the interval [a : b] is less than ǫ, then the point x1 is within ǫ on the
actual root, and so stop the iteration process. x1 is a sufficiently close approximation to
the actual root].

ix If f (b)f (x1 ) < 0, then set a = x1 , and if f (b)f (x1 ) > 0 then set b = x1 . This ensures
that the smaller interval still contains the actual root and continue the iteration.
If the accuracy ǫ is not achieved after the pre-specified maximum number of iterations
allowed, then print out a failure message.

2 Problems:
1. Solve x3 − 9x + 1 = 0 for the root between x = 2 and x = 4, by bisection method.

2. Find a real root of the equation f (x) = x3 − x − 1 = 0 using bisection method.

3. Using bisection method find the positive root of xex = 1, which lies between 0 and 1.

1
Y
f(b)
f(x)

a
O x1 b X
f(a)

Figure 1: Bisection Method


4. Using bisection method find the root of 3x = 1 + sin x.

5. Using bisection method find the approximate root of cos x = x.

6. Using bisection method find the approximate root of 2x = cos x + 3.

3 Solution:
Problem 1: f (x) = x3 − 9x + 1 = 0

Initial values are a = 2 and b = 4.

Let the accuracy is ǫ = 0.01.


n a b f (a) f (b) f (a)f (b) x1 f (x1 ) Accuracy
( b−a
2 < ǫ?)
1 2.000 4.000 -9.000 29.000 -261.000 3.000 1.000 No
2 2.000 3.000 -9.000 1.000 -9.000 2.500 -5.875 No
3 2.500 3.000 -5.875 1.000 -5.875 2.750 -2.953 No
4 2.750 3.000 -2.953 1.000 -2.953 2.875 -1.111 No
5 2.875 3.000 -1.111 1.000 -1.111 2.9375 -0.090 No
6 2.9375 3.000 -0.090 1.000 -0.090 2.9687 0.4462 No
7 2.9375 2.96875 -0.090 0.4462 -0.0402 2.9531 0.1759 No
8 2.9375 2.95312 -0.090 0.17592 -0.01584 2.94531 0.04237 Yes

Therefore approximate solution of the algebraic equation is x = 2.94531.

Problem 2: f (x) = x3 − x − 1 = 0
We consider the initial values of x for which f (x) become of opposite in sign. We take a = 1
and b = 2.
Let the accuracy is ǫ = 0.01.

2
n a b f (a) f (b) f (a)f (b) x1 f (x1 ) Accuracy
( b−a
2 < ǫ?)
1 1.000 2.000 -1.000 5.000 -5.000 1.500 0.875 No
2 1.000 1.500 -1.000 0.875 -0.875 1.250 -0.296 No
3 1.25 1.500 -0.296 0.875 -0.259 1.375 0.224 No
4 1.250 1.375 -0.296 0.224 -0.066 1.312 -0.051 No
5 1.3125 1.375 -0.0515 0.224 -0.011 1.343 0.082 No
6 1.3125 1.3437 -0.0515 0.0826 -0.004 1.328 0.014 No
7 1.3125 1.3281 -0.0515 0.0145 -0.0007 1.3203 -0.0187 Yes

Therefore approximate solution of the algebraic equation is x = 1.3203.

Let now the accuracy be ǫ = 0.001.


n a b f (a) f (b) f (a)f (b) x1 f (x1 ) Accuracy
( b−a
2 < ǫ?)
1 1.0000 2.0000 -1.0000 5.0000 -5.0000 1.5000 0.8750 No
2 1.0000 1.5000 -1.0000 0.8750 -0.8750 1.2500 -0.2969 No
3 1.2500 1.5000 -0.2969 0.8750 -0.2598 1.3750 0.2246 No
4 1.2500 1.3750 -0.2969 0.2246 -0.0667 1.3125 -0.0515 No
5 1.3125 1.3750 -0.0515 0.2246 -0.0116 1.3438 0.0826 No
6 1.3125 1.3438 -0.0515 0.0826 -0.0043 1.3281 0.0146 No
7 1.3125 1.3281 -0.0515 0.0146 -0.0008 1.3203 -0.0187 No
8 1.3203 1.3281 -0.0187 0.0146 -0.0003 1.3242 -0.0021 No
9 1.3242 1.3281 -0.0021 0.0146 -0.0000 1.3262 0.0062 No
10 1.3242 1.3262 -0.0021 0.0062 -0.0000 1.3252 0.0020 Yes

Therefore approximate solution of the algebraic equation is x = 1.3252.

Problem 3: xex = 1 i.e., f (x) = xex − 1 = 0


Let the initial values of x for which f (x) become of opposite in sign be a = 0 and b = 1.
Let the accuracy is ǫ = 0.001.
n a b f (a) f (b) f (a)f (b) x1 f (x1 ) Accuracy
( b−a
2 < ǫ?)
1 0.0000 1.0000 -1.0000 1.7183 -1.7183 0.5000 -0.1756 No
2 0.5000 1.0000 -0.1756 1.7183 -0.3018 0.7500 0.5878 No
3 0.5000 0.7500 -0.1756 0.5878 -0.1032 0.6250 0.1677 No
4 0.5000 0.6250 -0.1756 0.1677 -0.0294 0.5625 -0.0128 No
5 0.5625 0.6250 -0.0128 0.1677 -0.0021 0.5938 0.0751 No
6 0.5625 0.5938 -0.0128 0.0751 -0.0010 0.5781 0.0306 No
7 0.5625 0.5781 -0.0128 0.0306 -0.0004 0.5703 0.0088 No
8 0.5625 0.5703 -0.0128 0.0088 -0.0001 0.5664 -0.0020 No
9 0.5664 0.5703 -0.0020 0.0088 -0.0000 0.5684 0.0034 No
10 0.5664 0.5684 -0.0020 0.0034 -0.0000 0.5674 0.0007 Yes

Therefore approximate solution of the algebraic equation is x = 0.5674.


√ √
Problem 4: 3x = 1 + sin x i.e., f (x) = 3x − 1 + sin x = 0
Let us choose two initial values of x for which f (x) become of opposite in sign e.g., a = 0

3
and b = 1.
Let the accuracy is ǫ = 0.001.
n a b f (a) f (b) f (a)f (b) x1 f (x1 ) Accuracy
( b−a
2 < ǫ?)
1 0.0000 1.0000 -1.0000 1.6430 -1.6430 0.5000 0.2837 No
2 0.0000 0.5000 -1.0000 0.2837 -0.2837 0.2500 -0.3669 No
3 0.2500 0.5000 -0.3669 0.2837 -0.1041 0.3750 -0.0439 No
4 0.3750 0.5000 -0.0439 0.2837 -0.0124 0.4375 0.1193 No
5 0.3750 0.4375 -0.0439 0.1193 -0.0052 0.4062 0.0376 No
6 0.3750 0.4062 -0.0439 0.0376 -0.0016 0.3906 -0.0032 No
7 0.3906 0.4062 -0.0032 0.0376 -0.0001 0.3984 0.0172 No
8 0.3906 0.3984 -0.0032 0.0172 -0.0001 0.3945 0.0070 No
9 0.3906 0.3945 -0.0032 0.0070 -0.0000 0.3926 0.0019 No
10 0.3906 0.3926 -0.0032 0.0019 -0.0000 0.3916 -0.0006 No

Therefore approximate solution of the algebraic equation is x = 0.3916.

Let us choose the accuracy be a little bit more e.g., ǫ = 0.0001.


n a b f (a) f (b) f (a)f (b) x1 f (x1 ) Accuracy
( b−a
2 < ǫ?)
1 0.00000 1.00000 -1.00000 1.64299 -1.64299 0.50000 0.28368 No
2 0.00000 0.50000 -1.00000 0.28368 -0.28368 0.25000 -0.36687 No
3 0.25000 0.50000 -0.36687 0.28368 -0.10408 0.37500 -0.04388 No
4 0.37500 0.50000 -0.04388 0.28368 -0.01245 0.43750 0.11932 No
5 0.37500 0.43750 -0.04388 0.11932 -0.00524 0.40625 0.03758 No
6 0.37500 0.40625 -0.04388 0.03758 -0.00165 0.39062 -0.00319 No
7 0.39062 0.40625 -0.00319 0.03758 -0.00012 0.39844 0.01719 No
8 0.39062 0.39844 -0.00319 0.01719 -0.00005 0.39453 0.00700 No
9 0.39062 0.39453 -0.00319 0.00700 -0.00002 0.39258 0.00191 No
10 0.39062 0.39258 -0.00319 0.00191 -0.00001 0.39160 -0.00064 No
11 0.39160 0.39258 -0.00064 0.00191 -0.00000 0.39209 0.00063 No
12 0.39160 0.39209 -0.00064 0.00063 -0.00000 0.39185 -0.00000 No
13 0.39185 0.39209 -0.00000 0.00063 -0.00000 0.39197 0.00032 No
14 0.39185 0.39197 -0.00000 0.00032 -0.00000 0.39191 0.00016 No

Therefore approximate solution of the algebraic equation is x = 0.39191.


√ √
Problem 5: cos x = x i.e., f (x) = cos x − x = 0
We choose the two initial values of x for which f (x) become of opposite in sign; therefore
we take a = 0 and b = 1.
Let the accuracy is ǫ = 0.001.

4
n a b f (a) f (b) f (a)f (b) x1 f (x1 ) Accuracy
( b−a
2 < ǫ?)
1 0.0000 1.0000 1.0000 -0.4597 -0.4597 0.5000 0.1705 No
2 0.5000 1.0000 0.1705 -0.4597 -0.0784 0.7500 -0.1343 No
3 0.5000 0.7500 0.1705 -0.1343 -0.0229 0.6250 0.0204 No
4 0.6250 0.7500 0.0204 -0.1343 -0.0027 0.6875 -0.0563 No
5 0.6250 0.6875 0.0204 -0.0563 -0.0011 0.6562 -0.0178 No
6 0.6250 0.6562 0.0204 -0.0178 -0.0004 0.6406 0.0013 No
7 0.6406 0.6562 0.0013 -0.0178 -0.0000 0.6484 -0.0082 No
8 0.6406 0.6484 0.0013 -0.0082 -0.0000 0.6445 -0.0034 No
9 0.6406 0.6445 0.0013 -0.0034 -0.0000 0.6426 -0.0011 No
10 0.6406 0.6426 0.0013 -0.0011 -0.0000 0.6416 0.0001 Yes

Therefore approximate solution of the algebraic equation is x = 0.6416.

Problem 6: 2x = cos x + 3 i.e., f (x) = 2x − cos x − 3 = 0


We choose the two initial values of x for which f (x) become of opposite in sign; therefore
we get a = 1 and b = 3.
Let the accuracy is ǫ = 0.001.
n a b f (a) f (b) f (a)f (b) x1 f (x1 ) Accuracy
( b−a
2 < ǫ?)
1 1.0000 3.0000 -1.5403 3.9900 -6.145795 2.0000 1.4161 No
2 1.0000 2.0000 -1.5403 1.4161 -2.181294 1.5000 -0.0707 No
3 1.5000 2.0000 -0.0707 1.4161 -0.100174 1.7500 0.6782 No
4 1.5000 1.7500 -0.0707 0.6782 -0.047977 1.6250 0.3042 No
5 1.5000 1.6250 -0.0707 0.3042 -0.021517 1.5625 0.1167 No
6 1.5000 1.5625 -0.0707 0.1167 -0.008255 1.5312 0.0230 No
7 1.5000 1.5312 -0.0707 0.0230 -0.001624 1.5156 -0.0239 No
8 1.5156 1.5312 -0.0239 0.0230 -0.000549 1.5234 -0.0005 No
9 1.5234 1.5312 -0.0005 0.0230 -0.000011 1.5273 0.0112 No
10 1.5234 1.5273 -0.0005 0.0112 -0.000005 1.5254 0.0054 No
11 1.5234 1.5254 -0.0005 0.0054 -0.000003 1.5244 0.0025 No

Therefore approximate solution of the algebraic equation is x = 1.5244.

4 Numerical code:
#include<stdio.h>
#include<math.h>
//function defination

double func(double x)
{
return 3*x-sqrt(1+sin(x));
}
double e=0.001; //Defines the permissible error
double c;
void bisection(double a, double b)

5
{
if(func(a) * func(b) >= 0)
{
printf(“Incorrect a and b.”);
return;
}
while ((b − a) >= e)
{
c = (a+b)/2;
if (func(c) == 0.0)
{
printf(“Root = %lf\ n”,c);
break;
}
else if (func(c)*func(a) < 0)
{
printf(“a=%lf\tb=%lf\tRoot = %lf\tf(x)=%lf\n”,a,b,c,func(c));
b = c;
}
else{
printf(“a=%lf\tb=%lf\tRoot = %lf\tf(x)=%lf\n”,a,b,c,func(c));
a = c;
}
}
}
int main()
{
double a,b;
a=0;
b=1;
printf(”a = %lf\n”,a);
printf(”b = %lf\n”,b);
bisection(a,b);
printf(”\n”);
printf(”Accurate Root calculated is = %lf\n”,c);
return 0;
}

5 Merits of bisection method:


i Bisection method is very simple to realize and to program in a computer.

ii One can guarantee the convergence of the iteration in case of solution of the equation; so
it always produces a root.

6
6 Demerits of bisection method:
i The convergence of this method is slow as it is simply based on halving the interval.

ii This can’t be applied over an interval where there is a discontinuity.

iii It also cannot be applied in an interval where the function always takes values of the
same sign.

iv The method fails to determine complex roots.

v If one of the initial guesses a or b is closer to the exact solution, it will take larger number
of iterations to reach the root.

You might also like