Subject: Coefficients in a multivariate polynomial?
From: Richard Fateman
Date: Wed, 05 Jun 2013 06:56:16 -0700
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 list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima