MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Commutators and Operator Powers in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16721] Re: [mg16692] Re: Commutators and Operator Powers in Mathematica
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Mon, 22 Mar 1999 22:33:43 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

I was about to sent my answer when I noticed that  Daniel Lichtblau had
beaten me to it and I could not hope to improve on his solution. So I
stopped writing mine but then I still found one thing about his answer
that was not entirely satisfactory from my point of view. I like to work
with pure functions rather than expressions involving some arbitrarily
chosen variables like x etc. I find this approach both aesthetically more
satisfactory and also better corresponding to the way I think of
structures such as function and operator algerbas etc. So I re-wrote
Daniel's package to eliminate the need to refer to any "vars" and decided
to post it in case there are other people who share my bias in this matter.

I first attatch new rules to Plus, Times and Power to allow algebraic
operations on pure functions:

Unprotect[{Plus, Times,Power}]; 
Plus/: ((f_) + (g_))[x_] := f[x] + g[x]; 
Times/: ((k_?NumberQ )(f_))[x_] := k f[x]; 
Times/: ((f_) (g_))[x_] := f[x] g[x];
Power/:(f_^n_)[x_]:=f[x]^n ;
Protect[{Plus,Times,Power}];

Next we re-write Daniel's definitions eliminating all vars:

In[2]:=
differentialOperate[a_, fn_] /; FreeQ[a, D] := a*fn
differentialOperate[L1_ + L2_, fn_] :=
  differentialOperate[L1, fn] + differentialOperate[L2,fn]
differentialOperate[a_*L_,fn_] /; FreeQ[a, D] :=
  a*differentialOperate[L,fn]
differentialOperate[D^(n_.),fn_] := Derivative[n][fn]
differentialOperate[L1_**L2_,fn_] :=
  differentialOperate[L1, differentialOperate[L2,fn]]
differentialOperate[L1_**L2_**L3__, fn_] :=
  differentialOperate[L1, differentialOperate[L2**L3,fn]]
differentialOperate[bracket[L1_,L2_],fn_] := Expand[
  differentialOperate[L1, differentialOperate[L2,fn]] -
  differentialOperate[L2, differentialOperate[L1,fn]]]
differentialOperate[L1_^(n_.), fn_] :=
	Nest[Expand[differentialOperate[L1,#]]&,fn, n]

Now we define our operators using pure functions as coefficients:

In[3]:=
L0 = #&;
L1 = (a*#^(3/2)&)*D +( b*#^2&)*D^2;

Now, given a function f, we can define the 

In[11]:=
bracket[L0,L1][f]:=
  Function[t,differentialOperate[bracket[L0,L1],f][t]//Simplify]

This indeed is the right function, e.g.

In[12]:=
bracket[L0,L1][f][t]
Out[12]=
    3/2             2
-a t    f[t] - 2 b t  f'[t]

On Sat, Mar 20, 1999, Daniel Lichtblau <danl at wolfram.com> wrote:

>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


Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp/
http://eri2.tuins.ac.jp/



  • Prev by Date: How to make axes being seen inside a sphere in SphericalPlot3D?
  • Next by Date: Graphics in 3.0.1
  • Previous by thread: Re: Commutators and Operator Powers in Mathematica
  • Next by thread: Re: Commutators and Operator Powers in Mathematica