continuedfractions#

A simple extension of the Python fractions.Fraction standard library class for working with (finite, simple) continued fractions as Python objects.

The 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.Fraction standard library class

  • testing approximations of 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

Installation#

Install from PyPI:

pip install -U continuedfractions

or the main branch of the repo:

pip install -U git+https://github.com/sr-murthy/continuedfractions

Only standard libraries are used, and there are no 3rd party dependencies.

In terms of Python versions, any version from 3.10+ should be fine on any platform (Linux, MacOS, Windows etc.). Earlier Python versions may not work because of some aspects of type hinting.

Documentation#

Note

All graphs are generated using Graphviz (DOT language) and the edotor graphical editor. The graph source files (.dot) can be viewed here.

Indices and tables#