How to use Collect function correctly in Maple

1.2k Views Asked by At

I have a very long equation with two variables up to the power of 5 which are multiplied by coefficients.so, I would like to write it in a polynomial form in order to know the coefficient of these variables. I already tried to use the Collect function but it is not working properly

For example, I would write it in this form

A*X^5*Y^5 + B*X^5*Y^4 ...+ Constant.

So does anyone knows how to do it in order to Get the A and B ..etc easily? Thank you

1

There are 1 best solutions below

0
On BEST ANSWER

If your original expression is assigned to raw then you can do that collecting as,

collect( expand(raw), [X,Y], distributed );

or, if you wish to do some further simplification of the coefficients,

collect (expand(raw), [X,Y], distributed, u->simplify(u) );

However if what you really want to do is pick off the coefficients then note that the following approach can get them one at a time, explicitly.

coeff( coeff( expand(raw), X^5), Y^4 );

That's not a very efficient way to do it, so if your polynomials is of very high degree and you are encountering time performance issues then please say revisit. There are much more efficient ways (better computational complexity class) to rip out all the coefficients and assign them into a table, say. But the above is a simple way to pick them off one by one.