| 1 | initial version |
If possible, avoid using symbolic variables (with var).
Instead, define a polynomial ring, and work there.
To get the coefficients in a multivariate polynomial ring, use list.
This will give you a list of pairs (c, m) where c is a coefficient and m is a monomial.
Here is an example, to give you an idea.
sage: R.<xi, eta> = PolynomialRing(QQ)
sage: P = 3*eta - 1
sage: Q = 5 * eta * xi - 7 * eta^2 + 2 * xi^3 - 1
sage: list(P)
[(3, eta), (-1, 1)]
sage: list(Q)
[(2, xi^3), (5, xi*eta), (-7, eta^2), (-1, 1)]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.