How to return the monomials in a polynomial in Maple?

469 Views Asked by At

Are there some function $f$ which returns the monomials in a Laurent polynomial? For example, $f(a_1^{-1}+3b_{2,1})=[a_1^{-1}, 3b_{2,1}]$. Thank you very much.

2

There are 2 best solutions below

0
On BEST ANSWER

Another user suggested the 'op' command.

That will work provided that your polynomial has two or more terms, but if the polynomial input is itself a monomial, op will return the factors of the monomial term, which you don't want.

You could get around that with

MonomialList := e->`if`(type(e,`+`), convert(e,list), [e]);

Examples:

> MonomialList(x+y*z);
                              [y z, x]

> MonomialList(x*y*z);
                               [x y z]
0
On

You can use the "op" command. For instance

op(a+b) ;

gives you

$$a, b$$