       Re: Rationalize

• To: mathgroup at smc.vnet.net
• Subject: [mg83758] Re: [mg83665] Rationalize
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Thu, 29 Nov 2007 06:42:39 -0500 (EST)
• References: <200711281023.FAA17533@smc.vnet.net>

```On 28 Nov 2007, at 19:23, Scott wrote:

> Does anybody wish to hazard a guess as to the formula or algorithm
> that is implemented by Rationalize?  Alternatively, can anybody
> recommend a formula or algorithm with the same functionality?
>
> Thanks much.
>
> Cheers, Scott
>

The classical approach to this is based on the following well known
theorem:

Let e be an irrational number and N some given positive integer. Then
there is a rational number p/q with denominator q<N such that
Abs[e-p/q]<1/(q N). (In fact it is possible to replace N by N+1).

The proof is easy and can be found among other places in
Chandrasekharan "Introduction to Analytic Number Theory", Chapter III.
The proof can be converted into an algorithm for computing suitable
rational approximations to irrational numbers. It is also the basis
for representation of irrational numbers as continued fractions. For
example, one can get the following representation for Pi:   Pi = 3 + 1/
(7+1/(15 + ...
The method (due to Adams) is described in Serge Lang, Introduction to
Diophantine Approximations.
The actual method used by Mathematica may be somewhat different as
these books were all written before computational number theory became
popular so possibly modern algorithms are more efficient.

Andrzej Kozlowski

```

• References:
• Prev by Date: A problem with FindRoot
• Next by Date: Re: Problems used by Benchmark[]?