Ask Your Question

Revision history [back]

click to hide/show revision 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)