https://github.com/josgard94/bisectionmethod-python
The bisection method is based on the mean value theorem and assumes that f (a) and f (b) have opposite signs. Basically, the method involves repeatedly halving the subintervals of [a, b] and in each step, locating the half containing the solution, m.
https://github.com/josgard94/bisectionmethod-python
bisection bisection-method numerical-analysis numerical-methods python python-3 python3 root
Last synced: 10 months ago
JSON representation
The bisection method is based on the mean value theorem and assumes that f (a) and f (b) have opposite signs. Basically, the method involves repeatedly halving the subintervals of [a, b] and in each step, locating the half containing the solution, m.
- Host: GitHub
- URL: https://github.com/josgard94/bisectionmethod-python
- Owner: josgard94
- Created: 2020-09-29T06:53:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-29T07:15:01.000Z (over 5 years ago)
- Last Synced: 2025-01-21T21:35:10.290Z (12 months ago)
- Topics: bisection, bisection-method, numerical-analysis, numerical-methods, python, python-3, python3, root
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BisectionMethod-Python
The bisection method is based on the mean value theorem and assumes that f (a) and f (b) have opposite signs. Basically, the method involves repeatedly halving the subintervals of [a, b] and in each step, locating the half containing the solution, m.
Below is an example of approximation of the root of the function f (x) = 10x ^ 2:
interval a: -2
interval b: 5
n | a | b | c | f(a) | f(b) | f(c)
1 | -2.00000 | 5.00000 | 1.50000 | 6.00000 | -15.00000 | 7.75000
2 | 1.50000 | 5.00000 | 3.25000 | 7.75000 | -15.00000 | -0.56250
3 | 1.50000 | 3.25000 | 2.37500 | 7.75000 | -0.56250 | 4.35938
4 | 2.37500 | 3.25000 | 2.81250 | 4.35938 | -0.56250 | 2.08984
5 | 2.81250 | 3.25000 | 3.03125 | 2.08984 | -0.56250 | 0.81152
6 | 3.03125 | 3.25000 | 3.14062 | 0.81152 | -0.56250 | 0.13647
7 | 3.14062 | 3.25000 | 3.19531 | 0.13647 | -0.56250 | -0.21002
8 | 3.14062 | 3.19531 | 3.16797 | 0.13647 | -0.21002 | -0.03603
9 | 3.14062 | 3.16797 | 3.15430 | 0.13647 | -0.03603 | 0.05041
10 | 3.15430 | 3.16797 | 3.16113 | 0.05041 | -0.03603 | 0.00724
Result:
Approximate root: 3.16113
Iterations performed: 10
Error: 0.00724