Ask Your Question

# Revision history [back]

Here are two options:

sage: S.<X,Y> = FreeAlgebra(QQ)
sage: m = X*Y*X^2
sage: a = m.leading_support()
sage: a.to_list()
[X, Y, X, X]


So if you have more than one term:

sage: m = X*Y*X**2 + 3*X**4*Y
sage: [a.to_list() for a in m.support()]
[[X, Y, X, X], [X, X, X, X, Y]]


You can also access raw exponent information:

sage: S.<X,Y> = FreeAlgebra(QQ)
sage: m = X*Y*X^2
sage: a = m.leading_support()
sage: a.__dict__
{'_element_list': [(0, 1), (1, 1), (0, 2)]}
sage: a.__dict__.values()[0]
[(0, 1), (1, 1), (0, 2)]


Each entry in this list is of the form (gen, power), where gen=0 corresponds to X and gen=1 corresponds to Y.