1 | initial version |
Not offended at all! I didn't know about this myself until now.
This works:
sage: (x*y^3).factor_list()
[(x, 1), (y, 3)]
sage: mul([x, y, y, y])
x*y^3
And, if you want to go from the factor list to the expression:
sage: a = (x*y^3).factor_list()
sage: mul(map(lambda x: x[0]^x[1], a))
x*y^3
Hope this helps!
2 | No.2 Revision |
Not offended at all! I didn't know about this myself until now.
This works:
sage: (x*y^3).factor_list()
[(x, 1), (y, 3)]
sage: mul([x, y, y, y])
x*y^3
And, if you want to go from the factor list to the expression:
sage: a = (x*y^3).factor_list()
sage: mul(map(lambda x: x[0]^x[1], a))
mul(t^m for t, m in a)
x*y^3
Hope this helps!