Bisection method in pascal

As I know the bisection is used to find the zero point of function. Generally it's based on checking of the sign (positive/negative) of function in specific place. Firstly You have to guess in what range a change of the sign may occur. Then check value of function with both of extreme values from this range. If the sign has changed (positive/negative) it means that the range is correct (if not then we must enlarge it). Now we it's time to bisect our range. If we do it we'll have two sections left and right. Now take the number from the middle of range, we check value of our function with middle digit. If the sign of value of function differs from left extreme sign of value it means that the change occured in left part of our range in other case it means that the change occured in the right part. Now You have to only bisect the range to decrease it to as little as You want.

Example:

1. our function is y=x^3

2. we take range from -1000 to +1000

3 check both of them

left_x:=-1000;

y_left:=left_x*left_x*left_x; { exp(3*ln(1000)) - e^3*ln(1000) }

and also

right_x:=-1000;

y_right:=exp(3*ln(right_x));

4. now check if the sign has changed

5. if it has, bisect the range

left_x:=(left_x+right_x)/2 { or right_x:=(left_x+right_x)/2 }

6. check the value of function with new left range value

y_left:=exp(3*ln(left_x))

7. If sign differs from the right extem value of function bisect range left_x - right_x otherwise bisect previous left - current left.

Probably I could make some mistakes in mathematical nomenclature, but I hope You will understand it. If not mailme.

Good luck

_________________________________________________________________

http://www.*-*-*.com/