Rational search

Rational search

Volume 8, numbx 2 February 1979 !!NFORMATION PROCESSING LETTERS RATIONALSEARCH Steven P. REISS Computer(Science, Brown University,Providence, RI 02...

174KB Sizes 2 Downloads 115 Views

Volume 8, numbx

2 February 1979

!!NFORMATION PROCESSING LETTERS

RATIONALSEARCH Steven P. REISS Computer(Science, Brown University,Providence, RI 02912, U.S.A. Received 11 July 1978

Discrete mathematics, analysis of algorithms, combinatorial

In linear programming and other problems [3,4] it is sometimes desirable to search for a rational number with a bounded numerator and denominator using only queries of the form “Is the number X?” A previous, independently derived, solution to this problem used Farey series and a rather sophisticated search procedure [3]. In this note we use continued fractions to show that the problem can be solved in a simple, straight,forward manner. Suppose we want to search for a rational p/s where 0 < p, q
and will be denoted by /x0, .... x,/. If /or, ... . a,/ is a continued fraction representation for some number A, then Ai =/al, ,,.., ai/, i 4 n, is called a convergent of A. Classic results on continued fraction3 show

[W mma. (a)Let Al =a/b =/al, . . . . aif and AZ =c/d = Ial , . .. . ai, ai+cr/ be conwergents sfA where a/b and

problems

c/d are irreducible. Then (aWA~--AIHAz-Al (a2)d >b (b) Every irreducible rbtional fraction p/4 that satisfies IA - p/q! < 1/(2(i2) is a convergent of A. (4 Let p/4= lab...#a,,/ be irreducible. Then n < [lob q& 1 - 2 where Q,= (1 + &)/2.

We can use these facts to prove that the search method outlined above correctly determines p/q. Theorem. Let xfy be irreducible such that Ip/q - x/_YI < 1/(2N2). Then p/4 is the convergent to x/y with the largest denominator
Proof. By property (a2) we know that there is a unique convergent to x/y with largest denominator
Volume 8, number

2

INFORMATION PROCESSING LETTERS

Qrl+l(xoP xrl) Qnh -.a# x,) l **9

1 ifn=O &(x1, .... x,) = x1 if n = 1

xnQn&l **~1) + Qn-AXI *a x,-2) i l

l

ifn > 1.

Computing p/q in this way takes only O(log IV) operations since n must be O(lcg IV)by property (c).

90

1979

References

rmces (21: /x0, ...* x J--

February

[l] A.Ya. Khinchin, Continued Fractions (University of Chicago Press, 1964). [2] Donald E. Knuth, The Art of Computer Programming, Vol, 2, Seminumerical Algorithms (Addison-Wesley, 1969). [ 3) Christos H. Papadimitriou, Efficient Search for Rationals (Harvard University, 1978). [4] Steven P. Reiss and David Dobkin, The complexity of linear programming, Yale Research Report 69 (1976).