Overloading the * operator (for nested functions)

November 05 2011 by Garlando 5
false

0


I have a module to overload the * operator for the function f such that:

a*f(b,c,d) = f(a*b,a*c,a*d)

FPackage :=  module()option package;    export `*`;    `*` :=    overload    (      [        proc(a::algebraic, b::specfunc(anything, f))          option overload;          map2(:-`*`, a, b);       end proc      ,        proc(b::specfunc(anything, f), a::algebraic)          option overload;          map2(:-`*`, a, b);        end proc      ]    );  end module: 

 However, I would like this to work if the function f is nested i.e.

a*f(b,c,d,f(e,g)) = f(a*b,a*c,a*d,f(a*e,a*g))

However, my current implementation returns

a*f(b,c,d,f(e,g)) = f(a*b,a*c,a*d,a*f(e,g))

Mapping the eval function onto the result does not seem to cause the d*f(e,g) to get applied.

Any help would be greatly appreciated, many thanks.

 
Loading Comments & Answers

You must be logged into your MaplePrimes account in order to post a comment. If you don't have an account, you can create an account here.

     

Forgot Your Password? Create an Account