Question: Coeffiecent replacement

I'm trying to write some code that will rewrite an expression of the form R = expr => newExp = 0 Then take all the coeffiecents of newExp with respect to the variables (var) and replace them with new coefficients of the form a.1, a.2 etc and finally put it together with the variables again to obtain the new expression. This is the code i've got so far and it doesn't work, not used to working in maple so can't really figure out the problem... strRpm := proc(expr, var) local num, den, k, maxIndex, zeroform, R; num := numer(exd); den := denom(exd); zeroform = expand(R*den-num); C := [coeffs(zeroform, var, 'T')]; maxIndex := nops(C); for k from 1 to maxIndex do C[k] := a.k; od; C*T end;
Please Wait...