Taking the equation $x^2-y^2-z^2=1$ and using ContourPlot3D:
ContourPlot3D[
x^2 - y^2 - z^2 == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}]
Yields the proper image.
Then I made substitutions and put it in spherical coordinate form. Note: Mathematica uses $\theta$ for the angle from the positive z-axis and $\phi$ for the angle of rotation in the xy-plane (or around the z-axis).
$$\begin{align*} x^2-y^2-z^2&=1\\ (\rho\sin\theta\cos\phi)^2-(\rho\sin\theta\sin\phi)^2-(\rho\cos\theta)^2&=1\\ \rho^2(\sin^2\theta\cos^2\phi-\sin^2\theta\sin^2\phi-\cos^2\theta)&=1\\ \rho^2(\sin^2\theta\cos 2\phi-\cos^2\theta)&=1 \end{align*}$$
Which gives:
$$\rho=\sqrt{\frac{1}{\sin^2\theta\cos2\phi-\cos^2\theta)}}$$
Now I gave SphericalPlot3D a chance:
SphericalPlot3D[Sqrt[1/(Sin[θ]^2 Cos[2 ϕ] - Cos[θ]^2)],
{θ, π/4, 3 π/4}, {ϕ, -π/4, π/4}]
But look at the image:
Yuk! Any thoughts?
Great Answer from Simon Rochester
But there are still a couple of weird things going on that I don't understand.
Suppose we define our region function such that $0<r<7$.
SphericalPlot3D[Sqrt[1/(Sin[θ]^2 Cos[2 ϕ] - Cos[θ]^2)],
{θ, 0, π}, {ϕ, 0, 2 π}, MaxRecursion -> 4,
PlotRange -> {-3, 3},
RegionFunction -> Function[{x, y, z, θ, ϕ, r}, 0 < r < 7]]
Look what happens.
Weird!
Secondly, consider the contour plot of $x^2-y^2=1$.
ContourPlot[x^2 - y^2 == 1, {x, -3, 3}, {y, -3, 3},
Epilog -> {
Red, Dashed,
Line[{{-3, -3}, {3, 3}}],
Line[{{-3, 3}, {3, -3}}]
},
Axes -> True,
AxesLabel -> {"x", "y"}
]
Thus, you can see why I picked $\{\phi,-\pi/4,\pi/4\}$ for the right branch. Similarly, consider the contour plot of $x^2-z^2=1$.
ContourPlot[x^2 - z^2 == 1, {x, -3, 3}, {z, -3, 3},
Epilog -> {
Red, Dashed,
Line[{{-3, -3}, {3, 3}}],
Line[{{-3, 3}, {3, -3}}]
},
Axes -> True,
AxesLabel -> {"x", "z"}
]
You can see why I picked $\{\theta,\pi/4,3\pi/4\}$ for the right branch. Thus, the domain for the right branch is $\{(\theta,\phi): \pi/4<\theta<3\pi/4\ \text{and}\ -\pi/4<\phi<\pi/4\}$. Yet:
SphericalPlot3D[Sqrt[1/(Sin[θ]^2 Cos[2 ϕ] - Cos[θ]^2)],
{θ, π/4, 3 π/4}, {ϕ, -π/4, π/4}, MaxRecursion -> 4,
PlotRange -> {-3, 3},
RegionFunction -> Function[{x, y, z, θ, ϕ, r}, 0 < r < 5]]
Still some strange stuff happening on the edges.
An answer to Simon Rochester's question in his latest comment
Consider:
func[θ_, ϕ_] = Sqrt[1/(Sin[θ]^2 Cos[2 ϕ] - Cos[θ]^2)];
denom[θ_, ϕ_] = (Sin[θ]^2 Cos[2 ϕ] - Cos[θ]^2);
Show[
SphericalPlot3D[If[denom[θ, ϕ] > 0, func[θ, ϕ], 10],
{θ, π/4, 3 π/4}, {ϕ, -π/4, π/4},
PlotPoints -> 30, PlotRange -> {-3, 3},
RegionFunction -> Function[{x, y, z, θ, ϕ, r},denom[θ, ϕ] > 0]],
SphericalPlot3D[If[denom[θ, ϕ] > 0, func[θ, ϕ], 10],
{θ, π/4, 3 π/4}, {ϕ, 3 π/4, 5 π/4},
PlotPoints -> 30, PlotRange -> {-3, 3},
RegionFunction -> Function[{x, y, z, θ, ϕ, r},denom[θ, ϕ] > 0]]
]
Which produces this image:
Note the increase in meshes because of the restriction to the domain.
\[Theta]
-like sequences by converting them to their Unicode counterparts using this web app. $\endgroup$PlotPoints
where they're actually needed. I didn't really need to choose 1000 in the first place, I just picked it to indicate that you could increase thePlotRange
without too much problem. $\endgroup$