Sometimes you cannot solve for $x$ in terms of $y$ or vice versa: what to do then? One approach is to exploit NDSolve
by turning your (implicit) equation into a differential equation. The solution will give $x$ and $y$ in terms of a parameter, which is what RevolutionPlot
prefers. This requires an additional equation: I use one that parameterizes the curve by arclength, to make the interpretation of the parameter especially easy.
(The example in the question doesn't need this treatment--but it does require you to recognize that $x$ should be solved for $y$ instead of the other way around. In general neither variable will serve as a parameter: the solution becomes "multiple valued.")
Cubics already get complicated enough, so here to illustrate the procedure, and show how mechanical it is, is a manipulation of a generic cubic curve, rotated around the vertical axis. The equation of the curve is implicitly given by the function f
(controlled via two manipulated parameters b
and c
). The code converts this into a differential equation (using D
), solves it for a specified starting point $(x_0, y_0)$, and displays the revolution plot for a $100$ unit section of the curve centered at the starting point (with color representing the parameter itself). Enjoy!
Manipulate[Block[{f, x, y, u, v, t},
f[x_, y_] := x y^2 - x^3 - b x^2 y + c y^3;
{u, v} = {x, y} /. NDSolve[{D[f[x[t], y[t]], t] == 0,
x'[t]^2 + y'[t]^2 == 1, y[0] == y0, x[0] == x0}, {x, y}, {t, -50, 50}];
RevolutionPlot3D[Evaluate @ Through[u[t]], {t, -50, 50},
ColorFunction -> (ColorData["Rainbow"][#4] &), PlotStyle -> Opacity[0.9]]
],
{b, -10, 10}, {c, -10, 10}, {x0, -20, 20}, {y0, -20, 20}
]