The calculator uses sequences derived from refinements of Newton's method (see Les Algorithmes, Bibliothèque Tangente 37, 2013, or Itération et Récurrence, Bibliothèque Tangente 76, 2021).
The function f used here is defined by f (x) = x2 ‒ a.
We solve f (x) = 0 because its solution is precisely a\sqrt{a}, the quantity we are interested in. Let's implement the algorithm.
The derivative of f is f ' (x) = 2 x, and we have f(x)f(x)=x2a2x=x2a2x.\dfrac{f(x)}{f'(x)} = \dfrac{x^2 -a}{2x} = \dfrac{x}{2} - \dfrac{a}{2x}.
This gives Heron's sequence:
un+1=unf(un)f(un)=unun2+a2un=un2+a2un=12(un+aun).u_{n+1} = u_n - \dfrac{f(u_n)}{f'(u_n)} = u_n - \dfrac{u_n}{2} + \dfrac{a}{2u_n} =\dfrac{u_n}{2} + \dfrac{a}{2u_n} = \dfrac{1}{2} \left( u_n + \cfrac{a}{u_n} \right).
Let's now illustrate the method with a = 163. To initialize the computation, we can start with a, or, since 163 lies between 144 = 122 and 169 = 132, with 12.
After just three iterations of the algorithm, the result is remarkable, since 163=12,7671453348037\sqrt{163} = 12,7671453348037 \ldots
In fact, the number of correct decimal places doubles (at least) with each loop—a phenomenon known as quadratic convergence.
Each iteration requires one addition and one division, together with a division by 2, which is easy to program in binary: just three operations in all.
Schönhage's trick ---------------------
The main drawback of Heron's sequence (see above) is that it involves a division: division is a "troublesome" and "slow" operation, even for an electronic circuit. But the division "a / *un" can be replaced by an iteration: once again, we use Newton's method to compute the reciprocal 1/b of a real number b > 0. This time we use the function g defined by g(x)=1xb,g(x) = \dfrac{1}{x}-b, which gives the sequence v defined by vn*+1 = *vn(2 ‒ bvn*).
Indeed: g(x)=1xb,g(x) = \dfrac{1}{x}-b, and g(x)=1x2,g'(x) = \dfrac{-1}{x^2}, hence g(x)g(x)=1xb1x2=x2(1xb)=x+bx2,\dfrac{g(x)}{g'(x)} = \dfrac{ \dfrac{1}{x}-b}{\dfrac{-1}{x^2}} = -x^2 \left( \cfrac{1}{x} -b\right) = -x +bx^2,
that is, vn+1=vng(un)g(un)=vn+vnbvn2=vn(2bvn).v_{n+1} = v_n- \dfrac{g\left(u_n\right)}{g'\left(u_n \right)} = v_n +v_n -bv_n^2 = v_n \left( 2-bv_n \right).
We can do even better! The German mathematician Arnold Schönhage (born in 1934) had the idea of coupling the two Newton iterations, a combination that proved more efficient than using the two methods separately. To find an approximation to the square root of a > 0, we start with the sequence u, defined by
un+1=12(un+aun)=un+aun22un.u_{n+1} = \dfrac{1}{2} \left( u_n + \cfrac{a}{u_n} \right) = u_n + \dfrac{a-u_n^2}{2u_n}.
To compute 12un,\dfrac{1}{2u_n}, we use Newton's method to compute reciprocals.
In this setting, we use two sequences, u and v:
{un+1=un+(aun2)vn,\[0,7mm]vn+1=vn(22unvn)=vn+(12unvn)vn,\left \{ \begin{array}{l} u_{n+1} = u_n + \left( a-u_n^2\right) v_n, \[0,7mm] v_{n+1} = v_n (2-2u_nv_n) = v_n +(1-2u_nv_n)v_n, \end{array} \right. with v0=12u0.v_0= \dfrac{1}{2u_0}.