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, 05 Apr 2017 01:34:43 +0200How to extract exponents from a monomial in a FreeAlgebrahttps://ask.sagemath.org/question/37170/how-to-extract-exponents-from-a-monomial-in-a-freealgebra/I want something like this, or a way to get the equivalent information:
sage: S.<X,Y> = FreeAlgebra(QQ)
sage: m = X*Y*X^2
sage: m.my_exponents_function()
[(X,1),(Y,1),(X,2)]
or
sage: m.my_factor_function()
[X,Y,X,X]
would be as good or maybe better.
How can I get that information? I've looked over the available methods and can't seem to find anything. This is easy to do with Polynomial Rings.
I guess I could parse the string representation, but shouldn't there be a better way?paragonWed, 05 Apr 2017 01:34:43 +0200https://ask.sagemath.org/question/37170/