ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 02 Nov 2022 00:58:58 +0100Computing ratio of two elements in a large ringhttps://ask.sagemath.org/question/64736/computing-ratio-of-two-elements-in-a-large-ring/ 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
vukovWed, 02 Nov 2022 00:58:58 +0100https://ask.sagemath.org/question/64736/