Opened 6 years ago

Last modified 3 years ago

#15326 new defect

Polynomials exhibit strange behavior when seen in a different parent ring

Reported by: davidamadore Owned by:
Priority: minor Milestone: sage-6.4
Component: algebra Keywords: polynomials
Cc: jakobkroeker 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: R.<x,y> = PolynomialRing(QQ,['x','y'],order="degrevlex")
sage: pol in R
sage: pol == x^2+y+42
sage: R(pol).degree(x)

I'm not sure why 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.

Change History (4)

comment:1 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:2 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:3 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:4 Changed 3 years ago by jakobkroeker

  • Cc jakobkroeker added

seems fixed meanwhile; needs a test?

Note: See TracTickets for help on using tickets.