# A question on using Cases [closed]

I am working on Wagon's FindRoots2D section.

Clear[f];
f[x_, y_] := x - y^2 Cos[y];
g[x_, y_] := -y + x Sin[x];
fcnVec[{x_, y_}] := {f[x, y], g[x, y]};


I am starting (still a rookie) to understand that one can get the data of any object in Mathematica. For example, a contour plot.

cp = ContourPlot[f[x, y] == 0, {x, -10, 10}, {y, -10, 10}]


I've learned that if I look at FullForm[cp], I'll see that the data is using the GraphicsComplex idea, which I have a beginner's understanding of. If I look at FullForm[Normal[cp]], then I see the Line command using the actual data points instead of indices to the GraphicsComplex data. Now, Stan Wagon uses the Cases command to get those points. I try:

Cases[Normal[cp], Line[z_] :> z]


And I get an empty set. Then I try Stan's:

Cases[Normal[cp], Line[z_] :> z, ∞]


And I get all of the points. This is where I am stuck. Why does the Infinity symbol make a difference here?

## closed as off-topic by Bob Hanlon, MarcoB, m_goldberg, Dr. belisarius, dr.blochwaveJul 20 '15 at 8:34

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, MarcoB, m_goldberg, Dr. belisarius, dr.blochwave
If this question can be reworded to fit the rules in the help center, please edit the question.

• BTW, have you seen this? – J. M. will be back soon Jul 19 '15 at 16:40
• The third argument is a level specification, as noted in the docs for Cases[]. In this case, ∞ is short for "as deep as you can go". – J. M. will be back soon Jul 19 '15 at 16:44
• @J. M. Great link to study. Thanks so much. – David Jul 19 '15 at 18:08

The explanation is readily found in the documentation of Cases.
• Cases uses standard level specifications
• The default value for levelspec in Cases is {1}
The Line expressions are not at level 1, and in fact may be at more than one level. Using ∞ as the level spec tells Cases to look at all levels.