Better HN
topnewbestaskshowjobs
Log inSign up

grey--area

4 karma · joined Jun 11, 2019 (7y ago) · 2 submissions

Submissions

comment 7y ago · link · parent

Here's the method that's being applied: 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).

2.

Show HN: QCircuits – a quantum circuit simulation Python library(github.com ↗)

3 points · by grey--area · 7y ago · discuss