Re: symbolic manipulation of operators
- To: mathgroup at yoda.physics.unc.edu
 - Subject: Re: symbolic manipulation of operators
 - From: victor
 - Date: Sun, 20 Sep 92 13:30:46 CDT
 
I would like to give an advice how that could work within Mathematica.
So, Alex Kasman wants to introduce the new operation
	D*u = u' + u*D
where D is a differential operator and u is a some operator.
>From the Mathematica point of view this new operation is a bit incorrect.
Because the symbol u' is understanding as a function in Mathematica. 
Derivative[_] is a functional operator and Derivative[_][u] is a function.
Thus, we have
	operator  = function + operator  ???
But we can extend the definition of Derivative to work with any operators.
Now, let we assume that D and u are operators and Derivative[_] can be
applied to any "good" operators too and Derivative[_][u] is an operator.
We what to know what D^2*u is.
D^2[u] == D[ D[u] ] = D[ Derivative[1][u] + u[D] ] ==
D[ Derivative[1][u] ]  +  D[ u[D] ] = (D is an linear operator?)
Derivative[1][ Derivative[1][u] ]  +  Derivative[1][u][ D ] +
Derivative[1][ u[D] ]  +  u[D][ D ] =
Derivative[2][u] + Derivative[1][u][D] +
Derivative[1][u][D] + u[D][D] =
Derivative[2][u] + 2 Derivative[1][u][D] + u[D^2] =
u'' + 2 u'*D + u*D^2
that is not the same to:
	D^2*u = D*(D*u)= D*(u'+u*D) = u'' + 2 u'D + D^2
That's why I am afraid maybe I didn't understand a bit that problem.
Anyway, I would continue and maybe my thoughts will be useful 
to somebody. Here I'll give some routines how to make such operations 
Clear[u]
u /: Head[u] = Operator
	(* properties of the operator u *)
(* u[A'][A''] is u[A'''] *)
u[Derivative[n_Integer][b_Symbol]][Derivative[m_Integer][b_]] :=
	u[ Derivative[n+m][b] ]/;
Head[ u ] == Operator
(* u'[A'][A''] is u'[A'''] *)
Derivative[k_Integer][s_/;Head[s] == Operator][
Derivative[n_Integer][b_Symbol]][Derivative[m_Integer][b_]] :=
	Derivative[k][s][ Derivative[n+m][b] ]
(* an extension of Derivative[_] *)
Derivative[1][ s_[p_] ] := Derivative[1][s][p] /;
Head[ s ] == Operator
	(* the multiplication of operators *)
(* the first order
There are 4 cases for the expression s2:
s2 is u
s2 is u'
s2 is u[_]
s2 is u'[_]
*)
	
Derivative[1][s1_Symbol][ s2_ ] := 
	Derivative[1][s2] + s2[Derivative[1][s1]] /;
Head[s2] == Operator || (
MatchQ[Head[s2], _Derivative ] && Head[s2[[1]]] == Operator ) ||
MatchQ[Head[s2], p_/;Head[p] == Operator] || (
MatchQ[Head[Head[s2]], _Derivative] && Head[Head[s2][[1]]] == Operator ) 
(* derivatives of the high order *)
Derivative[n_Integer/;n>1][s1_Symbol][ s2_/;Head[s2] == Operator ] := 
	Derivative[1][s1][ Derivative[n-1][s1][s2] ] 
	(* linearity *)
Derivative[n_Integer][s1_Symbol][ s2_Plus ] := 
	Derivative[1][s1][ # ]&/@ s2
Derivative[n_Integer][s1_Symbol][ m_?NumberQ s2_ ] := 
	m Derivative[1][s1][ s2 ]
>>>>>>>>>>>>>
If we will load that code we will get.
In[19]:= S'[u]
Out[19]= u[S'] + u'
In[20]:= S''[u]
Out[20]= u[S''] + u'' + 2 u'[S']
In[21]:= S'''[u]//Expand
            (3)     (3)
Out[21]= u[S   ] + u    + 3 u'[S''] + 3 u''[S']
In[22]:= S''''[u]//Expand
            (4)     (4)         (3)                    (3)
Out[22]= u[S   ] + u    + 4 u'[S   ] + 6 u''[S''] + 4 u   [S']
Here the operator S' is exactly the above "element called D",
S'' is D^2 and so on, i.e. that differential operator D is a
composition of the operator Derivative[] and a some operator S.
Victor Adamchik