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?

  • $\begingroup$ 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 $\endgroup$ – mgamer Feb 25 '20 at 9:44
  • $\begingroup$ @mgamer I know what a continued fraction is, I do not understand the quoted sentence. $\endgroup$ – mattiav27 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:

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

{1, {1, 2}}


-989/571 + Sqrt[3]


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].


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.