I have the following lines of code:

W:=sum((k^(2*i))*sum((e^(j))*w[i,j](r,t),j=0..2),i=0..2);

P:=sum((k^(2*i+1))*sum((e^(j))*w[i,j](r,t),j=0..2),i=0..2);

for c from 0 to 2 do

for d from 0 to 2 do

rw[c,d]:=coeff(coeff((k/(2*r))*(diff(W,r)*diff(P,t)-diff(W,t)*diff(P,r)),k,2*c),e,d)

end do

end do;

I mean to compute the coefficients in front of powers of e inside the coefficients in front of powers of k in the expressions W and P. However, rw[c,d] returns 0 for c between 0 and 2 and d between 0 and 2. It seems that I am missing something quite obvious because if you simply expand the expressions (k/(2*r))*(diff(W,r)*diff(P,t)-diff(W,t)*diff(P,r)) you will see non-zero coefficients.

Could anyone please shed light on this? Thank you for your help.