C++ Program for Bisection Method to find the Roots of an Equation - KhurafatiTech How to Tips-Tricks

Recent

Friday, July 6, 2018

C++ Program for Bisection Method to find the Roots of an Equation

download C++ source code file

Bisection Method is used to find the root of an equation. Let a function is given f(x)=0
we want to find the root, for this we need two points r, l (right and left) say
and the values of the function at these points is
' rv' (right point value)
'lv' (left point value)
make sure that the values rv and lv are of oposite sign( so that the root lies between 'r' and 'l')

then calculate a middle point (r+l)/2 say this 'm'
and the value of the function at middle point is to be calculated now, let it be 'mv'

now check , mv*rv>0 it means, the root lies  between 'l' and 'm' so now change 'r' to 'm'
again calculate a middle point , and so on.....
continuously you will go near to the root, the points 'r' and 'l' comes nearer 
at a point you will get  that 'r' and 'l' becomes very close or nearly equal. that point is the root. where f(r) and f(l) becomes approximately equal.

No comments: