Induction problem ? (Atleast I think it is that :)
- From: "Vinay" <vjethava@xxxxxxxxx>
- Date: 31 Jan 2006 02:23:58 -0800
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.
.
- Follow-Ups:
- Re: Induction problem ? (Atleast I think it is that :)
- From: RobertSzefler
- Re: Induction problem ? (Atleast I think it is that :)
- Prev by Date: Re: Significance of "Relativizations of the P =? NP Question"
- Next by Date: Re: Induction problem ? (Atleast I think it is that :)
- Previous by thread: Graph Theory question
- Next by thread: Re: Induction problem ? (Atleast I think it is that :)
- Index(es):