0

I am trying to draw the contour lines of the following function, but I don't understand why the contour lines with value 0.5 and -0.5 are shown in dashed lines.

$f(x,y)=\dfrac{xy}{x^2+y^2}$

ContourPlot[{x*y/(x^2 + y^2) == 0.5, x*y/(x^2 + y^2) == -0.5, x*y/(x^2 + y^2) == -0.2}, {x, -2,2}, {y, -2, 2}]

Result from Mathematica

David R
  • 111
  • 3
  • 1
    Note that $\frac{x y}{x^2+y^2}=\pm 0.5$ is equivalent to $(x\pm y)^2=0$, so those contours are zero-touching, not zero-crossing. Further discussion is in the referenced duplicate. – Carl Woll Jun 14 '17 at 21:52
  • 1
    In this case there's a simple workaround that I don't see mentioned in the duplicate. Try ContourPlot[x*y/(x^2 + y^2) == 1/2, {x, -2, 2}, {y, -2, 2}, WorkingPrecision -> #] & /@ {MachinePrecision, 10} – Jason B. Jun 14 '17 at 21:54
  • @JasonB. Many thanks. What's the solution when x*y/(x^2+y^2)==-1/2? – David R Jun 14 '17 at 22:11
  • @DavidR - Plot[-x, {x,-2,2}]? Sorry, I can't seem to get that one to work as easily (try setting the WorkingPrecision to Infinity for amusement). This seems to work, but it's a hack ContourPlot[x*y/(x^2 + y^2) == -.499999, {x, -2, 2}, {y, -2, 2}] – Jason B. Jun 14 '17 at 22:23
  • @JasonB. Thanks a lot. – David R Jun 15 '17 at 00:19

0 Answers0