it fails. I also noticed that values are assigned to variables x and y after executing ContourPlot3D. There's something that I don't understand about workings of ContourPlot. Could anyone explain what's going on and how should I pass the equation in a variable?

UPDATE

As m_goldberg wrote in his answer, in a bug-free Mathematica it is not necessary to defer evaluation so eq = 2 x - y == 0 works fine. The call to Evaluate is still required. But it seems to me that eq and 2x - y == 0 should evaluate to the same expression:

In[33]:= eq === 1 + 2 x == 0
Out[33]= True

So what's difference between these two expressions, which causes them to behave differently in ContourPlot3D? How can I see this difference in Mathematica environment?

Regarding your penultimate question, eq only becomes 2x-y==0 when it is evaluated. Before evaluation eq has head Symbol (and 2x-y==0 has head Equal). ContourPlot3D has the HoldAll attribute, so eq is passed to it in unevaluated form. My guess is that when ContourPlot3D tests its first argument to see if it's of the form a==b, it does so without evaluating it, and so ends up treating eq as a numerical function rather than an equality. Certainly a Trace shows eq being sampled at various points in the volume (almost all of which evaluate to False of course).
–
Simon WoodsFeb 22 '13 at 21:10

Thank you! That worked. But I still don't understand something. First, why does eq = 2 x - y == 0 evaluate to false? And second, how do values from ContourPlot3D get assigned to x and y? I assume these two questions are related, but cannot figure out how.
–
MaxFeb 21 '13 at 16:52

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.