ContinuedFraction
The regular continued fraction
Wikipedia
Continued fractionMathWorldContinuedFractionWikidataQ4115724Wolfram LanguageContinuedFraction✓Rosetta CodeContinued fractionContinuedFraction(x)the partial quotients of a rational — compute-engine's own headSageMath
continued_fraction(x)SymPylist(continued_fraction(x))ContinuedFraction(x, n)the first FromContinuedFraction(list)back to the rational — compute-engine's ownSageMath
continued_fraction(list)SymPylist(continued_fraction(list))SternBrocotPath(p, q)the same data as a word in FareySequence(n)every reduced SageMath
continued_fraction(n)SymPylist(continued_fraction(n))Details
- `ContinuedFraction` and `FromContinuedFraction` are compute-engine's, not ours — pass the RATIONAL, not a numerator and denominator, since the two-argument form means "the first
terms" - The expansion is made unique by never ending in
: is rewritten - The path is
with the LAST exponent one short — the final step is the arrival, not a turn - Consecutive Farey fractions satisfy
, which is a determinant, which is a group element - The Fibonacci fractions alternate
, the sense in which is the most irrational number
Examples
See also: ModularWord, IntegerDigits