I have a ring (a matroid Chow ring) which has a large number of generators. It's structure is well-understood: it's graded, and the top degree is isomorphic to Q via a specific map, called the degree map. I know an explicit element whose image under the degree map is 1, call it a^{r-1}.
I have another element x of the matroid Chow ring, and I would like to compute it's degree. I can do that by computing x/a^{r-1}, but that is very slow (it seems to require a Grobner basis computation which does not finish on my computer).
When I ask sage to output x and a^{r-1}, sage outputs them as constant multiples of the same monomial. So from the output it is easy to read off what the degree is (look at the ratio of the monomials), but I would like to get it an automated way.
Example:
M = matroids.Uniform(4, 8)
A = M.chow_ring(QQ)
def flatToChow(F):
s = 'A'
for i in F:
s = s + str(i)
return A(s)
beta = A(0)
for i in range(1, M.rank()):
for F in M.flats(i):
if (0 not in F):
beta = beta + flatToChow(F)
a = A(0)
for i in range(1, M.rank()):
for F in M.flats(i):
if (0 in F):
a = a + flatToChow(F)
x = beta^3
x/a^3 #long time