       • To: mathgroup at yoda.physics.unc.edu
• Subject: re: Question about Cases command
• From: olness at phyvms.physics.smu.edu (Fredrick Olness (214) 768-2500 or -2495, Fax -4095)
• Date: Tue, 28 Jun 1994 17:38:56 -0500

```If you are having trouble with pattern matching, a general solution is
to use the FullForm command.  9 times out of 10, this will solve the problem.

Fred Olness
olness at phyvms.physics.smu.edu

=========================================================
In:=
myterms= {Derivative[1,2][a][x,y], Derivative[1,1][b][x,y]}

Out=
(1,2)         (1,1)
{a     [x, y], b     [x, y]}

In:=
myterms //FullForm

Out//FullForm=
List[Derivative[1, 2][a][x, y], Derivative[1, 1][b][x, y]]

In:=
Cases[test, Derivative[__][a][__]]

Out=
(1,2)
{a     [x, y]}

=================================================================
=================================================================
From:	SMTP%"sherod at gauss.colorado.edu" 28-JUN-1994 17:16:56.69
To:	mathgroup at yoda.physics.unc.edu (Mathgroup)
CC:

I am trying to grab a list of the derivatives of functions that
appears in a large list of differential equations.  I have been using
the Cases command to do this and have a question about some curious
behavior.

Consider the list of two derivatives:

In:= {Derivative[1,2][a][x,y], Derivative[1,1][b][x,y]}

3       2
d a     d b
Out= {------, ------}
1  2    1  1
dx dy   dx dy

I would like to select the derivatives of "a" .  First let's
check the Head of the terms:

In:= myterms = %;

(1,2)   (1,1)
Out= {a     , b     }

Now try to uses Cases:

In:= Cases[myterms,_Derivative[__][a]]

Out= {}

Why didn't it select the "a" term out?  Try:

In:= Cases[myterms, _Derivative[__][_]]

Out= {}

In:= Cases[myterms, _Derivative[__][__]]

3       2
d a     d b
Out= {------, ------}
1  2    1  1
dx dy   dx dy

Ok, now why must I use two underscores in this form?  ( In )
The "a" and the "b" are single elements.

BTW. Here is something which works.

In:= Select[myterms, (derivdepfn[#1] === a) &]

3
d a
Out= {------}
1  2
dx dy

Scott A. Herod
Program in Applied Mathematics