Re: pattern in list of derivatives
- To: mathgroup at smc.vnet.net
- Subject: [mg22729] Re: pattern in list of derivatives
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 24 Mar 2000 03:27:13 -0500 (EST)
- References: <8b9n7a$997@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Klaus Duellmann" <k.duellmann at uni-mannheim.de> wrote in message news:8b9n7a$997 at smc.vnet.net... > Dear Mathgroup Member, > > I can extract all derivatives from > > e.g. s1 = a u'[x] + a u''[x] > > by Cases[{s1}, Derivative[_][u][x],-1] and get > > {u'[x],u''[x]} > > > But for mixed derivatives > > e.g. {a u[x,y]^(0,1) + c u[x,y]^(1,1)} > > the correponding command Cases[{s1}, Derivative[_][u][x,y],-1] > doesn't work and I receive only the empty list {}. > > Any help is much appreciated! > > > Klaus Duellmann > Mannheim University > > E-mail: k.duellmann at uni-mannheim.de > Klaus, Two points: 1. u[x,y]^(1,1) will not be interpreted as a derivalive. The InputForm of what you want is Derivative[1,1][u][x,y] This can be converted to Traditional or Standard form by selecting it and using the menu Cell > Convert To. 2. Cases sees the input form (more generally, the FullForm) so we need Cases[s2, Derivative[__][u][x, y], -1] with the double underscore __ inside Derivative to match with one or more entries. Putting these together, the following works. s2 = a Derivative[0, 1][u][x, y] + c Derivative[1, 1][u][x, y]; Cases[s2, Derivative[__][u][x, y], -1] Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565