Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Multivariate polynomials again: specifying variables

I'm back looking at multivariate polynomials, with which I was last experimenting about six months ago. Suppose I have a polynomial in four variables x,y,z,w. What I need to do is:

  1. Rewrite the polynomial in terms of two of the variables (say x, y), to obtain something like Ax^2y+Bxy+Cxy^3+Dx^2y^3, where each of the coefficients A, B, C and D is a polynomial in z and w.
  2. Obtain those polynomials in z and w as a list.

I don't know in advance what powers of x and y will be in the expression, nor do I know how many terms there will be.

I would have thought this would be fairly straightforward, but I can't find an easy way to do it. In Maxima number one can be done with "collectterms", but the Sage method "collect" seems only to work on one variable at a time.