The combine method



> My favorite method for doing things such as a * f(x) --> f(a*x) is to substitute a lambda form for multiplication.

Each quoted f needs to be replaced by unquoted f:

inverse_outative(e,f) := subst("*" = lambda([[l]], block([listarith : true, farg : false, q : 1, lx],
  for  lx in l  do (
     if farg=false and not mapatom(lx) and op(lx)=f  then (
       farg : true,
       lx : args(lx)),   
     q : q * lx), 
  if farg then funmake(f, inverse_outative(q,f)) else q)), e)$

Oops:

 (%i2) (f : g, g : h, h : k);
 (%o2) k

 (%i3) inverse_outative(5*f(f(x)), f);
 (%o3) 5*k(k(x))

Maxima's evaluation policy does

 (%i12) f(x);
 (%o12) k(x)

 (%i13) f;
 (%o13) g

--Barton

________________________________________


_