2
$\begingroup$

I am looking to plot the real zeros of polynomials of two variables in Mathematica, but I have encountered an issue. To accomplish this task I have been using ContourPlot to plot the polynonial f(x,y)=0. For example see below: Example Plot for a 2-variable polynomial

Although I am getting the contour plot, there seems to be regions where the X and Y axis is "broken". I am considering polynomials which have form:`$\sum_{k=1}^3\sum_{l=1}^3 a_{k,l}x^ky^l$, thus the X and Y axis should always be real roots of the polynomial. Thus I think Mathematica is mixing up real and complex zeros possibly, and I was wondering if there is a way to remedy this issue as all I want are the real zero plots of these 2-variable polynomials.

$\endgroup$
1
  • 3
    $\begingroup$ To facilitate people assisting you, post copiable code blocks, not images of code. $\endgroup$
    – Bob Hanlon
    May 24, 2016 at 1:14

1 Answer 1

5
$\begingroup$

The reason why the contour is broken is because ContourPlot seems to be based on the Intermediate Value Theorem and it will fail to find points where the function just touches zero. The details have been discussed in the post Problem with ContourPlot.

For your question, you can first factor out x and y, then the contour will be fine:

P[x_, y_] := 
 0.226594 x y - 0.682774 x^2 y + 0.32404 x^3 y - 0.61382 x y^2 - 
  0.327897 x^2 y^2 + 0.124664 x^3 y^2 + 0.215339 x y^3 - 
  0.220948 x^2 y^3 + 0.698364 x^3 y^3

G[x_, y_] = P[x, y]/x/y // Simplify;

ContourPlot[G[x, y], {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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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