Ask Your Question

How to get the graded part of a graded ring?

asked 2019-08-27 15:34:06 +0200

heluani gravatar image

I have a graded quotient of a graded polynomial ring, say something like

P  = PolynomialRing(QQ, , 'x,y,z', order=TermOrder('wdegrevlex',(1,2,3)))
I = P.ideal(x*y^2 + x^5, z*y + x^3*y)
Q = P.quotient(I)

I would like to get the vector space over QQ consisting on vectors of degree, say 9, in Q.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-04-27 20:23:14 +0200

mwageringel gravatar image

updated 2020-05-21 10:29:27 +0200

Here is a more direct way to compute this.

sage: P.<x,y,z> = PolynomialRing(QQ, order=TermOrder('wdegrevlex', (1, 2, 3)))
sage: I = P.ideal(x*y^2 + x^5, z*y + x^3*y)
sage: M9 = [P.monomial(*e) for e in WeightedIntegerVectors(9, (1, 2, 3))]
sage: [m for m in M9 if m.reduce(I) == m]
[z^3, x*y*z^2, x^3*z^2, x^2*y^2*z]

Edit: As of Sage 9.1, it is best to use:

sage: I.normal_basis(9)
[x^2*y^2*z, x^3*z^2, x*y*z^2, z^3]
edit flag offensive delete link more

answered 2019-08-27 19:25:33 +0200

updated 2019-08-27 19:29:33 +0200

This is not perfect, but it works: use GradedCommutativeAlgebra. This isn't perfect because such objects are graded commutative, not commutative, so if x and z are in odd degrees, then xz = -zx. You can deal with this by doubling all degrees to make sure nothing is in an odd degree.

P = GradedCommutativeAlgebra(QQ, names=('x', 'y', 'z'), degrees=(2, 4, 6))


P.<x,y,z> = GradedCommutativeAlgebra(QQ, degrees=(2, 4, 6))


I = P.ideal(x*y^2 + x^5, z*y + x^3*y)
Q = P.quotient(I)

will return

[z^3, x*y*z^2, x^3*z^2, x^2*y^2*z]
edit flag offensive delete link more


Thanks for the reply, I had seen another question with this answer. What I ended up doing is implementing the same basis(n) method from the source code of GradedCommutativeAlgebra in my quotient ring because I couldn't change the degrees.

heluani gravatar imageheluani ( 2019-08-28 18:07:56 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-08-27 15:34:06 +0200

Seen: 258 times

Last updated: May 21 '20