symbolic manipulation of operators
- To: mathgroup at yoda.physics.unc.edu
- Subject: symbolic manipulation of operators
- From: deutsch at bu-pub.bu.edu
- Date: Fri, 18 Sep 92 08:52:36 -0400
Hello Mathgroup, This question was sent to me from Alex Kasman, Dept. of Mathematics, Boston University. If anyone has experience creating the type of operator described below, we would appreciate hearing from you. Thank you, David Deutsch Information Technology Boston University deutsch at bu-it.bu.edu ------------------------------------------------------------------ I need to have multiplicative differential operators. They MOSTLY act just like multiplication, the only difference is that there is also an element called D which, when multiplied by u behaves like this: D*u = u' + u*D You will note that this cannot be a commutative multiplication since D*u NOT= u*D. I would like D^2*u = D*(D*u)= D*(u'+u*D) = u'' + 2 u'D + D^2 and so on for higher powers of D (although I will probably never get past D^4 in my applications.) The way that I TRIED to do this was to turn off the commutativity of Mathematica's "Times" function and teach it how to treat D. This worked fine...EXCEPT, matrix multiplication, Simplify, Expand, simple subtraction(!) and many other operations still assume that multiplication is commutative. Consequently, whenever I try to do anything, I get recursion overflow errors (since the D keeps moving back and forth) and loads of mathematical errors (which look like a+b-a=2a+b !!) etc. For example, I can correctly calculuate D*u and u*D. However, it won't do D*u-u*D because something in the subtraction process tries to simplify things in a way that assumes multiplication to be commutative. It is necessary that the action of D be done via multiplication because the eventual goal is to multiply and add matrices made up of differential operators. Please contact me with questions or comments. I know my request is a difficult one; I will do my best to explain it to you in greater detail if you think you can help. Thanks Alex P.S. Here is what I did in attempting to get this all to work: Unprotect[Times] Attributes[Times]={OneIdentity,Flat,Listable} Times[d,u_]=u'+u*d Times[d,0]=0 Times[d,d,u_]=u''+2u'*d+u*d^2 Times[d,d,d,u]=u'''+2u''*d+2u'*d^2+u'''*d^3 Times[dd,u_]=u''+2u'*d+u*d^2 Times[ddd,u_]=u'''+3u''*d+3u'*d^2+u'''*d^3 Times[(d+u_),v_]=d*v+u*v Times[v_,(d+u_)]=v*d+v*u Times[(dd+u_),v_]=dd*v+u*v Times[v_,(dd+u_)]=v*dd+v*u Times[(ddd+u_),v_]=ddd*v+u*v Times[v_,(ddd+u_)]=v*ddd+v*u Times[d,d]=dd Times[dd,d]=ddd Times[d,dd]=ddd Times[d,d,d]=ddd Protect[Times] Unprotect[Power] Power[d,2]=dd Power[d,3]=ddd Protect[Times] d'=0 SimpleLax[exp_]:=Collect[exp/.{d->D,dd->D^2,ddd->D^3},{D,I}] LaxMul[x_,y_]:=SimpleLax[x*y] Lax[v_,w_]:=MatrixForm[{{LaxMul[v[[1,1]],w[[1,1]]]+LaxMul[v[[2,1]],w[[1,2]]] -LaxMul[w[[1,1]],v[[1,1]]]-LaxMul[w[[2,1]],v[[1,2]]], LaxMul[v[[1,1]],w[[2,1]]]+LaxMul[v[[2,1]],w[[2,2]]] -LaxMul[w[[1,1]],v[[2,1]]]-LaxMul[w[[2,1]],v[[2,2]]]}, {LaxMul[v[[1,2]],w[[1,1]]]+LaxMul[v[[2,2]],w[[1,2]]] -LaxMul[w[[1,2]],v[[1,1]]]-LaxMul[w[[2,2]],v[[1,2]]], LaxMul[v[[1,2]],w[[2,1]]]+LaxMul[v[[2,2]],w[[2,2]]] -LaxMul[w[[1,2]],v[[2,1]]]-LaxMul[w[[2,2]],v[[2,2]]]}}]