Skip to main content
fixed typo
Source Link
Michael E2
  • 244.7k
  • 18
  • 351
  • 774

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

Edit

Now if the function factors and you're only looking for the zero set, you can try the following.

g = x y^6 + y^7 + 2 x y^3 Sin[x] + 2 y^4 Sin[x] + x Sin[x]^2 + y Sin[x]^2;
ContourPlot[Evaluate[Times @@ First /@ Rest@FactorList[g]]Rest@FactorList[g] == 0], {x, -3, 3}, {y, -3, 3}]

Contour plot of g

It's somewhat nicenicer, if you don't mind the factors getting different colors, like this:

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contours of g with factors individually colored

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

Edit

Now if the function factors and you're only looking for the zero set, you can try the following.

g = x y^6 + y^7 + 2 x y^3 Sin[x] + 2 y^4 Sin[x] + x Sin[x]^2 + y Sin[x]^2;
ContourPlot[Evaluate[Times @@ First /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contour plot of g

It's somewhat nice, if you don't mind the factors getting different colors, like this:

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contours of g with factors individually colored

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

Edit

Now if the function factors and you're only looking for the zero set, you can try the following.

g = x y^6 + y^7 + 2 x y^3 Sin[x] + 2 y^4 Sin[x] + x Sin[x]^2 + y Sin[x]^2;
ContourPlot[Evaluate[Times @@ First /@ Rest@FactorList[g] == 0], {x, -3, 3}, {y, -3, 3}]

Contour plot of g

It's somewhat nicer, if you don't mind the factors getting different colors, like this:

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contours of g with factors individually colored

added 4 characters in body
Source Link
rm -rf
  • 89.3k
  • 21
  • 297
  • 479

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

Edit

Now if the function factors and you're only looking for the zero set, you can try the following.

g = x y^6 + y^7 + 2 x y^3 Sin[x] + 2 y^4 Sin[x] + x Sin[x]^2 + y Sin[x]^2;
ContourPlot[Evaluate[Times @@ First /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contour plot of g

It's somewhat nice, if you don't mind the factors getting different colors, like this:

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contours of g with factors individually colored

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

Edit

Now if the function factors and you're only looking for the zero set, you can try the following.

g = x y^6 + y^7 + 2 x y^3 Sin[x] + 2 y^4 Sin[x] + x Sin[x]^2 + y Sin[x]^2;
ContourPlot[Evaluate[Times @@ First /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contour plot of g

It's somewhat nice, if you don't mind the factors getting different colors, like this:

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contours of g with factors individually colored

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

Edit

Now if the function factors and you're only looking for the zero set, you can try the following.

g = x y^6 + y^7 + 2 x y^3 Sin[x] + 2 y^4 Sin[x] + x Sin[x]^2 + y Sin[x]^2;
ContourPlot[Evaluate[Times @@ First /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contour plot of g

It's somewhat nice, if you don't mind the factors getting different colors, like this:

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contours of g with factors individually colored

Added example
Source Link
Michael E2
  • 244.7k
  • 18
  • 351
  • 774

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

Edit

Now if the function factors and you're only looking for the zero set, you can try the following.

g = x y^6 + y^7 + 2 x y^3 Sin[x] + 2 y^4 Sin[x] + x Sin[x]^2 + y Sin[x]^2;
ContourPlot[Evaluate[Times @@ First /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contour plot of g

It's somewhat nice, if you don't mind the factors getting different colors, like this:

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contours of g with factors individually colored

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

ContourPlot seems to be based on the Intermediate Value Theorem. It finds points greater or less than the contour level, or in your case, where the value of the left hand side is greater and where it is less than the right hand side -- unless it is lucky enough to find points where the equation is satisfied exactly. In your third example (x + y + 2)^2 == 0, the left hand side is positive except along the line.

Sometimes you can get around this by putting in extra points:

ContourPlot[(x + y + 2)^2 == 0, {x, -3, 3}, {y, -3, 3}, 
 PlotPoints -> {Automatic, Table[{x, -2 - x}, {x, -3, 3, 0.01}]}]

ContourPlot of line

But it presupposes that you more or less know how to plot the contour. So why use ContourPlot? The trick doesn't work so well for curves either.

Edit

Now if the function factors and you're only looking for the zero set, you can try the following.

g = x y^6 + y^7 + 2 x y^3 Sin[x] + 2 y^4 Sin[x] + x Sin[x]^2 + y Sin[x]^2;
ContourPlot[Evaluate[Times @@ First /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contour plot of g

It's somewhat nice, if you don't mind the factors getting different colors, like this:

ContourPlot[Evaluate[First[#] == 0 & /@ Rest@FactorList[g]], {x, -3, 3}, {y, -3, 3}]

Contours of g with factors individually colored

Source Link
Michael E2
  • 244.7k
  • 18
  • 351
  • 774
Loading