Topologically embed Klein bottle into $\mathbb{R}^4$ projecting to usual "beer-bottle" surface in $\mathbb{R}^3$ (Originally asked in 2018 at https://math.stackexchange.com/questions/2946505/topological-embedding-of-klein-bottle-into-mathbbr4-that-projects-to-usual?noredirect=1#comment9514257_2946505;cross-posted here.)
What is an explicit topological embedding of the Klein bottle into $\mathbb{R}^4$ whose projection, of some sort, down to $\mathbb{R}^3$ gives the usual "beer-bottle" immersed surface (https://upload.wikimedia.org/wikipedia/commons/8/8a/Surface_of_Klein_bottle_with_traced_line.svg), and then how does that embedding and the projection yield an explicit "topological immersion" of the Klein bottle into $\mathbb{R}^3$?
By a "topological immersion" I mean at least a continuous local homeomorphism.
What I’m looking for, more precisely, is a map $f: [a, b] \times [c, d] \rightarrow \mathbb{R}^4$ with the following properties:

*

*$[a, b] = [c, d] = [0, 1]$, or perhaps more conveniently, $[a, b] = [c, d] = [0, 2 \pi]$;

*$f$ is constant on equivalence classes under the usual equivalence relation on the rectangle that identifies horizontal edges going in the same direction but identifies vertical edges in opposite directions;

*by passing to the quotient, $f$ induces an embedding $f^{\ast}$ of the Klein bottle $K$ into $\mathbb{R}^4$;

*the composite $g =  p \circ f^{\ast}$ is an immersion of $K$ into $\mathbb{R}^3$ whose image is that “beer-bottle” surface $S$, where the "projection" $p$ has a form such as $p(x_1, x_2, x_3, x_4) = (x_1, x_2, x_3 \cos \alpha + x_4 \sin \alpha)$; and

*the composite $q \circ g$ is therefore a parameterization of that surface $S$, where $q : [a, b] \times [c, d] \to K$ is the quotient map.

 A: Consider the following functions (written in Maple code):
   klein_embedding := (t,u) -> 
   [(0.1*sin(3*Pi*t)+0.1*sin(Pi*t)+0.4*cos(Pi*t))*sin(2*Pi*u)-0.5*sin(4*Pi*t)+sin(2*Pi*t), 
 0.2*sin(2*Pi*u)*sin(3*Pi*t)+2.*cos(2*Pi*t)+0.5, 
 0.25*cos(2*Pi*u)*sin(2*Pi*t)+0.4*cos(2*Pi*u)];

   klein_seam_a := (t) -> [0.8621-0.0015*cos(4*Pi*t)+0.0171*sin(2*Pi*t)-0.0002*sin(6*Pi*t),t];

   klein_seam_b := (t) -> [0.1179+0.0031*cos(4*Pi*t)-0.0385*sin(2*Pi*t)+0.0005*sin(6*Pi*t), 
               0.75+0.0597*cos(2*Pi*t)-0.0004*cos(6*Pi*t)+0.0049*sin(4*Pi*t)];

   klein_seam := (t) -> [-0.2811+0.0051*cos(4*Pi*t)-0.1401*sin(2*Pi*t)+0.0005*sin(6*Pi*t), 
             1.7871-0.0061*cos(4*Pi*t)+0.3532*sin(2*Pi*t)-0.0005*sin(6*Pi*t), 
             0.2090*cos(2*Pi*t)-0.0010*cos(6*Pi*t)+0.0086*sin(4*Pi*t)];

The map klein_embedding(t,u) satisfies klein_embedding(t,u)=klein_embedding(1+t,1-u)=klein_embedding(t,1+u), so it induces a map from the Klein bottle (defined as a quotient of $\mathbb{R}^2$ in the usual way) to $\mathbb{R}^3$.  This is almost an embedding, with image as follows:

The other three functions relate to the curve $C$ of self-intersection in the image of klein_embedding(t,u). All claims about these functions are only approximately true (but in principle there exist functions for which the claims hold exactly).
The map klein_seam(t) goes from $\mathbb{R}/\mathbb{Z}$ to $\mathbb{R}^3$ with image $C$.  Thus, there are two different maps $[0,1]\to[0,1]^2$ whose composite with klein_embedding is klein_seam, and these two functions are klein_seam_a(t) and klein_seam_b(t).  Their effect is as follows:

klein_seam_a(t) gives the slightly curved red line on the right, and klein_seam_b(t) gives the small blue closed curve on the left.
Adding almost any function as a fourth coordinate in klein_embedding(t,u) will give an embedding in $\mathbb{R}^4$.  For example, cos(Pi*t) will work.
The above code is taken from https://github.com/NeilStrickland/maple_lib/blob/master/lib/geometry/geometry.mpl
The same repository also contains Maple code for many other things.
UPDATE: There are also more canonical embeddings
$$ K \xrightarrow{f} S^1\times S^2 \xrightarrow{g} \mathbb{R}^4 $$
given by
\begin{align*}
 f(t,u) &= (\cos(2\pi t),\sin(2\pi t),\cos(2\pi u),\cos(\pi t)\sin(2\pi u),\sin(\pi t)\sin(2\pi u)) \\
 g(a,b,x,y,z) &= ((2+x)a,(2+x)b,y,z)
\end{align*}
(The latter is closely analogous to the usual torus embedding $S^1\times S^1\to\mathbb{R}^3$.)
We can compose $gf$ with a linear projection $p\colon\mathbb{R}^4\to\mathbb{R}^3$ to get a map $pgf\colon K\to\mathbb{R}^3$, but experiment suggests that this is never an immersion, there are always singular points where the rank of the derivative drops to $1$.  I think it should not be too hard to give a formal proof of that, although I have not tried.  Anyway, this explains why we need some terms like $\sin(3\pi t)$ and $\sin(4\pi t)$ in klein_embedding(t,u).
