Version 3 of Notes on continued fractions

Updated 2002-01-14 14:19:50

MS: These are some notes on my playing around with Fraction Math and the reference to the nice notes on Continued Fractions at http://www.inwap.com/pdp10/hbaker/hakmem/cf.html [L1 ].

I have started playing with these things and resisted (for now) looking for other sources. Some of the "errors" I found in the reference may be due to the informal presentation of results there, which might be inaccurate or misunderstood by me: caveat emptor.


Item 101A (3) clearly says (AFAIU, not all claims reproduced here):

DEFINITION: a rational approximation p/q to a real number x is "best" iff, for every integer r and s,

  (s <= q) ==> (|x - p/q| <= |x - r/s|)

NOTATION: let us identify a (positive) real number x with its regular continued fraction representation

  x = {x[0] x[1] x[3] x[4] ...} 

Define the truncation of x after (n+1) terms

  a(x,n) = {x[0] x[1] x[3] x[4] ... x[n]} 

and let

  b(x,n,i) = {x[0] x[1] x[3] x[4] ... x[n-1] i}

be a(x,n) with the last element replaced by 0 < i < x[n].

The claims are:

   A - a(x,n) is "best"
   B - b(x,n,i) is "best" if i>1
   C - b(x,n,1) is never "best" (note that b(x,n,i) is not defined when x[n] = 1)

Let me provide counterexamples to both B and C, thus showing that they are not true.

The example provided in the text actually contains counterexamples to B. Let x = pi = {3 7 15 1 292 ...}

   . b(x,0,2) = 2/1 = {2} is not best (3/1 is better)
   . b(x,1,2) = 7/2 = {3 2} and b(x,1,3) = 10/3 = {3 3} are not best (3/1 is better) 
   . b(x,2,2) = 47/15 = {3 7 2} is not best (22/7 is better)

For another counterexample to B, easier to follow by hand, consider

  x = 0.51 = {0 1 1 24 2}

The number

  b(x,3,4) = 5/9 = {0 1 1 4} = 0.555...

is not best, as 1/2 = {0 1 1} = {0 2} is better.

For a counterexample to C, consider x = 7/10 = {0 1 2 3}; now

  b(x,2,1) = 1/2 = {0 1 1} = {0 2} 

is best.


So, in light of these counterexamples, some propositions I can guess and hope could be true would are (apart from A):

   D - if r is a "best" approximation to x, then either
           r = a(x,n) for some n
       or else
           r = b(x,n,i) for some (n,i)
       is true. 

   E - p/q = b(x,n,i) with i>1 is "best" among all fractions on the same side of x:
      ((s <= q) & (sgn(x-p/q) = sgn(x-r/s))) ==> (|x - p/q| <= |x - r/s|)

---

The example I provided in Fraction Math that shows that quotient_rep does not always provide the best approximation is

   quotient_rep 3.1416305 500 --> 355/113

Now, 3.1416305 = {3 7 16 2 ...}. quotient_rep produced

   355/113 = {3 7 16} = a(3.1416305,2)

and the fraction

   377/120 = {3 7 16 1} = b(3.1416305,3,1)

is closer - a new counterexample to C.