where each is a real number and for all .
To get a feeling for continued fractions, observe that
sage: continued_fraction(17/23) [0, 1, 2, 1, 5] sage: continued_fraction(e) [2, 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1, 11]Use the optional second argument bits = n to determine the precision (in bits) of the input number that is used to compute the continued fraction.
sage: continued_fraction(e, bits=20) [2, 1, 2, 1, 1, 4, 1, 1, 6] sage: continued_fraction(e, bits=30) [2, 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1]You can obtain the value of a continued fraction and even do arithmetic with continued fractions:
sage: a = continued_fraction(17/23); a [0, 1, 2, 1, 5] sage: a.value() 17/23 sage: b = continued_fraction(6/23); b [0, 3, 1, 5] sage: a + b [1]