Computer Science/Numerical Methods/ Bisection method example
Contents
- 1 Bisection Method – Numerical Methods (Computer Science)
- 2 Algorithm of Bisection Method
- 3 Example: Find the root of f(x)=x3−x−2f(x) = x^3 – x – 2f(x)=x3−x−2 in [1, 2]
- 4 Step 1: Check function values
- 5 Step 2: Iterations
- 6 Python Code for Bisection Method
- 7 Applications of Bisection Method
- 8 Conclusion:
- 9 Computer Science/Numerical Methods/ Bisection method example
- 10 Numerical Methods – Australian Mathematical Sciences Institute
- 11 Solutions of Equations in One Variable The Bisection Method
- 12 Solution of Algebraic and Transcendental Equations
Bisection Method – Numerical Methods (Computer Science)
The Bisection Method is a root-finding technique that applies to continuous functions where the root lies between two given points. It is a simple and reliable method based on the Intermediate Value Theorem.
Algorithm of Bisection Method
Select two points a and b such that f(a)f(a) and f(b)f(b) have opposite signs (i.e., f(a)×f(b)<0f(a) \times f(b) < 0), ensuring a root exists in between.
Compute the midpoint cc:
c=a+b2c = \frac{a + b}{2}
Check f(c)f(c):
-
If f(c)=0f(c) = 0, then cc is the root.
-
If f(a)×f(c)<0f(a) \times f(c) < 0, then the root lies in [a, c], set b=cb = c.
-
Else, the root lies in [c, b], set a=ca = c.
Repeat the process until the error tolerance is met:
∣b−a∣<tolerance|b – a| < \text{tolerance}
Example: Find the root of f(x)=x3−x−2f(x) = x^3 – x – 2 in [1, 2]
Step 1: Check function values
f(1)=13−1−2=−2f(1) = 1^3 – 1 – 2 = -2
f(2)=23−2−2=4f(2) = 2^3 – 2 – 2 = 4
Since f(1)×f(2)<0f(1) \times f(2) < 0, a root exists between 1 and 2.
Step 2: Iterations
Iteration | aa | bb | c=a+b2c = \frac{a+b}{2} | f(c)f(c) | Interval Change |
---|---|---|---|---|---|
1 | 1 | 2 | 1.5 | -0.875 | [1.5,2][1.5, 2] |
2 | 1.5 | 2 | 1.75 | 1.609 | [1.5,1.75][1.5, 1.75] |
3 | 1.5 | 1.75 | 1.625 | 0.666 | [1.5,1.625][1.5, 1.625] |
4 | 1.5 | 1.625 | 1.5625 | -0.271 | [1.5625,1.625][1.5625, 1.625] |
5 | 1.5625 | 1.625 | 1.5938 | 0.184 | [1.5625,1.5938][1.5625, 1.5938] |
The root is approximately 1.5938 with a small error.
Python Code for Bisection Method
Applications of Bisection Method
Solving non-linear equations in engineering & science
Finding zero crossings in signal processing
Used in numerical simulations & modeling
Conclusion:
The Bisection Method is a simple, robust but slow root-finding method. It is best suited for cases where guaranteed convergence is needed.