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

*huge* bug in multivariate polynomial substitution #6873

Closed
williamstein opened this issue Sep 3, 2009 · 3 comments
Closed

*huge* bug in multivariate polynomial substitution #6873

williamstein opened this issue Sep 3, 2009 · 3 comments

Comments

@williamstein
Copy link
Contributor

Observe:

sage: R.<x,y> = QQ[]
sage: f = x + 2*y
sage: f.subs(x=y,y=x)
3*y
sage: var('x,y')
sage: f = x + 2*y
sage: f.subs(x=y,y=x)
2*x + y

This is really really bad. Notice in the first and second substitution that the semantics are completely wrong/inconsistent. The semantics should be as in the second one in both cases.

If you do f.subs in the first case above you'll see at the bottom code using I think libsingular that is really wrong. Probably the only way to do this right will be to construct a homomorphism and apply it (?), sort of like this:

sage: R.<x,y> = QQ[]
sage: f = x + 2*y
sage: R.hom([y,x])(f)
2*x + y

Component: commutative algebra

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

@williamstein

This comment has been minimized.

@malb
Copy link
Member

malb commented Sep 3, 2009

comment:2

This is a dupe of #6482.

I think the fix is to not check whether b in a=b is a monomial but whether it is constant. If it isn't a constant we should just fall back to fast_map.

@malb
Copy link
Member

malb commented Sep 9, 2009

comment:3

Dupe of #6482

@malb malb closed this as completed Sep 9, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin removed this from the sage-4.1.2 milestone Sep 20, 2009
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

2 participants