0

bestappr(sqrt(13),30) gives 18/5 for any precision I tried, but a closer approximation is 101/28. Is there anything I missed?

  • Is seems to be PARI/GP's implementation drawback. Please, write to the PARI/GP developers mailing list: http://pari.math.u-bordeaux.fr/lists-index.html. – Piotr Semenov Sep 17 '16 at 10:43
  • @PiotrSemenov I got it, I will try to write my own function. thanks. –  Sep 17 '16 at 10:49

1 Answers1

1

For PARI/GP,

By definition, a/b is the best rational approximation to x if |b x - a| < |vx - u| for all integers (u,v) with 0 < v <= B. (see ??bestappr).

So in this case

|5x - 18| < |28x - 101|

and so gp considers 18/5 the better approximation. The next approximation it considers better is 119/33 followed by 137/38.

Charles
  • 11,269
  • 13
  • 67
  • 105