| 1 | initial version |
You can try:
var('d e x')
f = 9*d^2*e^2*x^2-36*d^2*e*x^3+18*d*e^2*x^2
f.collect(x)
If your example is very complicated, you might wish to use
f.coefficients(x)
to obtain a list of the coefficients with respect to $x$.
Depending on what you are doing, it might also be useful to define the ring you are working in:
R.<x> = PolynomialRing(QQ)
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.