Possible Duplicate:
Why is ContourPlot not displaying this curve?
Why do I have to put Evaluate[] here

I'm trying to plot certain contours of a function $f:\mathbb R^2\to\mathbb R$.

What I tried is the following:

ContourPlot[Table[f[x, y] == a, {a, 0, 1, 0.1}], {x, -3, 3}, {y, -3, 3}]

For some reason this doesn't work. If I first evaluate Table[f[x, y] == a, {a, 0, 1, 0.1}] and then plug the result into ContourPlot, however, it does work. I've noticed that Table[f[x, y] == a, {a, 0, 1, 0.1}] is evaluated to {False, False, ..., False} somewhere in the process if evaluated inside ContourPlot. (Which is not the same result as when evaluated separately.)

Why does this happen? What can I do to make it work?


  • $\begingroup$ Whoops, I just noticed this question: mathematica.stackexchange.com/questions/1375/…, which is a potential duplicate. $\endgroup$
    – Dejan Govc
    Jan 11 '13 at 12:30
  • 1
    $\begingroup$ ContourPlot[ Evaluate@Table[f[x, y] == a, {a, 0, 1, 0.1}], {x, -3, 3}, {y, -3, 3}] works for me indeed, for some function $\endgroup$ Jan 11 '13 at 12:46
  • 1
    $\begingroup$ Welcome to Mathematica.SE. I am closing this question in light of your comment. If you find that the answers there are not sufficient please leave a comment or flag the question to get my attention and I shall reopen it. $\endgroup$
    – Mr.Wizard
    Jan 11 '13 at 12:48