3 ms·
Here's the method that's being applied: https://en.wikipedia.org/wiki/Newton%27s_method https://en.wikipedia.org/wiki/Newton%27s_method It's an iterative metho
by grey--area 7y ago
Here's the method that's being applied: https://en.wikipedia.org/wiki/Newton%27s_method https://en.wikipedia.org/wiki/Newton%27s_method
It's an iterative method for finding x such that f(x)=0 for a given function f, in this case f(x) = x^2 - N, where N is the number you want the square root of.
The special case has such a simple expression, though, that I'm tempted to commit it to memory.
Edit: Another nice example, for when you have access to a calculator that can compute powers but not logarithms:
a' = a - 1 + x/c^x will converge the base-c logarithm of x (though it will converge slowly if you start very far from the solution).
- fastbeef 7y agoAt it's core, it's also what drives Carmack's Fast Inverse Square Root (https://en.wikipedia.org/wiki/Fast_inverse_square_root https://en.wikipedia.org/wiki/Fast_inverse_square_root). Yes, yes, I know Carmack didn't invent it.
- acqq 7y agoThe method in question was known for millennia before Newton, it is believed to be known to Babylonians: https://en.m.wikipedia.org/wiki/Methods_of_computing_square_roots https://en.m.wikipedia.org/wiki/Methods_of_computing_square_...