3
$\begingroup$

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.

$\endgroup$
1

2 Answers 2

3
$\begingroup$

If 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 on 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.

$\endgroup$
0
2
$\begingroup$

You are fortunate here that your implicit equation was easily converted to a simple form in spherical coordinates, as in halirutan's solution. Had the equation not readily allowed such a conversion, you can proceed in the following way.

Starting from your implicit 2D equation, and assuming that it is the $x$-$z$ cross-section of your desired surface of revolution, we can obtain the implicit equation of the surface through the substitutions $x\mapsto\sqrt{x^2+y^2}$ and $y\mapsto z$:

eq = ((x - 1)^2 + y^2) ((x + 1)^2 + y^2) == 1 /. {x -> Sqrt[x^2 + y^2], y -> z}
   ((-1 + Sqrt[x^2 + y^2])^2 + z^2) ((1 + Sqrt[x^2 + y^2])^2 + z^2) == 1

To "rationalize" the equation, one can use GroebnerBasis[]:

eq = GroebnerBasis[eq, {x, y}] // First // FullSimplify
   x^4 - 2 (y - z) (y + z) + 2 x^2 (-1 + y^2 + z^2) + (y^2 + z^2)^2

The result can now be fed into ContourPlot3D[]:

ContourPlot3D[x^4 - 2 (y - z) (y + z) + 2 x^2 (-1 + y^2 + z^2) + (y^2 + z^2)^2 == 0,
              {x, -Sqrt[2], Sqrt[2]}, {y, -Sqrt[2], Sqrt[2]}, {z, -1, 1}, 
              ContourStyle -> FaceForm[Red, Opacity[1/2, Blue]]]

lemniscatoid of revolution

Finally, here's a way to check that the spherical equation derived by halirutan is the same as the implicit Cartesian equation derived in this answer:

FullSimplify[eq /. Thread[{x, y, z} -> Sqrt[2] Sqrt[Cos[2 (φ + π/2)]]
                          {Cos[θ] Sin[φ], Sin[θ] Sin[φ], Cos[φ]}]]
   0
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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