Question: How yo solve equations

I have a polynomial where one of its coefficients contains an undetermined parameter c. I want to identify which coefficient contains c and solve for c by setting that coefficient equal to zero. Since c might appear in any coefficient corresponding to any power of x, I cannot use a direct solve command when I creat a procedure. 

I have some code, but I think here should have some simple command to do this.


n := 3;
L := [3*a0 + 2*a1, -a1/3 + a0/2 + 12*a3];
vol := proc(L)

local i, res; i := 1;

while i < nops(L) + 1 do

if coeff(L[i], a3, 1) = 0

then i := i + 1;

else res := solve(L[i], a3);

return res;

end if;

end do;

end proc;
vol(L);

 

the output is   a1/36 - a0/24

          

Please Wait...