#15326: Polynomials exhibit strange behavior when seen in a different parent
ring
----------------------------+-------------------------------
Reporter: davidamadore | Owner:
Type: defect | Status: new
Priority: minor | Milestone: sage-5.13
Component: algebra | Keywords: polynomials
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
----------------------------+-------------------------------
When a polynomial is constructed from a certain polynomial ring and a
different ring is constructed with the same indeterminates, Sage attempts
to be smart and automatically convert elements of the old ring to the new
ring (or something of the sort), but this smartness can cause very wrong
behavior:
{{{
sage: R.<x,y> = PolynomialRing(QQ,['x','y'],order="deglex")
sage: pol = x^2 + y + 42
sage: pol.degree(x)
2
sage: R.<x,y> = PolynomialRing(QQ,['x','y'],order="degrevlex")
sage: pol in R
True
sage: pol == x^2+y+42
True
sage: pol.degree(x)
1
sage: R(pol).degree(x)
2
}}}
I'm not sure why pol.degree(x) returns 1, but this is certainly wrong. An
error message of the kind "pol is not a polynomial in x" would have been
better than a wrong result.
--
Ticket URL: <http://trac.sagemath.org/ticket/15326>
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.