       Pattern matching with Dt.

• To: mathgroup at yoda.physics.unc.edu
• Subject: Pattern matching with Dt.
• From: Scott Herod <sherod at picard.colorado.edu>
• Date: Mon, 24 Aug 92 18:43:10 MDT

```I have a problem in pattern matching I need to solve.

I have two systems of partial differential equations.  One is general
and of the form

2       k
F [x,u,Du,D u,...,D u] == 0;  i = 1,..,m.
i

where x is a vector denoted by (x, x, ... , x[numind]), and
u is a vector (u1, u2, ... , uj), j = numdep.  (This is only a small
part of some code so I would like to not have to change my notation.)

The other system is more specific.  Each equation is of the form

Sum[xi[k][variables]*Dt[uJ,x[k]], {k,1,numind}] +
etaJ[variables] == 0,   J=1,...,numdep.

Examples might be

Dt[u1, x] - Dt[u2, x] == 0,
Dt[u2, {x,2}] + u1*Dt[u1,x] == 0.         (1)

and

xi[x,x,u1,u2] * Dt[u1,x] + xi[x,x,u1,u2] * Dt[u1,x] +
eta1[x,x,u1,u2]  == 0,

xi[x,x,u1,u2] * Dt[u2,x] + xi[x,x,u1,u2] * Dt[u2,x] +
eta2[x,x,u1,u2]  == 0.

(2)

What I need to do is solve system (2) for say Dt[_,x] and replace
these terms in system (1).  It is easy to do this only.

For example, the following does this.
_______________________________________________________________________

Cat[x_,y_] := ToExpression[StringJoin[ToString[x],ToString[y]]];
UnList[{x__}] := Sequence[x];

numdep = 2;
numind = 2;

var = Flatten[{Table[x[i],{i,1,numind}], Table[Cat[u,j],{j,1,numdep}] }]

rhs[i_] := (Cat[eta,i][UnList[var]] - Sum[xi[j][UnList[var]]*
Dt[Cat[u,i],x[j]], {j,1,numind-1}]) / xi[numdep][UnList[var]];

For[i=1,i<= numdep,i++,
ru[i] = Dt[Cat[u,i],x] -> rhs[i]
]
_______________________________________________________________________

However, I need the rules to also recognize that Dt[u1,x,x]
is Dt[ Dt[u1,x] , x] and Dt[u1, {x,2}] = Dt[ Dt[u1,x], x].

To extend the problem I need to create these rules for each of the
ui where i = 1, ... , numdep.

I have tried something like
_______________________________________________________________________

Unprotect[Dt];
Dt[a_,b__,x] := Hold[Dt[ Dt[a,x],b]];
Dt[a_,x,z__] := Hold[Dt[ Dt[a,x],z]];
Dt[a_,b__,x,z__] := Hold[Dt[ Dt[a,x],b,z]];
Dt[a_,{x,c_}] := Hold[Dt[ Dt[a,x],{x,c-1}]];
Dt[a_,b__,{x,c_}] := Hold[Dt[ Dt[a,x],b,{x,c-1}]];
Dt[a_,{x,c_},z__] := Hold[Dt[ Dt[a,x],z,{x,c-1}]];
Dt[a_,b__,{x,c_},z__] := Hold[Dt[ Dt[a,x],b,z,{x,c-1}]];
Protect[Dt];
_______________________________________________________________________

But I only want it to convert the derivatives when it sees
something like Dt[u2,___,x,___] not any other derivatives
w.r.t. x.

Any suggestions?  I hope this explanation is clear.

Scott Herod
Applied Mathematics