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

problem with _mpoly_dict_recursive() #2601

Closed
sagetrac-mhampton mannequin opened this issue Mar 19, 2008 · 5 comments
Closed

problem with _mpoly_dict_recursive() #2601

sagetrac-mhampton mannequin opened this issue Mar 19, 2008 · 5 comments

Comments

@sagetrac-mhampton
Copy link
Mannequin

sagetrac-mhampton mannequin commented Mar 19, 2008

The following produces errors:

sage: testR.<a,b,c> = PolynomialRing(QQ,3)
sage: id_ringA = ideal([a^2-b,b^2-c,c^2-a])
sage: id_ringB = ideal(id_ringA.gens()).change_ring(PolynomialRing(QQ,'c,b,a')) 

although this does not:

sage: testR.<a,b,c> = PolynomialRing(QQ,3)
sage: id_ringA = ideal([a^2-b,b^2-c,c^2-a])
sage: id_ringB = ideal(id_ringA.gens()).change_ring(PolynomialRing(QQ,'c,a,b')) 

Component: commutative algebra

Keywords: ideal, change_ring

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

@sagetrac-mhampton sagetrac-mhampton mannequin added this to the sage-3.4.1 milestone Mar 19, 2008
@sagetrac-mhampton sagetrac-mhampton mannequin assigned malb Mar 19, 2008
@aghitza
Copy link

aghitza commented Mar 20, 2008

comment:1

I don't know what's happening, but maybe the following simpler example will help someone figure it out:

sage: R.<a,b,c> = PolynomialRing(QQ, 3)
sage: P = PolynomialRing(QQ, 'c, b, a')
sage: Q = PolynomialRing(QQ, 'c, a, b')
sage: Q(a)
a
sage: P(a)
...
<type 'exceptions.IndexError'>: list assignment index out of range

Note also that out of the 6 permutations of 'a, b, c', only 'c, b, a' and 'b, c, a' throw this exception; the other 4 seem to work properly.

@aghitza
Copy link

aghitza commented Mar 28, 2008

comment:2

I believe the problem is in _mpoly_dict_recursive() in multi_polynomial.pyx:

sage: R.<a,b,c> = PolynomialRing(QQ, 3)
sage: a._mpoly_dict_recursive(['c', 'b', 'a'])
---------------------------------------------------------------------------
<type 'exceptions.IndexError'>            Traceback (most recent call last)

/root/<ipython console> in <module>()

/root/multi_polynomial.pyx in sage.rings.polynomial.multi_polynomial.MPolynomial._mpoly_dict_recursive()

<type 'exceptions.IndexError'>: list assignment index out of range

This should return {(0, 0, 1): 1}. I'm having trouble understanding exactly how the code works so I'm giving up on trying to fix this. Someone familiar with the code should be able to do this properly, and much faster than me.

@aghitza aghitza changed the title problem with change_ring problem with _mpoly_dict_recursive() Mar 28, 2008
@williamstein
Copy link
Contributor

Attachment: trac_2601.patch.gz

@aghitza
Copy link

aghitza commented Jan 27, 2009

comment:5

Looks good to me.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Jan 28, 2009

comment:6

Merged in Sage 3.3.alpha3

@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Jan 28, 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

3 participants