Question: collecting coefficients(only variables) from Expression


I am collecting the coefficients of funciton terms(like sin, cos, log,exp,abs) form the expression. I was able to collect using the function 'coeff'. Initially am getting all functions in the expression using Indets[flat(expression, funciton)] then using seq and coeff trying to get all funcitons

expression := a*sin((a+b)/(a-b))*log(a/b)/c+a*b/c+2*sin(a+b);
numOfFuncs := numelems(indets[flat](expression, function));
Funcs := convert(indets[flat](Expression, function), list);

funcCoeffList := [seq(coeff(Expression, Funcs[i]), i = 1 .. numOfFuncs )];

funcCoeffList := [a*sin((a+b)/(a-b))/c, a*ln(a/b)/c, 2]

When there are terms of form funtion*function I would like to collect the coefficient for function*function as one term rather than two terms. simply I want to write a code which reads the functions having product between them as one term gives me back the coefficient.

Looking for the output as : [a/c,2] or [a/c,1,2];

Please Wait...