Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polynomials exhibit strange behavior when seen in a different parent ring #15326

Open
sagetrac-davidamadore mannequin opened this issue Oct 25, 2013 · 1 comment
Open

Comments

@sagetrac-davidamadore
Copy link
Mannequin

sagetrac-davidamadore mannequin commented Oct 25, 2013

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.

CC: @sagetrac-jakobkroeker

Component: algebra

Keywords: polynomials

Issue created by migration from https://trac.sagemath.org/ticket/15326

@sagetrac-davidamadore sagetrac-davidamadore mannequin added this to the sage-6.1 milestone Oct 25, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@sagetrac-jakobkroeker
Copy link
Mannequin

sagetrac-jakobkroeker mannequin commented Feb 26, 2017

comment:4

seems fixed meanwhile; needs a test?

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant