Ask Your Question
0

Can sage compute a basis for the graded parts of a graded ring?

asked 2016-08-24 22:17:12 -0500

done_with_fish gravatar image

We can define a graded ring

sage: T = TermOrder("wdeglex", (1,2))
sage: S = PolynomialRing(QQ, 'x,y', order=T)
sage: S
Multivariate Polynomial Ring in x, y over Rational Field
sage: x,y = S.gens()
sage: (x*y).degree()
3

I want to find all monomials in S of a given degree d. Can this be done in sage?

This can be done in Macaulay2 with

i1 : QQ[x, y, Degrees => {{1}, {2}}]

o1 = S

o1 : PolynomialRing

i2 : basis(4, S)

o2 = | x4 x2y y2 |

             1      3
o2 : Matrix S <--- S
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2016-08-25 11:54:04 -0500

updated 2016-08-25 11:54:34 -0500

This isn't perfect, but it's close: use GradedCommutativeAlgebra. The generators in odd degrees anti-commute, so if you want an honest polynomial algebra, double the degrees of the generators:

sage: S.<x,y> = GradedCommutativeAlgebra(QQ, degrees=(2, 4))
sage: S
Graded Commutative Algebra with generators ('x', 'y') in degrees (2, 4) with relations [0] over Rational Field
sage: (x*y).degree()
6
sage: S.basis(10)
[x*y^2, x^3*y, x^5]
edit flag offensive delete link more
0

answered 2016-08-26 14:28:05 -0500

done_with_fish gravatar image

For anyone interested, here's what I came up with.

def weighted_ring_basis(n, weights):                                            
    if not 1 in weights:                                                        
        L = weights + [1]                                                       
        X = toric_varieties.WP(L)                                               
        G = X.rational_class_group()                                            
        OO = G.gens()[0]                                                        
        basis = (n*OO).lift().sections_monomials()                              
        return [f for f in basis if not f.dict().keys()[0][len(weights)]]       
    X = toric_varieties.WP(weights)                                             
    G = X.rational_class_group()                                                
    OO = G.gens()[0]                                                            
    return (n*OO).lift().sections_monomials()
edit flag offensive delete link more

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

Stats

Asked: 2016-08-24 22:17:12 -0500

Seen: 92 times

Last updated: Aug 26 '16