Bisection method is used for finding root of the function in given interval.
IN: Function f, which is continous function and interval [a,b]. Function must satisfy given equation: f(a) * f(b) < 0 - signs of that values are different, which means that given function in given interval has at least one root in interval [a,b]. OUT: Root in given interval. 1. Calculate c - midpoint of given interval using formula: c = (a + b) / 2. 2. Calculate f(c). 3. If b - a is small enough or abs(f(c)) is small enough: return c - which is the root we were searching for; 4. If(f(a) * f(c) < 0) assign c to b, else assign c to a. 5. Go to step 1.
Step By Step:
f(x) = x * (x * (x * (x * (x)) + 2)) - 2 [0,2] root: 0.8515625
Bisection Method Step By Step
- easy to implement.
- no need to calculate derivative of given function.
- slow compared to other methods.