The numerators for dyadic rationals which approximate sqrt(2) within precision 2^-k (within k-bits of precision) can be given by a recursive function f: |N -> |N

f(k) = least n [ n^2 > 2^(2k+1) ] for all k.

f(k):

2, 3, 6, 12, 23, 46, 91, 182, 363, 725, 1449, 2897, 5793, 11586, 23171, 46341, 92682, 185364, 370728,....

The idea of the function f is that for each k>0 it outputs the number of 1/2^k segments that fit into sqrt(2) plus one.

Since for each k, the value f(k) is the smallest integer such that f(k)/2^k > sqrt(2) we have

f(k)/2^k < sqrt(2) < (f(k)+1)/2^k for each k>0.

From this we obtain the error bound | f(k)/2^k - sqrt(2) | < 2^-k.

Conclusion:

Approximation of Sqrt(2) within precision 2^-k can be "represented" by a natural number f(k). To get the actual approximation by a dyadic rational just divide by 2^k.

Note:

This can be generalized to calculating the square root of any number and of any order.

QUESTION:

Can you give a Wang tile program for calculating the function f ?

http://grahamshawcross.com/2012/10/12/wang-tiles-and-turing-machines/

More Konrad Burnik's questions See All
Similar questions and discussions