A simple extension of the Python fractions.Fraction standard library class for working with (finite, simple) continued fractions as Python objects.
Install from PyPI:
pip install -U continuedfractionsor the main branch of this repo:
pip install -U git+https://github.com/sr-murthy/continuedfractionsSee the project docs for more details, which includes the API reference.
Continued fractions are beautiful and interesting mathematical objects, with many connections in number theory and also very useful practical applications, including the rational approximation of real numbers.
The continuedfractions package is aimed at users interested in:
- working with (finite, simple) continued fractions as Python objects, in an intuitive object-oriented way
- making stateful computations involving key properties such as elements/coefficients, convergents, semiconvergents, remainders, and others
- operating on them as rationals and instances of the
fractions.Fractionstandard library class - testing approximations for irrational numbers
- exploring other related objects such as rational points in the plane, enumerations of rational numbers, mediants, and special sequences of rational numbers such as Farey sequences