GraphingCalculator 4;
Window 350 283 977 1211;
FontSizes 18;
DrawGraph 0;
StackPanes 1;
SliderControlValue 0;
Text "BABYLONIAN METHOD TO APPROXIMATE SQUARE ROOTS";
Color 17;
Expr function(f,x,n,m,S)=branch(if(x,n>m),function(f,[x+S/x]/2,n+1,m,S));
Text "* x is initial/current estimate
* n is current iteration
* m is number of iterations to do
* S is the number we want square root of
The logic of this method is to find a number midway between our current estimate of √S and an estimate of √S made by the quotient of S and the current estimate. If x_n is less than √S, then S/x_n will be greater than √S and vice versa. So successive approximations *must* be more accurate than previous approximations.
The initial guess does not matter except perhaps in number of iterations to get the same approximation.";
Color 17;
Expr function(f,1,1,a,2);
Color 17;
MathPaneSlider 3;
Expr a=slider([1,7,6]);
Color 17;
Expr sqrt(2);