MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: what's wrong?!!

  • To: mathgroup at
  • Subject: [mg115679] Re: what's wrong?!!
  • From: Emil Hedevang <emilhedevang at>
  • Date: Tue, 18 Jan 2011 05:49:42 -0500 (EST)
  • Reply-to: comp.soft-sys.math.mathematica at

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}]

  • Prev by Date: Re: question about CUDA
  • Next by Date: Re: what's wrong?!!
  • Previous by thread: Re: what's wrong?!!
  • Next by thread: Re: what's wrong?!!