# Understanding FromContinuedFraction

In the detail section of the documentation page for FromContinuedFraction we read that:

FromContinuedFraction[{a1,a2,…,{b1,b2,…}}] returns the exact number whose continued fraction terms start with the ai, then consist of cyclic repetitions of the bi.

I do not quite undestand the meaning of this sentence and there are no example for this: can anyone explain what it means?

• Here: en.wikipedia.org/wiki/Continued_fraction you find what a "continued fraction" is, and the mentioned function gives what it should: the value of this continued fraction Feb 25 '20 at 9:44
• @mgamer I know what a continued fraction is, I do not understand the quoted sentence. Feb 25 '20 at 9:46

Fractions are always representable with a finite length continued fractions. Any number can be represented via an infinite continued fraction expansion. But inbetween those two extremes there are some numbers (more specifically the irrational solutions of quadratic equations), which after some initial digits exhibit a periodic continued fraction. This periodic part is what the 'cyclic repetitions of bi' refer to. Let's look at an example:

ContinuedFraction[Sqrt[3]]
FromContinuedFraction[%]
Sqrt[3] - FromContinuedFraction[{1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2}]
% // N


{1, {1, 2}}

Sqrt[3]

-989/571 + Sqrt[3]

1.77079*10^-6

Here the first 1 in {1, {1, 2}} is the leading continued fraction digit followed by an infinite number of repetitions of {1,2}. Explicitly following this pattern and computing the difference to the exact number shows how the first few digits of the expansion approximate Sqrt[3].