21 ms·
Yeah, it should read "repeat step three". Frequently, if you want to find x satisfying f(x) = x you can just let x be the limit of the sequence t, f(t), f(f(t)
by jibiki 18y ago
Yeah, it should read "repeat step three". Frequently, if you want to find x satisfying f(x) = x you can just let x be the limit of the sequence t, f(t), f(f(t)), f(f(f(t))) where t is some arbitrary number. In this case, we have:
f(Y) = Y*(300-XYY)/200
If f(Y) = Y, then:
Y = Y*(300-XYY)/200
1 = (300-XYY)/200
200 = 300 - XYY
100 = XYY
So it looks like the algorithm calculates an inverse square root instead, and then multiplies it by the original number (step 5.)
- cperciva 18y agoYeah, it should read "repeat step three". Oops, quite right. So it looks like the algorithm calculates an inverse square root instead, and then multiplies it by the original number (step 5.) Exactly. The nice thing about this method is that it converges nicely even if you make errors (arithmetical or rounding) along the way -- so you can start by working with only a few digits and only use full precision right at the end. You could compute square roots using a direct NR iteration (Y := (Y + X/Y) / 2), but that requires that you perform a division at each step -- most people find multiplications to be easier and faster.