Induction problem ? (Atleast I think it is that :)



Hi,

I recently came across the following code:

const double epsilon = 1.0e-15;
double compute(double m) {
double x = m;
double y = 1.0;
while(x - y > epsilon ) {
x = (x+y)/2;
y = m/x;
}
return x;
}

This function returns the square-root for given value(m). I tried
solving this algebraically but expression got too complex. Can anybody
point me how one can PROVE this to be true. I don't remember seeing any
expansions for square-root similar to say that of log(x), or sin(x) -
in case there is one please do mention it.

Vinay

PS: I tried looking up at recurring function solutions for square-root
( of the type y/(1+y/1+y(1/...))) but drew a blank.

.