#17190: Error in conversion from RR['x,y'] to RR['x']
-------------------------------------+-------------------------------------
Reporter: defeo | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: commutative | Resolution:
algebra | Merged in:
Keywords: polynomials RR | Reviewers:
Authors: Bruno Grenet | Work issues:
Report Upstream: N/A | Commit:
Branch: | c546e17684c29b2e5f108440205833b55e7622d5
u/bruno/t17190_error_conversion | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Changes (by {'newvalue': u'Bruno Grenet', 'oldvalue': ''}):
* status: new => needs_review
* commit: => c546e17684c29b2e5f108440205833b55e7622d5
* author: => Bruno Grenet
Comment:
The problem was not in conversion, but rather in initialization of
univariate polynomials over `RR`, with an empty dictionary.
Before:
{{{#!python
sage: RR['x']({})
Traceback (most recent call last):
...
ValueError: max() arg is an empty sequence
}}}
After:
{{{#!python
sage: RR['x']({})
x
}}}
As a result, we also have:
{{{#!python
sage: RR['x'](RR['x,y'].0)
x
}}}
== Details ==
In the initialization of a polynomial over `RR`, if the "data" is given as
a dictionary, this dictionary is converted to a list. Before the patch,
there was an attempt to compute `max(x.keys())` where `x` is the
dictionary. If `x` is empty, this yields an error. To correct the error, I
could have add a test. Yet, a function is already specifically defined in
the class `Polynomial` to perform this conversion `dict -> list`. The new
code just uses this function.
Note that I corrected some slight formatting issues in the docstring in
other (unrelated) parts of the same file
`src/sage/rings/polynomials/polynomial_real_mpfr_dense.pyx`.
----
New commits:
||[http://git.sagemath.org/sage.git/commit/?id=98b7ca12cfe9335f9c871eda34ff9dc2ce03d3cf
98b7ca1]||{{{Rebased on 6.9beta1}}}||
||[http://git.sagemath.org/sage.git/commit/?id=6d0da248d4151d354a47e0a407aa3530dd008e77
6d0da24]||{{{One last zero_element removed + correct one doctest}}}||
||[http://git.sagemath.org/sage.git/commit/?id=dbfb5186d55ad1682014ffc92907fa1af9fc488f
dbfb518]||{{{Remove useless colons}}}||
||[http://git.sagemath.org/sage.git/commit/?id=331c7133714180023a7911c02b6bffd919511a68
331c713]||{{{#19171: New method divides}}}||
||[http://git.sagemath.org/sage.git/commit/?id=7527104d614c1d9fceb4ea992c5ebaaa98d6fdcc
7527104]||{{{#19172: Rewrite valuation for dense polynomials}}}||
||[http://git.sagemath.org/sage.git/commit/?id=22d9c6792c3e29c91db2534933f719b6187c23f7
22d9c67]||{{{#19172: valuation for sparse polynomials}}}||
||[http://git.sagemath.org/sage.git/commit/?id=c546e17684c29b2e5f108440205833b55e7622d5
c546e17]||{{{#17190: Authorize empty dictionary in initialization of
polynomial over RR}}}||
--
Ticket URL: <http://trac.sagemath.org/ticket/17190#comment:4>
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/d/optout.