# Operator satisfies Leibniz rule

Suppose I have some symbols $a[-i]$ and $b[-j]$, where $i,j=1,\cdots,7$. The relation between them are $$a[-i]a[-j]=a[-j]a[-i],$$ $$a[-i]b[-j]=b[-j]a[-i],$$ $$b[-i]b[-j]=b[-j]b[-i],$$ I want to define a operator $T$ which maps $$a[-i]\mapsto ia[-i-1],\quad b[-i]\mapsto ib[-i-1], i=1,2,\dots,6.$$ The operator is a derivation (Leibniz rule). For example, $$T(a[-1]b[-1])=T(a[-1])b[-1]+a[-1]T(b[-1])=a[-2]b[-1]+a[-1]b[-2].$$ In general, what I want it the image of some polynomials in $a[-i]$ and $b[-j]$ under the operator $T$.

## 2 Answers

Since you want to implement Leibniz rules of differentiation, why not leverage Mathematica's D function? For example, define:

a /: D[a[n_], ϵ, NonConstants->{a,b}] := -n a[n-1]
b /: D[b[n_], ϵ, NonConstants->{a,b}] := -n b[n-1]

T[expr_] := D[expr, ϵ, NonConstants->{a,b}]


Then:

T[a[-1] b[-1]]
T[a[-1] b[-2] - a[-2] b[-1]]


a[-1] b[-2] + a[-2] b[-1]

2 a[-1] b[-3] - 2 a[-3] b[-1]

• Thanks, works perfectly for me. Sep 11 '17 at 17:14

You have 1...7 and then you have 1...6. I'll guess 1...6 might be correct.

T[a[i_ /; -5<=i<=-1]] := -i a[i-1];
T[b[i_ /; -5<=i<=-1]] := -i b[i-1];
T[a[i_] b[j_]] := T[a[i]] b[j]+a[i] T[b[j]];
T[u_ + v_] := T[u]+T[v];


Then T[a[-1] b[-1]] gives you a[-1] b[-2] + a[-2] b[-1]

and T[a[-1]b[-2]+a[-2]b[-1]] gives you 2 a[-1]b[-3]+2 a[-2]b[-2]+2 a[-3]b[-1]

and T[a[-6]] gives you a[-6].

You should check this very carefully to make certain that it does what you expect.

Then you can try to use this as a model and see if you can learn how to incorporate powers into the operator.

• Thanks, it helps a lot. Sep 11 '17 at 17:15