I would like to define a derivation in Mathematica. As an example something like this: for an operator O and operators $A,B$ in a two dimensional vector space with $$ O \times A = a \\ O \times B = b \\ $$ I would like that Mathematica can calculate for me

$$ O\times (A B) = (O \times A ) B + A (O \times B) = a B + A b $$

I am interested in having a whole finite dimensional ring $R$ of operators $A,B,C, \ldots$ and I need Mathematica to be able to understand that any operation of the form $$ O \times Sym(R) $$ is supposed to be a derivation.


You can use

o@(a_ ** b_) := o@a ** b + a ** o@b
o@(a_Plus) := o /@ a

With this,

o@(A ** B)                        (* A ** o[B] + o[A] ** B *)
% /. {o ** A -> a, o ** B -> b}   (* a ** B + A ** b *)

You can also use TensorProduct instead of NonCommutativeMultiply for a better looking output.


Your Answer

