Changes between Version 1 and Version 2 of Ticket #14567


Ignore:
Timestamp:
05/12/13 18:02:59 (7 years ago)
Author:
vdelecroix
Comment:

The ticket is not yet finished but the review may start (all test pass on my computer... waiting for patchbot). Here are some questions I am not sure how to deal about.

  • How to cleanly implement numerical approximations of continued fractions (see the current (stupid) implementation of _mpfr_ in sage.rings.continued_fraction_element`) ?
  • What method name do we choose for conversion to continued fractions ? (ZZ has _integer_, QQ has _rational_ and RR has _mpfr_, ...). For now it is simply continued_fraction as the user may prefer my_number.continued_fraction() to CFF(my_number).
  • The link with words is not yet done and perhaps should be delayed to another ticket as the patch is yet 2500 lines long.
  • some of the stuff about continued fractions in sage.rings.arith should move to sage.rings.continued_fraction_field (I think I do prefer sage.rings.continued_fractions to sage.rings.continued_fraction_field...).
  • I did not check what are the Pari's fonctionnalities that may be used here

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14567

    • Property Status changed from new to needs_review
  • Ticket #14567 – Description

    v1 v2  
    11Continued fractions (in sage.rings.contfrac) do not do what we expect:
    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 words (sage.combinat.words)
    5  * there is no bridge with quadratic numbers (see also #11345)
    62
    7 Moreover, categories are not properly initialized nor used.
     3 0. categories are not properly initialized nor used.
     4 1. it only deals with rational numbers
     5 2. there is no dedicated method for numerical approximations (which is one of the first aim of continued fractions)
     6 4. there is no bridge with quadratic numbers (see also #11345)
     7 3. there is no bridge with words (sage.combinat.words)
    88
    9 The patch proposed here improves the current version by addressing the four issues above.
     9The 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.
     10
     11{{{
     12sage: K.<sqrt2> = QuadraticField(2)
     13sage: cff = (sqrt2/3 + 1/4).continued_fraction(); cff
     14[0; 1, (2, 1, 1, 2, 3, 2, 1, 1, 2, 5, 1, 1, 14, 1, 1, 5)*]
     15sage: cff.value()
     161/3*sqrt2 + 1/4
     17}}}
     18In particular we solve the question in #11345.