Coefficients in a multivariate polynomial?



Thanks - but how do I obtain a list of all coefficients?  That is, with an
input, say, of

(1-a^2)xy^2+(a^2-b-c)xyz+(2a-b^2+c)yz^2

I want the expressions

1-a^2, a^2-b-c, 2a-b^2+c

returned.  I guess I would need to tell Maxima which are the polynomial
variables (in this case x, y and z), and somehow pull out the rest.  But
how?

Thanks again,
Alasdair


On Wed, Jun 5, 2013 at 11:56 PM, Richard Fateman
<fateman at eecs.berkeley.edu>wrote:

>  you could try this:
>
> r:rat(ex);
>
> ratsubst(0,z, ratcoef(r,x^2*y))
>
> unfortunately, picking out the coefficient of z^0  is a little tricky, so
> I used a substitution.
>
> It is much faster to do rat() than expand().
> RJF
>
>
>
> On 6/5/2013 6:32 AM, Alasdair McAndrew wrote:
>
>      Suppose I want to find the coefficient of x^2y in the expansion of
>
>  (x-2*y+3*z-4)^5
>
>  I can do:
>
>  (%i1) ex:expand((x-2*y+3*z-4)^5);
>  (%i2) coeff(coeff(coeff(ex,x,2),y,1),z,0);
>
>  But surely there must be a simpler way than calling three nested coeff's?
>
>  What I have is an expression which may be considered as a multivariate
> polynomial, the coefficients being themselves expressions; something like
>
>  (1-a^2)xy-(a-b)x^2y+(a-b^2+c)xy^2+...
>
>  I need to be able to extract the coefficients: 1-a^2, a-b, a-b^2+c from
> this expression.  Is there an easy way to do this in Maxima?
>
>  Thanks,
> Alasdair
>
> --
> Blog: http://amca01.wordpress.com
> Web:  http://sites.google.com/site/amca01/
> Facebook: http://www.facebook.com/alasdair.mcandrew
>
>
> _______________________________________________
> Maxima mailing listMaxima at math.utexas.eduhttp://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>


-- 
Blog: http://amca01.wordpress.com
Web:  http://sites.google.com/site/amca01/
Facebook: http://www.facebook.com/alasdair.mcandrew