Mapping from ball into cube I need to give an example of continuous mapping from ball into cube (with condition that boundary is an image of boundary), but unfortunately I can't come up with it. Any useful advice will be welcome.
 A: A systematic approach would be to decide to scale each ray through the origin by a linear factor that moves the ray's intersection with the unit sphere into the intersection with the "double-unit" cube.
For a nonzero point $(x,y,z)$, the intersection with the unit cube is
$$ \frac{1}{\max\{|x|,|y|,|z|\}}(x,y,z)$$
and in order to make points inside the sphere map to being inside the cube, we need to scale this by their initial euclidean norms, so we get the transformation:
$$ (x,y,z) \mapsto \begin{cases} (0,0,0) & x=y=z=0 \\[1ex]
\frac{\sqrt{x^2+y^2+z^2}}{\max\{|x|,|y|,|z|\}}(x,y,z) & \text{otherwise}
\end{cases}$$
One easily checks that the scaling factor $\frac{\sqrt{x^2+y^2+z^2}}{\max\{|x|,|y|,|z|\}}$ is the same everywhere on a ray.
This gives you the cube $[-1,1]^3$. If you want to end up with the usual unit cube $[0,1]^3$, apply the obvious affine transform afterwards.
A: For a point $x \neq \vec 0$ in a cube centered in the origin, let $d(x)$ be the distance from the origin through $x$ to the boundary of the cube. Then the function defined as $f(x) = \frac{x}{d(x)}$ will map the cube to the unit sphere (with the addition that $f(\vec{0}) = \vec{0}$).
Giving an explicit formula is as easy as finding an explicit formula for $d$. While that can be done, it requires quite some work with the Pythagorean theorem and breaking into cases depending on which face of the cube the line through the origin and $x$ intersects.
Edit: After a short discussion with @HenningMakholm, and reading his answer thouroghly, it turns out that for a non-zero vector $(x, y, z)$, the function $d$ is given by
$$
d(x, y, z) = \frac{\sqrt{x^2 + y^2 + z^2}}{\max\{|x|, |y|, |z|\}}
$$
This is still in a sense breaking into cases, depending on which coordinate is largest in magnitude, but it was easier formulated than I initially feared going into this question.
A: The goal is to turn your ball into a cube by a continuous mapping.
We can do it for borders, and hope that it will naturally extend to the whole plain ball.
So the equation of the border of the unit ball is $x^2+y^2+z^2=1$.
Whereas for the unit cube, you want $x=1$ or $y=1$ or $z=1$.
First of all, points $(1,0,0)$, $(0,1,0)$ and $(0,0,1)$ must be left unchanged.
On the other extreme, points $(\sqrt{1/3},\sqrt{1/3},\sqrt{1/3})$ must be send on $(1,1,1)$.
Globally, if you have a point $X$ on the unit sphere, you send it to the intersection between the semi-line $[0X)$ and the cube. For points inside the sphere, you do it proportionnally: if your line $[OX)$ encounters the sphere at $A$ and the cube at $B$, you choose the image $X'$ such that $\frac{OX}{OA}=\frac{OX'}{OB}$.
It is not hard to verify that this mapping is continuous.
