Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This should be an easy question for anyone familiar with 3D animations. I have a 2D shape denoted by the equation

       ((x-1)^2+y^2) ((x+1)^2+y^2)==1

and I want to illustrate its relation to a Horn Torus. To do this, I would like to rotate it about the $z$-axis in 3-space and have an outline of the shape be created behind it. I appreciate any help you guys can give me.

share|improve this question
Check out SphericalPlot3D – Sjoerd C. de Vries Jan 24 '14 at 6:47
up vote 2 down vote accepted

When I'm not mistaken, then the short answer is

SphericalPlot3D[Sqrt[2]*Sqrt[Cos[2*(φ + Pi/2)]], {φ, 0, Pi}, {ϕ, 0, 3/2 Pi}]

Mathematica graphics

Here a longer explanation how to achieve this. Be warned that there is surely an easier method.

First of all, you have an equation in $x$ and $y$ which cannot simply be converted into a closed-form function $f(x)$. Nevertheless, you can plot it using ContourPlot which searches for the points that fulfill your equation.

ContourPlot[((x - 1)^2 + y^2) ((x + 1)^2 + y^2) == 1, {x, -2, 2}, {y, -2, 2}]

Mathematica graphics

Here you notice that the plot is kind of radial to the origin and I had the feeling, that your equation might be simpler in polar coordinates.

expr = TransformedField["Cartesian" -> "Polar", 
  ((x - 1)^2 + y^2) ((x + 1)^2 + y^2) - 1, {x, y} -> {r, phi}] // FullSimplify
(* r^4 - 2 r^2 Cos[2 phi] *)

Indeed, this looks way better. We can solve this for r and get

expr2 = r /. Solve[expr == 0, r] // Last
(* Sqrt[2] Sqrt[Cos[2 phi]] *)

an explicit function $r(phi)$ which can be plotted in polar coordinates

PolarPlot[expr2, {phi, -Pi, Pi}]

Mathematica graphics

The only thing left is to rotate this plot about 90 degrees by adding Pi/2 to phi so that SphericalPlot3D creates the surface in the right form.

share|improve this answer
Thank you very much, hal! – user11781 Jan 24 '14 at 8:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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