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

Ideal with no generators for univariate polynomial rings #11139

Closed
sagetrac-mraum mannequin opened this issue Apr 6, 2011 · 19 comments
Closed

Ideal with no generators for univariate polynomial rings #11139

sagetrac-mraum mannequin opened this issue Apr 6, 2011 · 19 comments

Comments

@sagetrac-mraum
Copy link
Mannequin

sagetrac-mraum mannequin commented Apr 6, 2011

Consider the following (Sage 4.7alpha1) :

sage: P.<a> = QQ[]
sage: P.ideal([])
Booom!

The issue is twofold: The ideal method in rings/rings.py is called and does not accept an empty list. But also the univariate polynomial rings should call a specialized method just like the multivariate ones do.

It worked in earlier versions (like 4.2 or so) and is a construction that easily comes up as a corner case.

Apply attachment: 11139_alternative.patch.

Component: commutative algebra

Author: Martin Raum, Jeroen Demeyer

Reviewer: John Palmieri, Martin Raum

Merged: sage-4.7.1.alpha1

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

@sagetrac-mraum sagetrac-mraum mannequin added this to the sage-4.7 milestone Apr 6, 2011
@sagetrac-mraum sagetrac-mraum mannequin assigned malb Apr 6, 2011
@sagetrac-mraum
Copy link
Mannequin Author

sagetrac-mraum mannequin commented Apr 6, 2011

@jhpalmieri
Copy link
Member

Author: Martin Raum

@jhpalmieri
Copy link
Member

Reviewer: John Palmieri

@jhpalmieri
Copy link
Member

comment:1

I'm happy with this. Here's a new patch with a few doctests illustrating that the problem has been fixed.

I'm going to mark this as "needs review"; it wouldn't hurt to have someone else look it over.

@jhpalmieri
Copy link
Member

@jhpalmieri

This comment has been minimized.

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

Changed author from Martin Raum to Martin Raum, Jeroen Demeyer

@jdemeyer
Copy link

comment:3

What do you think of this alternative patch? IMHO, it has better logic.

@sagetrac-mraum
Copy link
Mannequin Author

sagetrac-mraum mannequin commented Apr 25, 2011

comment:4

I think that indeed the logic is much better. Though it might be confusing to beginners. But this improvement brings my attention to a problem, that has been there before:

R.<x> = QQ[]
R.ideal((x for _ in range(2)))

This is an instance of GeneratorType, that is called with len. So either we exclude the GeneratorType (no change to the situtation before) or correct it. Also, mind that a ring element might be an instance of GeneratorType. In that (very exceptional) situation, the new logic would cause trouble.

Any experience with similar code at other places in Sage?

@jdemeyer
Copy link

comment:5

Replying to @sagetrac-mraum:

This is an instance of GeneratorType, that is called with len. So either we exclude the GeneratorType (no change to the situtation before) or correct it.

I would say not to check for GeneratorType. I have added a new patch for this. I still have to test it thoroughly.

@jdemeyer
Copy link

Alternative patch, apply only this

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

comment:6

Attachment: 11139_alternative.patch.gz

Patch tested, all tests passed.

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

jdemeyer commented May 6, 2011

comment:8

Any reviewers?

@sagetrac-mraum
Copy link
Mannequin Author

sagetrac-mraum mannequin commented May 6, 2011

comment:9

I think, since I haven't written this ultimate patch, I am a legitimate reviewer. All tests pass and also the patch bot does not complain. Although we have changed the logic, backward compatibility is preserved.

@sagetrac-mraum
Copy link
Mannequin Author

sagetrac-mraum mannequin commented May 6, 2011

Changed reviewer from John Palmieri to John Palmieri, Martin Raum

@jdemeyer
Copy link

jdemeyer commented May 7, 2011

Merged: sage-4.7.1.alpha1

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

3 participants