Re: Commutators and Operator Powers in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg16692] Re: Commutators and Operator Powers in Mathematica
- From: Daniel Lichtblau <danl>
- Date: Sat, 20 Mar 1999 02:09:03 -0500
- Organization: Wolfram Research, Inc.
- References: <7ct2c2$83g@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Alan Lewis wrote: > > I am looking for any links or suggestions on implementing > commutation relations and powers of differential operators > in mathematica. > > As an example, I have two operators L0 and L1 that act on arbitrary > (well say infinitely differentiable) functions f[x] > > L0 simply multiplies f[x] by x. > L1 = a x^(3/2) D[f[x],x] + b x^2 D[f[x],{x,2}] > > where a,b are constants independent of x. The second line is not > meant to be working math. code but is just meant to explain the action > of this differential operator. > > Now what I want to do is be able to evaluate repeated commutators > and powers of these operators. For example, the first commutator > should evaluate to: > > [L0,L1]f[x] = x L1 f[x] - L1 (x f[x]) = > > -a x^(3/2) f[x] - 2 b x^2 D[f[x],x] > > I would also like to evaluate powers such as > L1^n, meaning the operator acts on f[x] n times. Repeated > commutators are expressions like > > [L1,[L0,L1]] or [L0,[L0,L1]], etc. > > The action of L1 is just an example, but the general class of operators > I am interested in are always the sum of a first and second derivative > with simple expressions like the above in front of the derivative. > And L0 is always multiplication by x. > > Thanks in advance for any suggestions, > Alan Here is some code to tangle with differential operators. differentialOperate[a_, expr_, var_] /; FreeQ[a, D] := a*expr differentialOperate[L1_ + L2_, expr_, var_] := differentialOperate[L1, expr, var] + differentialOperate[L2, expr, var] differentialOperate[a_*L_, expr_, var_] /; FreeQ[a, D] := a*differentialOperate[L, expr, var] differentialOperate[D^(n_.), expr_, var_] := D[expr, {var, n}] differentialOperate[L1_**L2_, expr_, var_] := differentialOperate[L1, differentialOperate[L2, expr, var], var] differentialOperate[L1_**L2_**L3__, expr_, var_] := differentialOperate[L1, differentialOperate[L2**L3, expr, var], var] differentialOperate[bracket[L1_,L2_], expr_, var_] := Expand[ differentialOperate[L1, differentialOperate[L2, expr, var], var] - differentialOperate[L2, differentialOperate[L1, expr, var], var]] differentialOperate[L1_^(n_.), expr_, var_] := Nest[Expand[differentialOperate[L1,#,var]]&, expr, n] For your examples, one has L0 = x; L1 = a*x^(3/2)*D + b*x^2*D^2; Then In[12]:= differentialOperate[bracket[L0,L1], f[x], x] 3/2 2 Out[12]= -(a x f[x]) - 2 b x f'[x] In[21]:= e1 = Expand[differentialOperate[L1, f[x], x]] 3/2 2 Out[21]= a x f'[x] + b x f''[x] In[22]:= e2 = Expand[differentialOperate[L1, e1, x]] 3/2 2 2 3 a b x f'[x] 3 a x f'[x] 2 2 Out[22]= ---------------- + ------------- + 2 b x f''[x] + 4 2 5/2 2 3 2 3 (3) > 5 a b x f''[x] + a x f''[x] + 4 b x f [x] + 7/2 (3) 2 4 (4) > 2 a b x f [x] + b x f [x] In[23]:= differentialOperate[L1^2, f[x], x] == e2 Out[23]= True A slightly cruder version of this may all be found in a notebook I prepared for the 1998 Worldwide Mathematica Users Conference, a copy of which can be found at: http://www.wolfram.com/conference98/schedule/symbolic_FAQ.html in the section "Some noncommutative algebraic manipulation". There is also some code therein to do algebraic simplification in a commutator algebra which may be of relevance. Daniel Lichtblau Wolfram Research