Commutation with derivatives




On Fri, 18 Jun 2010, Gianluca Malato wrote:

< Hi all! I need to define a function named Tr(x) which is linear and I want it
< to commute with derivative. For example, if I write diff(Tr(f(x)),x) I want
< maxima to perform Tr(diff(f(x),x)). This must be done without using an
< explicit defintion of the Tr function, but leaving it symbolic. I tried to
< give the command assume(Tr,linear), but it doesn't work fine.
< 
< Anyone knows how to solve this problem?
 
To make Tr commute with diff try:

matchdeclare(FN,true,VV,mapatom,TR,lambda([t],featurep(t,linear))); 
tellsimpafter('diff(TR(FN),VV),TR(diff(FN,VV))); 

Then:

diff(Tr(f(x)),x);
diff(Tr(x^3+2*x*z),x);

and:

declare(Tr,linear);
diff(Tr(f(x)),x);
diff(Tr(x^3+2*x*z),x);

should return (un)simplified expressions.

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.