#14567: Refactor continued fractions
----------------------------------------------------------------+-----------
Reporter: vdelecroix |
Owner: vdelecroix
Type: enhancement |
Status: needs_review
Priority: major |
Milestone: sage-5.10
Component: number theory |
Resolution:
Keywords: continued fractions, numerical approximation | Work
issues:
Report Upstream: N/A |
Reviewers:
Authors: vdelecroix | Merged
in:
Dependencies: #13213, #13957, #14563, #14568 |
Stopgaps:
----------------------------------------------------------------+-----------
Description changed by vdelecroix:
Old description:
> Continued fractions (in sage.rings.contfrac) do not do what we expect:
>
> 0. categories are not properly initialized nor used.
> 1. it only deals with rational numbers
> 2. there is no dedicated method for numerical approximations (which is
> one of the first aim of continued fractions)
> 4. there is no bridge with quadratic numbers (see also #11345)
> 3. there is no bridge with words (sage.combinat.words)
>
> The patch proposed here develop some general design for dealing with
> continued fractions and solves the issues 0, 1 and 4 (and I hope 2); see
> the discussion below.
>
> {{{
> sage: K.<sqrt2> = QuadraticField(2)
> sage: cff = (sqrt2/3 + 1/4).continued_fraction(); cff
> [0; 1, (2, 1, 1, 2, 3, 2, 1, 1, 2, 5, 1, 1, 14, 1, 1, 5)*]
> sage: cff.value()
> 1/3*sqrt2 + 1/4
> }}}
> In particular we solve the question in #11345.
New description:
Continued fractions (in sage.rings.contfrac) do not do what we expect:
1. categories are not properly initialized nor used.
2. it only deals with rational numbers
3. there is no dedicated method for numerical approximations (which is
one of the first aim of continued fractions)
4. there is no bridge with quadratic numbers (see also #11345)
5. there is no bridge with words (sage.combinat.words)
The patch proposed here develop some general design for dealing with
continued fractions and solves the issues 1, 2 and 5 (and I hope 3); see
the discussion below.
{{{
sage: K.<sqrt2> = QuadraticField(2)
sage: cff = (sqrt2/3 + 1/4).continued_fraction(); cff
[0; 1, (2, 1, 1, 2, 3, 2, 1, 1, 2, 5, 1, 1, 14, 1, 1, 5)*]
sage: cff.value()
1/3*sqrt2 + 1/4
}}}
In particular we solve the question in #11345.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14567#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.