# [Maxima] Getting multivariate polynomial coefficents

Neilen Marais nmarais at sun.ac.za
Mon Jan 15 10:11:43 CST 2007

```Hi,

If I have multivariate polynomials, how can I get extract the
coefficients of the homogeneous terms? E.g.

(%i138) expand((x1+x2)^2 + x2);
(%o138) x2^2+2*x1*x2+x2+x1^2

Now I'm looking for the coeffs of x2^2, x1*x2, x^1, c, preferably as a
list. So for this example I'd want [1, 2, 1, 0].

What I actually want to do is get the weights needed to represent
any polynomial of a given homogeneous degree i.t.o. another
polynomial basis of the same function space. I'm representing a finite
element approximation as a weighted sum of a set of basis functions, set
A. Given a basis function set B that covers the same function space as set
A I'd like to find the needed weights for set B given the weights for set
A.

My thinking went along the lines of representing the basis functions of
each set i.t.o. their homogeneous coefficients thereby turning it into a
matrix problem. Is there a better way to do this that I'm missing?

Thanks
Neilen

--
you know its kind of tragic
we live in the new world
but we've lost the magic
-- Battery 9 (www.battery9.co.za)
```