# Problem getting a diffeomorphism work on $\mathbb{R}^{3}$

I am trying to come up with a diffeomorphism f the cube onto itself. The reason I am trying to do this is because for a study I am doing I need a way of deforming the cube (onto itself) and be able to perfectly "bring back" the deformed domain to the original, in order to test some numerical algorithm I am working. Clarification just in case I have the XY problem.

This is a follow up question from Example of a diffeomorphism on $\mathbb{R}^{3}$ onto itself (or cube onto itself). I am trying to make a real example out of it.

I start from defining "a smooth (at least continuously differentiable) vector field $V(x,y,z)$ on the cube $Q$, which vanishes on the boundary of the cube.

If I don't understand wrong this is a valid $V$: \begin{align*} V(x,y,z) = \bigl( &\sin(x \cdot \pi/L)\sin(y \cdot \pi/L)\sin(z \cdot \pi/L),\\ &\sin(x \cdot \pi/L)\sin(y \cdot \pi/L)\sin(z \cdot \pi/L),\\ &\sin(x \cdot \pi/L)\sin(y \cdot \pi/L)\sin(z \cdot \pi/L)\bigr), \end{align*} being $L$ the length of the cube.

Then I solve the ODE $$\frac{d}{dt} h(x,y,z,t)= V(x,y,z)$$ with initial conditions $h(x,y,z,0) = (x,y,z)$.

If I am not wrong (I may be) the solution is: $$\frac{d}{dt}[h_x(x,y,z,t), h_y(x,y,z,t), h_z(x,y,z,t)] = [V_x, V_y, V_z].$$

And by integrating the right hand side from $t=0$ to $t=t_0$ $dt$ I get: $$h_x(x,y,z,t) = x_0 + t\cdot\sin(x \cdot \pi/L)\sin(y \cdot \pi/L)\sin(z \cdot \pi/L)$$ (same with the other two).

This equation does indeed describe a map of the cube onto itself (automorphism?), that actually looks similar to the image in the original post (especially if you modify $L$ by e.g. $L/2$).

However, I am supposed to find the inverse map if I find the solution to $h_x(x,y,z,-t)$, which, if I am not wrong, simply translates to $$h_x(x,y,z,-t)=x_0 - t\cdot\sin(x \cdot \pi/L)\sin(y \cdot \pi/L)\sin(z \cdot \pi/L)$$ in my case.

However, when numerically testing this, if I "warp" a grid with the first map, and then use this last one on those "warped" points, I do not get the original grid.

So questions:

1. What is wrong with my maths? What did I miss?
2. What is the solution for this map? Is there one?
3. If this is a bad way of doing the thing, what should I do? How can I get a map of the cube onto itself that I can invert "perfectly" (meaning I don't want a numerical approximation)?

PD: MATLAB code that I am using for this:

[x,y,z]=meshgrid(0:30,0:30,0:30);

L=30;
t=1;
x2=x - t.*sin(x.*pi/L).*sin(y.*pi/L).*sin(z.*pi/L);
y2=y - t.*sin(x.*pi/L).*sin(y.*pi/L).*sin(z.*pi/L);
z2=z - t.*sin(x.*pi/L).*sin(y.*pi/L).*sin(z.*pi/L);

x3=x2 + t.*sin(x2.*pi/L).*sin(y2.*pi/L).*sin(z2.*pi/L);
y3=y2 + t.*sin(x2.*pi/L).*sin(y2.*pi/L).*sin(z2.*pi/L);
z3=z2 + t.*sin(x2.*pi/L).*sin(y2.*pi/L).*sin(z2.*pi/L);

for indz=1:31
clf
%     plot(x(:,:,indz),y(:,:,indz),'r.');
mesh(x(:,:,indz),y(:,:,indz),zeros(size(x,1),size(x,2),1),'EdgeColor','g','FaceColor','none');

hold on
mesh(x2(:,:,indz),y2(:,:,indz),zeros(size(x,1),size(x,2),1),'EdgeColor','k','FaceColor','none');
mesh(x3(:,:,indz),y3(:,:,indz),zeros(size(x,1),size(x,2),1),'EdgeColor','b','FaceColor','none');

view(2)
axis tight
drawnow
pause(0.2)
end

• I took the liberty of tweaking the LaTeX in your question. If I got anything wrong, please feel free to correct it. Sep 29, 2016 at 10:34
• @AndrewD.Hwang nah, that edit makes the post look gorgeous ! Sep 29, 2016 at 10:34

The main problem appears to be the solution of the ODE: The equations are coupled and non-linear. Geometrically, the velocity of a point $(x_{0}, y_{0}, z_{0})$ depends on its location, and therefore "varies as the point moves". Consequently, integrating from $0$ to $t_{0}$ doesn't solve the ODE, it only parametrizes the line with specified initial position and velocity.
In case it helps, the one-dimensional version is $$\frac{dx}{dt} = \sin(x\pi/L);$$ the solution is not $x(t) = x_{0} + t\sin(x_{0}\pi/L)$, but the inverse function of $$t = \int_{x_{0}}^{x(t)} \frac{d\xi}{\sin(\xi\pi/L)}.$$ In practice, it's Highly Unlikely that a solution of a non-linear PDE has an elementary closed formula.