previous up next contents
Previous: 3 Polynomials Up: From Euclid to Padé Next: 5 Padé approximants   Contents

Subsections


4 Continued fractions


4.1 Confrac expansion of a rational

Let us go back to Figure 1, and give another meaning to the involved matricial products. Since

maths

it is convenient to define maths as maths (together with maths) and maths as the homographic mapping maths. We therefore obtain maths. In our example maths. By recurrence, we have maths where maths. In other words,

maths

But the composition of homographies obeys to the same rules as matricial products, and the maths can be obtained by multiplying, from left to right, the matrices maths, namely:

maths

leading to the homographies:

maths

Let us call maths the integer coefficients of these homographies, i.e. maths. The fractions maths are usually called the convergents of maths (expansion of maths into continued fractions). The last one (here maths) is nothing but the irreducible expression of maths, and the preceeding one (here maths) carries the Bezout's coefficient of the pair maths that defines maths as maths.

From the very definition, we have formula

maths maths maths  
maths maths maths  

and the following facts hold:

  1. maths, so that maths except perhaps from maths
  2. maths and maths. Thus the maths are positive (for maths).
  3. maths and maths are coprimes since maths.
  4. Any maths is monotonic over maths therefore maths.
  5. For any convergent maths written in lowest terms maths since

    maths

Let us emphasize the fact that property maths is really a strong one, since for a randomly chosen denominator, maths only implies that maths.

4.2 Some theorems about centered convergents

If we compare Figure 1 with Figure 2, we can do the following remarks. On the former, the algorithm goes through fractions maths, maths, maths, maths, maths and maths (the ``convergents'' of maths). On the later, the algorithm goes only through maths, maths, maths and maths, skipping maths and maths. This remark can be generalized as follows.

Theorem 1. A convergent is skipped by the centered algorithm if and only if the next quotient is maths, except for the ``killing convergents'' that are not killed themselves.

Proof. Let us define (for maths) maths as maths together with maths. The lemma:

maths maths maths (4)
maths maths maths (5)

can be proven by direct inspection. The decomposition maths, obtained from the ordinary algorithm, can be rewritten as follows : reading from the left, the first occurrence of maths is replaced according to Eq. 4. And so on recursively. It is to be noticed that a sequence maths will be replaced by maths : the second maths will never been the center of a replacement (``killer not killed''). When all the maths have been removed, the maths can be pushed to the right according to Eq. 5 or canceled by encountering another maths since maths and we obtain maths.

This sequence of homographies maths acts with decreasing maths, i.e. from right to left, over the maths defined by maths and maths. But this sequence acts with increasing maths over the matrices conveying the remainders and the convergents, according to

maths (6)

Assuming that maths, maths, maths, Eq. 6 leads to maths (where maths is a centered remainder) and to maths. With these transformations, the quotient sequence maths, maths, maths is shorten to maths while the remainder sequence maths is replaced by maths and one convergent is skipped. If maths, i.e. if maths is a centered remainder, every things are ready to continue the algorithm, with one sign reversal until another maths is encountered. On the other hand, if maths, the remainder maths is not a centered one and another reduction step must be engaged, involving the new quotient maths, this maths and the next quotient maths.

In our example, we start from maths, rewritten as maths then maths and obtain maths. In other words, convergent maths is killed since maths ; maths remains regardless to maths : ``killer is not killed'' ; maths is killed since maths ; maths remains (killer) ; maths remains since maths and maths remains too since maths.

Let us give another example of that process, by describing the expansion of maths into convergents. Figure 4 gives the convergents of that number and the quotients maths and maths respectively involved in the ordinary and centered algorithm. A maths in the last line stands for ``killed'' and the corresponding fraction isn't a centered convergent.

FIG.  4: Another conversion from ordinary to centered.
maths

The sequence maths is converted into maths and thereafter into maths.

This result can be compared with theorem 183 & 184 in [9], stating that maths holds for at least one of any two consecutive (ordinary) convergents, and conversely implies that maths is a convergent of maths. It is easy to see that any convergent appearing during the centered algorithm obeys to that rule, except from those related to a sequence ending by maths where maths or by maths where maths : it suffices to remember that convergents are obtained under the action of the maths, thus by reading from left to right the sequence of the maths. And we have :

Theorem 2. For any two consecutive centered convergents, maths while

maths

To prove that these bounds are as good as possible, let us consider a number maths whose (ordinary) quotient sequence is an odd number, say maths, of maths followed by a last one, maths. The (ordinary) convergents except for the last one, are the Fibonnaci convergents maths, and we have maths for maths. Going to the centered sequence, all odd indexed convergents but the last one are skipped. The quotient of denominators of centered convergents maths and maths are exactly equal to maths, and maths when maths increases. On the other hand, maths. A simple inspection gives maths. Given maths, we can choose maths such that maths and thereafter choose the last quotient maths as great as requested to enforce maths.

4.3 Periodic expansion of maths

Let us now have another sight over properties 1 and 2 of paragraph 4.1. We can use them to define an algorithm that applies to maths rather than to maths, since quotients and convergents remains the same when starting from maths instead of starting from maths. Something have changed, however: computations are done now in maths instead of maths. And you have nothing to change to your code, thanks to Maple's syntax flexibility.

If you want to start from any maths, you have a little change to do : the ending test cannot remains ``maths''. You have to choose and specify some approximation level, and something like ``maths'' is convenient since, as previously stated, the convergents maths of maths verify maths. Starting from maths, we obtain Figure 5.

FIG.  5: Bezout's algorithm leads to continued fractions.
maths

Therefore the first 14 convergents of maths are :

maths

It appears from Figure 5 that the sequence of quotients is periodic. That property is a characteristic of quadratics numbers (a proof can be found in [9]). To obtain an ad hoc justification for the present case, put maths and define maths. We have maths. The periodicity follows, and also an explanation for the ``surprising value'' maths : from maths, the last four digits cannot be trusted since any small rounding error can be magnified up to that factor.

4.4 Interval arithmetic and rationality checking

Expansion into continued fractions can be used to guess if a real number, known as belonging to a small real interval is in fact a rational or not. To exemplify this algorithm, due to Lehmer, let us consider the number maths. It is well-known that maths holds for the general case, and we want to guess maths. Since maths is decreasing, we have maths and therefore maths where maths, the maths being chosen for convenience. On the other hand, we have maths where maths and maths (cf Figure 6).

FIG.  6: Lower and upper bounds for maths.
maths

The auxiliary function maths has been chosen for it's decomposition into partial fractions. From maths, relation maths is plain and both maths and maths are easy to evaluate. Let us take maths and put maths and maths. The confrac algorithm will be slightly modified to start with matrix maths instead of maths, allowing a simultaneous expansion of both maths and maths into continued fractions until the two expansions diverge from each other.

FIG.  7: Lehmer's algorithm : simultaneous confrac expansion.
maths

Common convergents to maths and maths are convergents of any maths such that maths. Here maths is an even convergent of maths (majorant) and an odd convergent of maths (minorant) : it separates the two values. The unexpectedly high value of the next quotient (2586520) is a strong suggestion for maths to be a rational (the effective value of that quotient being maths). Further details are given in [6].


previous up next contents
Previous: 3 Polynomials Up: From Euclid to Padé Next: 5 Padé approximants   Contents


douillet@ensait.fr
2005-02-09