Roots of equation
Bisection Method
The simplest root finding algorithm is the bisection method. The algorithm applies to any continuous function f(x) on an interval [a,b] where the value of the function f(x) changes sign from a to b. The idea is simple: divide the interval in two, a solution must exist within one subinterval, select the subinterval where the sign of f(x) changes and repeat.
The bisection method procedure is:
- Choose a starting interval [a0,b0] such that f(a0)f(b0)<0.
- Compute f(m0) where m0=(a0+b0)/2 is the midpoint.
- Determine the next subinterval [a1,b1]:
- If f(a0)f(m0)<0, then let [a1,b1] be the next interval with a1=a0 and b1=m0.
- If f(b0)f(m0)<0, then let [a1,b1] be the next interval with a1=m0 and b1=b0.
- Repeat (2) and (3) until the interval [aN,bN] reaches some predetermined length.
- Return the midpoint value mN=(aN+bN)/2.
A solution of the equation f(x)=0 in the interval [a,b] is guaranteed by the Intermediate Value Theorem provided f(x) is continuous on [a,b] and f(a)f(b)<0. In other words, the function changes sign over the interval and therefore must equal 0 at some point in the interval [a,b].
Newton raphson method:
Example:
Find a root of an equation f(x)=x3-x-1 using Newton Raphson method
Solution:
x | 0 | 1 | 2 |
f(x) | -1 | -1 | 5 |
1st iteration :
2nd iteration :
3rd iteration :
4th iteration :
Approximate root of the equation x3-x-1=0 using Newton Raphson mehtod is 1.32472
Secant method:
Example:
Compute the root of the equation \( x^2e^{–\frac x2} = 1 \) in the interval [0, 2] using the secant method. The root should be correct to three decimal places.
Solution:
Apply, secant method, The first approximation is,
The second approximation is,
Since, x2 and x3 matching up to three decimal places, the required root is 1.429.