Question: extract the matrix coefficient of polynomial matrix?

 Let M be a matrix with polynomial array f_i's such that any array is in K[a_1,..,a_m][x_1,..,x_n] where a=a_1,,,a_m are sequence of parameters and x=x_1,..,x_n are sequense of variables. Now, I want to extract the coefficients of  f_i that are in K[a_1,a_2,..,a_m]. For example if M=Matrix([[ax-bxy],[cx^2-dy]]) how can I extract the matrix coefficint C=Matrix([[a,-b],[c,-d]])?

Please note that a,b,c,d are parameters and x,y are variables.

Please Wait...