Skip to content

sr-murthy/continuedfractions

CI CodeQL Analysis Codecov Ruff pdm-managed License: MPL 2.0 Docs PyPI version Downloads

continuedfractions

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 continuedfractions

or the main branch of this repo:

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

The documentation now consists only of an API reference. All other previous documentation has been removed to reduce maintenance.

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.Fraction standard 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