I want to collect "coefficients" of polynomial over $x$ in some power, e.g.:
$p:=a \cdot x^3 + b \cdot x^2 + c \cdot x + d$
$collect(p, x^2) = (a\cdot x+b)\cdot x^2 + (c\cdot x+d)$
and extract those two "coefficients" to some variables
$p1:=coeff(p,x^2)$
$p2:=coeff(p,x^2,0)$
but $collect()$ is not intended for such actions. How do I do this in Maple the easiest way?
You can use
prem(p,q,x)which computes the remainder of the polynomial division of $p$ and $q$ in the variable $x$:And then by repeating the last two lines, $r$ will successively take on the values of the "coefficients" of $q^0,q^1,...,q^n$ in the original $p$.