1
$\begingroup$

The first command below produces proper contour lines while the second command produces an empty plot. I would think that the two commands should produce the same output. What's going on?

ContourPlot[{x^2 + y^2 == .04, x^2 + y^2 == .09}, {x, -.5, .5}, {y, -.5, .5}]

ContourPlot[Table[x^2 + y^2 == k, {k, {.04, .09}}], {x, -.5, .5}, {y, -.5, .5}]

$\endgroup$
  • $\begingroup$ try ContourPlot[ Evaluate@Table[ x^2 + y^2 == k, {k, {.04, .09}}], {x, -.5, .5}, {y, -.5, .5}]? $\endgroup$ – kglr Sep 17 at 17:19
  • $\begingroup$ @kglr, That works. Please make it an answer. $\endgroup$ – Wynne Sep 17 at 21:10
2
$\begingroup$

Wrap Table in the first argument with Evaluate:

ContourPlot[Evaluate @ Table[ x^2 + y^2 == k, {k, {.04, .09}}],
  {x, -.5, .5}, {y, -.5, .5}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.