The combine method



 From: shinabe.munehiro at hotmail.co.jp
To: maxima at math.utexas.edu
Subject: The combine method
Date: Sat, 4 May 2013 14:02:36 +0900




 >>The function inverse_additive could follow the same pattern--just substitute a lambda form for "+".  If you try this method and get stuck, let us know. I can do it !   I used "funmake(f, inverse_outative(q,f))" in "inverse_additive(e,f)". But should I use "funmake(f, q)" ? Why not the infinite loop come about?Please give any advice.  kill(all)$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)$ inverse_additive(e,f) :=
 subst("+" = lambda([[l]],
  block([listarith : true, q : 0, lx, r:0],
   for  lx in l  do (
    if not mapatom(lx) and op(lx)=f then (lx : args(lx),q : q +lx) else r:r+lx
   ),
   funmake(f, inverse_outative(q,f))+r)
  ), e)$ s1:5*f(x) + 7*f(y) +42$s2:inverse_outative(s1,f)$inverse_additive(s2,f)$ f(7*y+5*x)+42 But I can do this.s1:5*f(x) + 7*f(y) +3*f(z)+42$s2:inverse_outative(s1,f)$inverse_additive(s2,f)$ f(3*z+7*y+5*x)+42