

In fact, the Gauss-Kuzmin theorem states that the distribution of a k (thought of as a random variable) asymptotically approaches the probability mass function P(a k = t) = -log 2(1 - 1/(1+t) 2), which is shown below for t ≤ 20. The k_th term a k is more likely to be a small integer than a large integer. For almost every irrational number in (0,1) and for k sufficiently large, It turns out that this is generally true. Notice that the continued fractions in this article mostly contain small integers such as 1, 2, 3, and 4.

The first property concerns the probability distribution of the a k for sufficiently large values of k. Two statistical properties are discussed in Barrow (2000), "Chaos in Numberland: The secret life of continued fractions."īoth properties are illustrated by the first 97 terms in the continued fraction expansion of pi, which are There are some very interesting mathematical properties of continued fractions. Two amazing properties of the continued fraction representation The output shows that the ContinuedFrac and EuclidAlgRational functions are inverse operations: each function undoes the action of the other. Pi = /* e = */Įach column of the table shows the continued fraction representations of a rational number. This leads to the following algorithm that computes a rational number from a finite continued fraction expansion:į = a // 1 /* trick: start with reciprocal */ do i = nrow (a )- 1 to 1 by - 1 /* evaluate from right to left */į = a *f + f /* compute new numerator */ end In the SAS/IML language (or in the SAS DATA step), you can represent each fraction as a two-element vector where the first element is the numerator of the fraction and the second is the denominator of the fraction. Continue moving to the left until all fractions are added. Then move to the left and compute the fraction Start at the right side, form the fraction s k = 1 / a k. Since every finite continued fraction corresponds to a rational number, you can modify the algorithm to compute the rational number instead of a decimal approximation.
INFINITE FRACTION CONVERTER CODE
My article about the continued fraction expansion of pi contains a few lines of SAS code that compute the decimal representation of a finite continued fraction. Notice that the decimal representation of a number does NOT have this nice property: 1/3 is rational but its decimal representation is infinite.Ĭonvert a finite continued fraction to a rational number Įvery rational number is represented by a finite sequence every irrational number requires an infinite sequence. In this continued fraction, a 0 is the integer portion of the number and the a i for i > 0 are positive integers that represent the noninteger portion.īecause all of the fractions have 1 in the numerator, the continued fraction can be compactly represented by specifying only the integers: x =. Recall that every real number x can be represented as a continued fraction:

I discussed continued fractions in a previous post about the contiunued fraction expansion of pi.
INFINITE FRACTION CONVERTER HOW TO
This article shows how to use SAS to convert a rational number into a finite continued fraction expansion and vice versa.

75-77) and in approximating the Lambert W function, which has applications in the modeling of heavy-tailed error processes. They are used in the numerical approximations of certain functions, including the evaluation of the normal cumulative distribution function (normal CDF) for large values of x (El-bolkiny, 1995, p. Continued fractions show up in surprising places.
