# How can I limit the plot of $f(x,y)=\rm{cons}t$ to the contour that passes through an specific point?

I want to plot a curve given by $$f(x,y)\equiv y-y^3+3yx^2=0,$$ that passes through $(0,0)$ and $f(x,y) \to + \infty$ as $|x|,|y| \to \infty$. I thought of using ContourPlot to do so but when I use ContourPlot[y-y^3+3yx^2==0,{x,x_min,x_max},{y,y_min,y_max}], there are three other curves in addition to the one I want. How can I get only the one that is desired? Is there any other function that can give me the four parametric solutions to $y(u)-y(u)^3+3\, y(u)\, x(u)^2=0$?

You can also post-process the ContourPlot output to remove the lines that do not contain {0,0}:

Normal[ContourPlot[y - y^3 + 3*y*x^2 == 0, {x, -10, 10}, {y, -10, 10}]] /.
l_Line /; Not[RegionMember[l, {0, 0}]] :> Nothing

• Just learnt about Nothing! Cool. – chris Dec 6 '18 at 12:23

Your equation has a trivial solution y=0 at any x. Its plot is a straight line along the x axis. This one passes through the point (0,0). In addition to that try the following:

eq = y - y^3 + 3*y*x^2 == 0;
sl = Solve[eq, x]

(* {{x -> -(Sqrt[-1 + y^2]/Sqrt[3])}, {x -> Sqrt[-1 + y^2]/Sqrt[3]}} *)

Then one makes a parametric plot:

ParametricPlot[{{sl[[1, 1, 2]], y}, {sl[[2, 1, 2]], y}}, {y, -10, 10},
AxesLabel -> {x, y}]

returning the following:

where two colors correspond to the two above solutions. As the result, either the solution passes through the point (0,0), but f(x,y) stays indeterminate in infinity, or the solution does not pass through this point, but then f(x,y) turn into infinity at large x and y.

Have fun!

ContourPlot finds three solutions

ContourPlot[y - y^3 + 3*y*x^2 == 0, {x, -10, 10}, {y, -10, 10},FrameLabel -> {x, y}]

one of them is the solution you are looking for!

select the "right" curve:

cond = Reduce[ y - y^3 + 3*y*x^2 == 0, y] /. Or -> List
(*{y == 0, y == -Sqrt[1 + 3 x^2], y == Sqrt[1 + 3 x^2]} *)
cond /. {x -> 0, y -> 0}
(*{True, False, False}*)

y == 0 is the solution!