MathGroup Archive 2009

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

Search the Archive

Re: ContourPlot, equation and R.H. side of equation_Plotting problem

This works:

eqn1 = 3 x^2 + 6 y^2 == 6
ContourPlot[Evaluate@eqn1, {x, -2, 2}, {y, -2, 2}, Axes -> True]

I think this is what might be called a feature. ContourPlot has the
attribute HoldAll. Without the Evaluate it see no x and or y to substitute
values. So you obtain no numeric result and no image. When you enter the
form with the explicit equal sign, Mathematica follows a path that does
evaluate and you get the image of the curve.

The lesson is: when you don't obtain an image when you expect one, and the
plotting parameters are not manifest in the expression, use Evaluate.

David Park
djmpark at  

From: Bill [mailto:WDWNORWALK at] 


1a.) When I assign 3 x^2 + 6 y^2 == 6 to eqn1, in Mathematica like this:

eqn1=3 x^2 + 6 y^2 == 6;

I can't get ContourPlot to plot eqn1 using this code:

ContourPlot[eqn1, {x, -2, 2}, {y, -2, 2}, Axes -> True]

1b.) If I assign the equation like this without the constant on the R.H.
side in eqn2, 
ContourPlot will plot the equation as expected, using the following syntax:

eqn2=3 x^2 + 6 y^2;
ContourPlot[eqn2 == 6, {x, -2, 2}, {y, -2, 2}, Axes -> True]

Question: How can I get method 1a to work? Could you please give me code for



PS. I'm using Mathematica 6.0.1 w/ Win XP on a PC.

  • Prev by Date: Re: Copy/paste selection of a pdf on Mac
  • Next by Date: Re: ZigZag matrix rearrange
  • Previous by thread: Re: ContourPlot, equation and R.H. side of equation_Plotting problem
  • Next by thread: Replace elements in structured list