#15552: enumerate_totallyreal_fields_prim does not return polynomial as 
elements of
a polynomial ring
---------------------------+------------------------
       Reporter:  ppurka   |        Owner:
           Type:  defect   |       Status:  new
       Priority:  major    |    Milestone:  sage-6.1
      Component:  algebra  |   Resolution:
       Keywords:           |    Merged in:
        Authors:           |    Reviewers:
Report Upstream:  N/A      |  Work issues:
         Branch:           |       Commit:
   Dependencies:           |     Stopgaps:
---------------------------+------------------------

Old description:

> The function `enumerate_totallyreal_fields_prim` is supposed to return,
> according to its description,
> {{{
>    OUTPUT:
>
>    the list of fields with entries "[d,f]", where "d" is the
>    discriminant and "f" is a defining polynomial, sorted by
>    discriminant.
> }}}
> Let us look at an output:
> {{{
> sage: E = enumerate_totallyreal_fields_prim(2, 10); E
> [[5, x^2 - x - 1], [8, x^2 - 2]]
> sage: E[0][1].parent()
> Interface to the PARI C library
> }}}
> We notice from here that the polynomial does not actually belong to the
> polynomial ring of `QQ`. In fact, there is no nice way to directly get
> the polynomial, as in an element of `PolynomialRing(QQ)` from `E[0][1]`,
> which can be then used to construct the number field.
>
> The only way to do this is this lengthy and tedious procedure:
> {{{
> sage: Ecoef = [QQ(_) for _ in E[0][1].list()]
> sage: x = polygen(QQ)
> sage: Epol = sum(x**i * _ for i,_ in enumerate(Ecoef))
> sage: Epol, Epol.parent()
> (x^2 - x - 1, Univariate Polynomial Ring in x over Rational Field)
> }}}
>
> The output of the function itself should give back elements of the
> polynomial ring, instead of giving us elements which are simply output of
> pari.

New description:

 The function `enumerate_totallyreal_fields_prim` is supposed to return,
 according to its description,
 {{{
    OUTPUT:

    the list of fields with entries "[d,f]", where "d" is the
    discriminant and "f" is a defining polynomial, sorted by
    discriminant.
 }}}
 Let us look at an output:
 {{{
 sage: E = enumerate_totallyreal_fields_prim(2, 10); E
 [[5, x^2 - x - 1], [8, x^2 - 2]]
 sage: E[0][1].parent()
 Interface to the PARI C library
 }}}
 We notice from here that the polynomial does not actually belong to the
 polynomial ring of `QQ`. In fact, there is no nice way to directly get the
 polynomial, as in an element of `PolynomialRing(QQ)` from `E[0][1]`, which
 can be then used to construct the number field.

 The only way to do this is this lengthy and tedious procedure:
 {{{
 sage: Ecoef = [QQ(_) for _ in E[0][1].list()]
 sage: x = polygen(QQ)
 sage: Epol = sum(x**i * _ for i,_ in enumerate(Ecoef))
 sage: Epol, Epol.parent()
 (x^2 - x - 1, Univariate Polynomial Ring in x over Rational Field)
 }}}

 The output of the function itself should give back elements of the
 polynomial ring, instead of giving us elements which are simply output of
 pari.

 ----

 Additionally,

 1. the first entry of each list should belong to Sage's `Integer` ring
 instead of being just a python `int`.
 2. the functions `enumerate_totallyreal_fields_all` and
 `enumerate_totallyreal_fields_rel` should get the same fix.

--

Comment (by ppurka):

 Replying to [comment:1 fwclarke]:
 > Yes, this should certainly be changed.  And it would also be better if
 the integer returned was a Sage `Integer`.  At the moment
 `E[0][0].factor()` fails.
 Indeed.

 This is also a problem with all the other `enumerate_totallyreal_*`
 functions.

--
Ticket URL: <http://trac.sagemath.org/ticket/15552#comment:2>
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to