# How to visualize a 4-dimensional parametric surface?

What are some good ways, using ParametricPlot3D or otherwise, to visualize a surface (taking 2 real parameters) embedded in a 4-dimensional space?

Specifically, the question concerns the embedding of the Klein Bottle in $$\mathbb R^4$$ given by

F[u_, v_] := {x[u, v], y[u, v], z[u, v], w[u, v]}

where

x[u_, v_] := r (Cos[u/2] Cos[v] - Sin[u/2] Sin[2 v])
y[u_, v_] := r (Sin[u/2] Cos[v] + Cos[u/2] Sin[2 v])
z[u_, v_] := p Cos[u] (1 + ϵ Sin[v])
w[u_, v_] := p Sin[u] (1 + ϵ Sin[v])

and the positive constants r, p, and ϵ will take convenient values.

• Klein Bottle: Eric Weisstein's notebook from MathWorld – kglr Sep 24 '18 at 1:44
• The documentation of ParametricPlot3D contains some information about "Klein bottle". – Αλέξανδρος Ζεγγ Sep 24 '18 at 3:08
• @kglr: It's not clear to me that the parametric equations for the immersion in 3-space from Eric Weisstein's article give some kind of projection of the embedding in 4-space. I want to start with the actual embedding in 4-space. – murray Sep 24 '18 at 14:28
• @ΑλέξανδροςΖεγγ: Same comment here as for Eric Weisstein's plot of the immersion. The plot in the Mathematica docs seems to be just a different immersion of the Klein bottle in 3-space. Is it obtainable directly from the embedding in 4-space? – murray Sep 24 '18 at 14:31

There are an infinite number of projections of multidimensional figures on 3D. I will show one variant that is suitable for this case

F[u_, v_] := {x[u, v], y[u, v], z[u, v], t[u, v]}
x[u_, v_, r_] := r (Cos[u/2] Cos[v] - Sin[u/2] Sin[2 v])
y[u_, v_, r_] := r (Sin[u/2] Cos[v] + Cos[u/2] Sin[2 v])
z[u_, v_, p_, \[Epsilon]_] := p Cos[u] (1 + \[Epsilon] Sin[v])
t[u_, v_, p_, \[Epsilon]_] := p Sin[u] (1 + \[Epsilon] Sin[v])

KleinBottle4D[p_, r_, \[Epsilon]_, \[Alpha]_] :=
ParametricPlot3D[{x[u, v, r], y[u, v, r],
Cos[\[Alpha]]*z[u, v, p, \[Epsilon]] +
Sin[\[Alpha]]*t[u, v, p, \[Epsilon]]}, {u, 0, 2*Pi}, {v, 0, 2*Pi},
ColorFunction -> Hue, PlotRange -> All, Mesh -> None]
KleinBottle4D[1/3, 1/2, -1/3, Pi/4]

• That looks suspiciously like the 3D object in the answer by @J. M. is somewhat okay, but it's not yet clear to my why that's so. – murray Sep 24 '18 at 15:56
• @murray, it still is the same surface; just a different projection. To use a 3D->2D analogy: a cube can have different shadows depending on how it's positioned against the light, but it's still the same cube. – J. M.'s discontentment Sep 24 '18 at 16:10
• How can one get such a 3D projection of the 4D embedded Klein bottle that is the usual "beer-bottle" surface (upload.wikimedia.org/wikipedia/commons/8/8a/…), that is, the usual picture of an immersed image of the Klein bottle in $\mathbb{R}^3$? – murray Oct 8 '18 at 16:23

A simple minded possibility is to use a perspective projection (similar to what I did here). Applied to the 4D Klein bottle, we have

With[{p = 1/3, r = 1/2, ε = -1/3, (* Klein bottle parameters *)
f = 3, d = 1, (* projection parameters *)
k = 3 (* perspective over k-th coordinate *)},
ParametricPlot3D[Function[pt, f Delete[pt, k]/(d - Extract[pt, k])] @
{r (Cos[u/2] Cos[v] - Sin[u/2] Sin[2 v]),
r (Sin[u/2] Cos[v] + Cos[u/2] Sin[2 v]),
p Cos[u] (1 + ε Sin[v]), p Sin[u] (1 + ε Sin[v])},
{u, 0, 2 π}, {v, 0, 2 π},
Mesh -> False, PlotPoints -> 55]]

In addition to perspective projection, one might want to also apply a preliminary rotation (via e.g. RotationTransform[]) to the parametric equations before projecting over one of the axes, adding another element of flexibility.