Re: what's wrong?!!
- To: mathgroup at smc.vnet.net
- Subject: [mg115679] Re: what's wrong?!!
- From: Emil Hedevang <emilhedevang at gmail.com>
- Date: Tue, 18 Jan 2011 05:49:42 -0500 (EST)
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
In the first case the two expressions, against which the alternatives of the pattern should be matched, are both on level 1 of the expression, that is, you have an expression on the form And[x,y] and the pattern matches both x and y and hence Cases returns the list {x,y}, since the level specification Infinity means "all levels from 1 and up". In the second case the expression, against which the pattern should be matched, is on level 0 of the expression, so the level specification Infinity prevents the pattern from matching the whole expression. In other words, you feed Equal[x,y] to cases but the pattern yP==_ matched neither x nor y. You are probably looking for something like the following. Cases[yP == y + x - z, yP == _, {0, Infinity}]