On 06.03.14 10:41, François wrote: > Hello, > > I have a symbolic variable vg defined like this > vg =eg + Rg*ig - (Lg*(eg - vc - Rc*i1 + ig*(Rc + Rg)))/(L2 + Lg) > all other variables are symbolic as well. > Now I would like to extract the coefficients (made of symbolic variables Lg,Rg,Rc,L2) of the symbolic variables eg,vc,vi,i1,ig.
> With zero for the absent coefficients! I already tried > coeffs(di1,[i1 ig vc vi eg]) > but it does not return zero for the missing coefficients, which makes it worthless!
Since you have a multivariate polynomial, where would the ?missing? coefficients be? (Note that coeffs is not limited to the linear case, but think about what the output should be for coeffs(x^5*y^3+y^4+x^4*y^5+x-y,[x,y]) etc. - it would be possible to return a sparse array, of course, but that does not seem to be what you are looking for.)