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 close merge delete

Sort by » oldest newest most voted

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]

more 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.inject_variables()


or

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


Then

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


will return

[z^3, x*y*z^2, x^3*z^2, x^2*y^2*z]

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.