Question: Coefficients of expressions

Hello,

Lets say I have an expression

f:=(a+b)*x1+(a^2+b^2)*(x1+x2^2)+c*(x2-x3)*a*b

and I have a list

p:=[a+b,a^2+b^2,c*b*a].

How can I get the coefficients of the element from p in f, ie,

cof=[x1,x1+x2^2, x2-x3].

such that cof[i] corresponds to p[i]?

Thanks in advance for your suggestions.

Please Wait...