Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sr-murthy committed Apr 20, 2024
1 parent a167c1e commit 6e307ad
Show file tree
Hide file tree
Showing 6 changed files with 347 additions and 233 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
'networkx': ('https://networkx.org/documentation/stable/', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
'pdm': ('http://localhost:8000', None),
'pygraphviz': ('https://pygraphviz.github.io/documentation/stable/', None),
'pytest': ('https://docs.pytest.org/en/7.4.x/', None),
'python': ('https://docs.python.org/3', None),
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Prelude
sources/getting-started
sources/creating-continued-fractions
sources/exploring-continued-fractions
sources/mediants
sources/sequences
sources/contributing
sources/api-reference

Expand Down
31 changes: 20 additions & 11 deletions docs/sources/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ The ``continuedfractions`` package consists of three core libraries.

- :py:mod:`continuedfractions.lib`
- :py:mod:`continuedfractions.continuedfraction`
- :py:mod:`continuedfractions.rational_orderings`
- :py:mod:`continuedfractions.sequences`

.. note::

The :py:mod:`continuedfractions.utils` library contains internal utilities.

Each is summarised below. Or you can go straight to the :doc:`API reference <api-reference>`.

Expand All @@ -39,13 +43,13 @@ Each is summarised below. Or you can go straight to the :doc:`API reference <api
``continuedfractions.lib``
++++++++++++++++++++++++++

This is a library of standalone functions, the most important of which are summarised below.
This is a library of standalone functions:

- :py:meth:`~continuedfractions.lib.continued_fraction_rational` - generates the (ordered) sequence of elements (coefficients) of the unique simple continued fraction of a given rational number, given as a :py:class:`fractions.Fraction` instance
- :py:meth:`~continuedfractions.lib.continued_fraction_real` - generates the sequence of elements of a simple continued fraction of a real number, given as a single :py:class:`int`, :py:class:`float`, :py:class:`str`, or :py:class:`decimal.Decimal` value; the results for :py:class:`float` inputs may be approximate and not necessarily unique
- :py:meth:`~continuedfractions.lib.fraction_from_elements` - returns a :py:class:`fractions.Fraction` instance of the rational number represented by a simple continued fraction with the given sequence of elements
- :py:meth:`~continuedfractions.lib.convergent` - returns the :math:`k`-th convergent (for a positive integer :math:`k`) from a sequence of elements of a (finite) simple continued fraction; the convergent is returned as a :py:class:`fractions.Fraction` instance
- :py:meth:`~continuedfractions.lib.mediant` - returns the :math:`k`-th left or right mediant of two rational numbers, given as :py:class:`fractions.Fraction` values; the mediant is returned as a :py:class:`fractions.Fraction` instance
- :py:meth:`~continuedfractions.lib.continued_fraction_rational` - generates the (ordered) sequence of elements (coefficients) of the unique simple continued fraction of a given rational number, given as a :py:class:`fractions.Fraction` instance.
- :py:meth:`~continuedfractions.lib.continued_fraction_real` - generates the sequence of elements of a simple continued fraction of a real number, given as a single :py:class:`int`, :py:class:`float`, :py:class:`str`, or :py:class:`decimal.Decimal` value; the results for :py:class:`float` inputs may be approximate and not necessarily unique.
- :py:meth:`~continuedfractions.lib.fraction_from_elements` - returns a :py:class:`fractions.Fraction` instance of the rational number represented by a simple continued fraction with the given sequence of elements.
- :py:meth:`~continuedfractions.lib.convergent` - returns the :math:`k`-th convergent (for a positive integer :math:`k`) from a sequence of elements of a (finite) simple continued fraction; the convergent is returned as a :py:class:`fractions.Fraction` instance.
- :py:meth:`~continuedfractions.lib.mediant` - returns the :math:`k`-th left or right mediant of two rational numbers, given as :py:class:`fractions.Fraction` values; the mediant is returned as a :py:class:`fractions.Fraction` instance.

.. note::

Expand All @@ -60,9 +64,14 @@ This is a library containing a single main class:

- :py:class:`~continuedfractions.continuedfraction.ContinuedFraction` - a subclass of :py:class:`fractions.Fraction`, designed to represent (finite) simple continued fractions as Python objects, which are fully operable as rational numbers.

.. _getting-started.package-structure.continuedfractions_rational_orderings:
.. _getting-started.package-structure.continuedfractions_sequences:

``continuedfractions.sequences``
++++++++++++++++++++++++++++++++

``continuedfractions.rational_orderings``
+++++++++++++++++++++++++++++++++++++++++
This is a library of functions and classes relating to ordered sequences and structures of integers and rational numbers, such as (currently) coprime integers, Farey sequences and (in the future) the Stern-Brocot tree:

This is a library of functions relating to ordered sequences and structures of rational numbers, such as (currently) Farey sequences and (in future) the Stern-Brocot tree.
- :py:func:`~continuedfractions.sequences.coprime_integers` - returns a tuple of (positive) integers coprime (or relatively prime) to a given positive integer; the count of coprime integers returned for a given integer :math:`n` is equal to Euler's totient function :math:`\phi(n)`.
- :py:class:`~continuedfractions.sequences.KSRMTree` - an implicit/generative tree class implementation of the Kanga-Saunders-Randall-Mitchell (KSRM) disjointed ternary tree for generating pairs of (positive) coprime integers.
- :py:func:`~continuedfractions.sequences.coprime_pairs` - returns a tuple of all pairs of (positive) coprime integers :math:`<= n`. Uses :py:meth:`~continuedfractions.sequences.KSRMTree.search` to perform the search.
- :py:func:`~continuedfractions.sequences.farey_sequence` - returns a tuple of rational numbers forming the Farey sequence of order :math:`n`. Uses the :py:func:`~continuedfractions.sequences.coprime_pairs` function.
199 changes: 0 additions & 199 deletions docs/sources/mediants.rst

This file was deleted.

Loading

0 comments on commit 6e307ad

Please sign in to comment.