# Discrete Moment Map Flow and Lagrangian Surfaces

Project maintained by François Jauberteau, Yann Rollin and Samuel Tapie

This is the homepage of the software Discrete Moment Map Flow, announced in our research paper

## Goal of the DMMF program

Our research led us to consider an evolution equation for surfaces in the four dimensional Euclidean space. The expected generic behavior of the corresponding flow is to converge towards Lagrangian surfaces in $\mathbb{R}^4$. Instead of tackling this open problem from the point of view of PDE and global analysis, we considered an analogous finite dimensional problem in the context of discrete symplectic geometry. This field is still at its early stages and many geometers are interested in developping the discrete counterpart of symplectic geometry.

Our program is based on the Euler method applied to a discrete version of the flow. Discrete surfaces of $\mathbb{R}^4$ are represented by quadrangular meshes. These meshes evolve under an ordinary differential equation introduced below. For more informations, you are encouraged to read our research paper. However we provide a short reminder of the objects, for the user's convenience. If you would like to skip the mathematical introduction, you may proceed directly to the download section.

When running the program, the user observes the discrete flow evolving in realtime. The user can interact with various parameters (time step, scaling, number of faces, etc...) using the mouse and keyboard. The initial data of the flow is chosen from a library of parametrized tori in the $4$-space. These examples can be modified randomly with a variable amount of noise. Little programming background is needed to add other types of tori to the native library.

In all experiments that we have made, we observe a converging flow, were the limit is a Lagrangian quadrangular mesh, unless the time parameter is too big. In such case, the flow may blow-up in finite time. This behavior can always be avoided (experimentaly) by decreasing the time step.

In conclusion, the DMMF program produces large classes of discrete Langrangian surfaces, or strictly speaking, Lagrangian quadrangular meshes, which were not known before and provide fundamental examples for symplectic geometers and topologists.

## Screenshots

The animated picture below shows a few screenshots of the flow, starting from noisy Clifford torus. The faces are colored according to the symplectic density. If the density is greater than 1, the color is red. As the density decreases, the color becomes yellow then blue. If the density is smaller that $10^ {-3}$, the color suddenly becomes black, to show that we have obtained a surface which is very close to be Lagrangian.

The picture below shows a quadrangular mesh, which is very close to be Lagrangian. The torus has size of order 1 whereas its sympectic density is of order $10^{-8}$. The original parametrization is obtained by considering the boundary of a tubular neighborhood of the trefoil knot in $S^3$. The discrete moment map flow produced this Lagrangian mesh as the limit.

The picture below shows another Lagrangian quadrangular mesh where, instead of a trefoil knot, we consider a (3,5)-torus knot. Again, this example has size of order 1 and a sympectic density is of order $10^{-8}$.

## Some recollections and definitions

Surfaces of $\mathbb{R}^4$ are implemented as some kind of quadrangular meshes. More precisely, we consider the standard lattice $$\Lambda_N =\mathbb{Z} \cdot \frac {e_1}N \oplus \mathbb{Z} \cdot \frac {e_2}N,$$ defined for positive integers $N$, where $(e_1,e_2)$ is the canonical basis of $\mathbb{R}^2$. The lattice $\Lambda_N$ is regarded as the set of vertices of the standard quadrangulation $\mathcal{Q}_N(\mathbb{R}^2)$, which is the usual quadrangulation of $\mathbb{R}^2$ tiled by squares of size $N ^{-1}$. The lattice $\Lambda_N$ descends a discrete subgroup of the torus $$\Sigma =\mathbb{R}^2/\Lambda_1$$ and the quadrangulations $\mathcal{Q}_N(\mathbb{R}^2)$ also descend to the quotient as quadrangulations $\mathcal{Q}_N(\mathbb{\Sigma})$ of $\Sigma$. The real vector spaces of cocyles on the quadrangulations are denoted $C^i(\mathcal{Q}_N(\Sigma))$, where $i=0,1,2$ for vertices, edges and faces. The space of quadrangular meshes is defined as $$\mathscr{M}_N = C^0(\mathcal{Q}_N(\Sigma))\otimes \mathbb{R}^4.$$ A mesh $\tau\in \mathscr{M}_N$ is an object that associates $\mathbb{R}^4$-coordinates to each vertex of the quadrangulation.

The space $C^0(\mathcal{Q}_N(\Sigma))$ is endowed with an inner product $\langle \! \langle \cdot,\cdot \rangle\! \rangle$, with the convention that the dual of basis of the vertices of $\mathcal{Q}_N(\Sigma)$ is orthogonal and each dual vertex has norm square $N^{-2}$. The space $C^2(\mathcal{Q}_N(\Sigma)$ is endowed with a similar inner product denoted $\langle \! \langle \cdot,\cdot \rangle\! \rangle$ as well. Together with the standard Euclidean metric $g$ and complex structure $J$ of $\mathbb{R}^4\simeq \mathbb {C}^2$, this provides a canonical inner product on $\mathscr{M}_N$ and a complex structure, denoted $J$ in the same way. We consider the quadratic map $$\mu_ N ^ r : \mathscr{M}_N \longrightarrow C^2(\mathcal{Q}_N(\Sigma)),$$ which associates to each face of a quadrangular mesh $\tau$ its symplectic given by $$\langle \mu_ N ^r ( \tau ) , f \rangle = N^2 S ( f, \tau ),$$ where $S$ is the symplectic area of a quadrialteral, defined as the integral of the Liouville form along the quadrilateral of $\mathbb{R}^4$. Alternatively $S$ is also the symplectic area of any compact surface of $\mathbb{R}^ 4$ with boundary given by the quadrilateral. We are interested in Lagrangian quadrangular meshes, defined as the solutions of the equation $$\mu_N^r(\tau)=0.$$ Lagrangian quadrangular meshes of $\mathbb{R}^4$ are discrete analogues of smooth immersed Lagrangian tori of $\mathbb{R}^4$. The program DMMF, based on an evolution equation for quadrangular meshes, produces, in the limit, Lagrangian quadrangular meshes.

## Operators associated to the problem

The finite difference operator $$\delta_\tau : T_\tau\mathscr{M}_N\longrightarrow C^2(\mathcal{Q}_N(\Sigma)),$$ given by $$\delta_\tau = -D\mu_N^r|_\tau \circ J$$ is explicitely computed as $$\delta_\tau V = \frac{N^ 2}2 \sum_{v,f} g \left (V(v), D^ {\tau}_{v,f} \right )f^*. \tag{*}\label{eq:delta}$$

• In the above formula $\eqref{eq:delta}$, the sum is taken over every vertices $v$ and faces $f$ of the quadrangulation $\mathcal{Q}_N(\Sigma)$.
• The notation $V(v)$ corresponds to the value taken by the discrete vector field $V$ at the vertex $v$.
• By convention, we put $D^\tau_{v,f}=0$ if $v$ is not a vertex of $f$.
• The diagonal of the mesh $\tau$ associated to the face $f$ and opposite to the vertex $v$ is denoted $D^\tau_{v,f}\in \mathbb{R}^ 4$.
• The Euclidean inner product of $\mathbb{R}^4$ is denoted $g$.
The adjoint $\delta^\star_\tau$ of $\delta_\tau$, with respect to the $\langle \! \langle \cdot,\cdot \rangle\! \rangle$-inner product is defined by $$\langle \! \langle \delta_\tau V,\phi \rangle\! \rangle = \langle \! \langle V,\delta_\tau^\star \phi \rangle\! \rangle .$$ The ajoint operator has an explicit formula readily deduced from the formular for $\delta_\tau$ $$\delta _\tau^\star : C^2(\mathcal{Q}_N(\Sigma)) \longrightarrow T_\tau\mathscr{M}_N,$$ given by $$\delta _\tau^\star \phi = \frac{N^ 2}2 \sum_{v,f} \phi(f) D^ {\tau}_{v,f} v^*.\tag{**}\label{eq:dstar}$$ It turns out that the vector field $\delta_\tau^\star \phi$ is an analogue of the infinitesimal action of the group of Hamiltonian transformations of the torus, acting on the inifinite dimensional moduli space (see our research paper for more details on this fact).

## Finite dimensional flow

The space of meshes is endowed with a flow, which is given by the ordinary differential equation with smooth coefficients: $$\frac{d\tau }{dt} = J \delta^ \star_\tau \mu_N^r(\tau). \tag{F}\label{eq:flow}$$ This flow is a finite dimensional version of a flow related to the moment map geometry of an infinite dimensional space, introduced by Simon Donaldson (cf. our article, Section 2, for more details about this fact). The above equation $\eqref{eq:flow}$ is just a downward gradient flow which may be expressed as $$\frac{d\tau }{dt} = -\frac 12 J \mathrm{grad}\| \mu_N^r \|^2,$$ where the norm and gradient are defined using the canonical inner products. The fixed points of the flow correspond to quadrangular meshes solution of the problem $$\delta^\star_\tau \mu_N^r(\tau) = 0. \tag{***} \label{eq:fp}$$ From an experimental perspective, it seems that $\ker\delta^\star_\tau$ reduces to constant functions. We point out that this fact is known to be true if the quadrangular mesh $\tau$ is sufficiently close, in some sense, to a smooth nondegenerate immersion (cf. our research paper for more details). This is also true under some mild genericity assumption of the mesh $\tau$. It follows that Equation $\eqref{eq:fp}$ forces $\mu_N^r(\tau)=cst$ which implies $\mu_N^r(\tau) =0$ by Stokes theorem. In other words, fixed points of the flow $\eqref{eq:flow}$ appear to be, at least generically, Lagrangian quadrangular meshes.

We have not carried out any thorough study of the ODE $\eqref{eq:flow}$, but we expect that its flow should converge generically. Instead we provide a numerical simulation of the flow which seems to confirm this behavior.

## Numerical flow

We provide a numerical simulation of the flow $\eqref{eq:flow}$ by the most rudimentary technique at hand, the Euler method. We choose a small time interval $\Delta t>0$. Given a quadrangular mesh $\tau_i$ at time $t_i= i\Delta t$, we define the quadrangular mesh $\tau_{i+1}$ at time $t_{i+1}=t_i + \Delta t$ by induction as $$\tau_{i+1}=\tau_i + \Delta t \cdot J \delta_{\tau_i}^\star \mu_N^r(\tau_i). \tag{DF}\label{eq:dflow}$$ The discrete flow $\eqref{eq:dflow}$ is obtained as a discretization of the flow $\eqref{eq:flow}$ via an explicit finite difference method of order $1$. Consequently, as $\Delta t\rightarrow 0$, this technique provides an approximation of the flow lines of the ODE. This scheme is simple to code on a computer. The elements of the vector space $\mathbb{R}^4$ are coded as $4\times 1$ arrays with float (or double) entries called $V4d$. We store $\tau_i$ as an $N\times N$ array with entries of $V4d$-type. Given $\tau_i$, the diagonals of each faces are readily computed from the knwoledge of the vertices of each quadrilateral of $\mathbb{R}^4$. These diagonals are used in turn to compute the value of $\mu_N^r(\tau_i)$ and apply the operator $\delta_{\tau_i}^\star$. From this stage, one can compute $\tau_{i+1}$ and iterate the discrete numerical flow.

The discrete flow $\eqref{eq:dflow}$ can be implemented using most programming languages with sufficient floating point number accuracy. The algorithm is very fast with linear complexity in the data size $N^ 2$. With a current personal computer, we may obtain smooth real time movies, with more than $24$ frame per second, of the evolving surface with $N\leq 50$, that is for a surface with $2 \, 500$ quadrilaterals.

The last task is to produce a variety of initial data $\tau_0$ to start the discrete flow. The idea is to use a collection of smooth maps from the torus to $\mathbb{R}^4$. For example parametrizations of the Clifford torus, the Chekanov torus, the boundary of tubular neighborhood of $(p,q)$-torus knots, and several other smooth maps more or less arbitrary. We consider the disrete samples of these smooth maps as initial value $\tau_0$. The corresponding parametrizations are explicitely given in the section below. It is also useful to apply some noise to $\tau_0$. Indeed, the Clifford and Chekanov tori are already Lagrangian. It follows that the corresponding sample mesh are almost Lagrangian and the flow seems to be still. A random pertubation shows what type of stability one can expect. A difficulty with the discrete flow is that it may blow up in finite time, in particular if the time step $\Delta t$ is big compared to the noise or to the symplectic density.

## Visualization

One of the less natural aspect of the program is to choose a representation of surfaces on a computer screen. For this purpose, we need to choose a projection on a $3$-dimensional submanifold of $\mathbb{R}^4$. Our choice, which may not be the best in certain situations, is the following: we consider the radial projection of $\mathbb{R}^4$ on the $3$-sphere $S^3$ of radius $1$ centered at the origin. The sphere minus a point admits a stereographic projection onto $\mathbb {R}^3$, understood as a tangent space to the sphere. Composing the radial projection and the stereographic projection provides a quadrangular mesh with $\mathbb{R}^3$-coordinates. One can precompose the projection with rotations of $\mathbb{R}^4$ around two arbitrary planes of $\mathbb{R}^4$ connected to mouse motions -- we are limited here with the two dimensional motions of the mouse. This basic interactive mouse action allows the user to see the surface from different angles. Eventually, we rely on OpenGL to render a representation of the surface, in perspective, on a computer screen.

These operations are easily implemented. Given the quadrangular mesh $\tau_i$ we compute a projected quadrangular mesh $\tau'_i$ with $\mathbb{R}^3$-coordinates. Such coodinates are implemented with a type $V3d$, given by $3\times 1$ array wit float (or double) entries. Then $\tau'_i$ deduced from $\tau_i$ as an $N\times N$ array with $V3d$-entries. A quadragular mesh of $\mathbb{R}^3$ is easily represented in perspective using the OpenGL library. We merely need to make a choice of how to represent quadrilaterals of $\mathbb{ R}^3$. Indeed, they are generally not flat. Our program spilts each quadrilateral along an arbitrary diagonal and draws the two distinct triangles for each quadrilateral. We choose a color gradient to fill each triangle which depends on the value of $\mu_N^r$. If the abolute value of the symplectic density of the face is sufficiently small, that is $10^{-3}$ in the case of our program, we choose a final color, for instance black, which shows that we reached our target. We insists that such triangles do not correspond in any ways to Lagrangian triangles of $\mathbb{R}^4$. They merely permit to draw a surface in $\mathbb{R}^3$ with a given $1$-skeleton.

## The Processing language

The choice of language for implementing the above scheme had to be done carefully. We were looking for a versatile programming language, which should be:

• Sufficiently fast, so that we may produce 60 fps real time movies, even with significant data size. A single program would have to process the flow and show the movie alltogether to make experimentation easier. We wanted to use a single language, that would calculate the discrete flow and deal with the visualisation, to be able to modify instantly the code a see the result, without wasting time in the compilation.
• Facilitate creation of $3$-dimensional movies involving meshes via a library like OpenGl. We are not software engineers and did not want to spend much time on this aspect of the code. Any program that would simplify this task would be greatly appreciated. We were raised programming old fashion personal computers (in the 80's) when simple commands like clearscreen or line() would allow the user to draw a picture.
• Facilitate scanning input of the mouse and keyboard for real time interaction with the flow.
• Sufficiently abstract to deal with vector calculus, peharps with OOP for implementing basic $4$-dimensional linear algebra or for implementing class associated to meshes.

An effortless language that meets these needs is the Java dialect Processing3. Our DMMF code for version 0.6 is about 1000 lines only, which we consider rather short. We became aware of this language and its capabilities in 2014, when attending a screening of C4I, at le musée d'art comtemporain de Montréal, a movie and musical piece by the artist Ryoji Ikeda.

The code is freely distributed under the terms of the GNU GPL licence. We do not provide any support or warranty. We recommend using directly the source code compiled with the Processing3 programming IDE. There are also compiled versions of the code below. However, they are not up to date and may not work on your platform.

Installation notes:

• The DMMF source code is available on GitHub at the address https://github.com/yannrollin/dmmf. You may clone the git repository using a simple git command or download it using your browser.
• For the git command line method under the linux OS, follow the steps below:
1. Open a terminal and use the cd command to go to your processing Sketchook directory. The location of the directory depends on your IDE preferences and may vary from one system to another. For instance type the command:
> cd ~/Processing/
2. You need the git command line tool. If it is not present on your system, you may install it using the command
> sudo apt-get install git
3. You may now clone the Github repository using the command
git clone https://github.com/yannrollin/dmmf.git
4. This should create a dmmf directroy in your sketchbook. You can now open the dmmf scketch in the processing IDE and run the program.
5. You may keep the dmmf program up to date. For this, just go to the sketchbook directory
> cd ~/Processing/dmmf/
Then run the command
> git pull
Source code and compiled versions:

## Help for using the program

The program runs in full screen mode and shows the flow evolving in real time. The user can interact by pressing keys and moving the mouse. Here is a list of useful key functions:
 Key Function Mouse Rotate the surface in $\mathbb{R}^ 4$ about 2 arbirarily chosen planes. Spacebar Run or stop the flow. h Toggle the help page for key functions i Toggle the information page. Many informations are printed on screen, including framerate, torus type, maximum symplectic density... r Restart the flow from time zero. d/D Decrease of increase the time step. q/Q Decrease or increase the number of quads of the mesh. n/N Decrease or increase the random noise level. t/T Change the initial surface type. s/S Decrease or increase the overall scaling factor. f Toggle the filling mode for faces of the mesh. b Toggle drawing balls at the vertices. p Save a screenshot in the scketch directory. m (pressed continuously) -- save a movie in the sketch directory. The sequence of .tiff screenshots can be converted to a .mov format using the IDE tool MovieMaker. c/C Decrease or increase the number of iterations of the flow computed between each frame.

## Library of parametrizations

The user can navigate between several parametrized tori types using the t/T keys. We provide the mathematical parametrizations used by the program below, expressed with the coordinates $(z_1,z_2) \in \mathbb{C}\times\mathbb{C}$, identified to $\mathbb{R}^4$ and parameters $(\theta_1,\theta_2) \in [0,2\pi]\times [0,2\pi ]$.
• The Clifford torus. Since the Clifford torus is Lagrangian, the movie produced by the program will be still, unless the user adds some noise to the parametrization using the N key. $$z_1 = e^{i\theta_1}, \quad z_2 = e^{i\theta_2}$$
• The Chekanov torus. This example is also Lagrangian and we have a fixed point of the flow. $$z_1 = (e^{i\theta_1}+1.2)e^{i\theta_2}+1.5, \quad z_2 = (e^{i\theta_1}+1.2)e^{-i\theta_2}$$
• The type A complex torus. This example is obtained using a parametrization which takes values in a complex line of $\mathbb{C}^2$. In some sense, this map is as far as possible from being isotropic. It is easy to see that the moment map flow preserves maps with values in a given complex line. Thus the evolution equations shows $2$-dimensional meshes. Since a complex line projects onto a circle of $S^3$, all the vertices are arranged along a circle of the Euclidean space. $$z_1 = \theta_1+i\theta_2, \quad z_2 = 0$$
• The type B complex torus. This example is similar to type A with a different choice of complex line. $$z_1 = \theta_1+i\theta_2, \quad z_2 = 1$$
• The tubular type $(p,q)$-knot. Given any knot $K\subset S^3$, one can consider the embedded torus of $S^3$ obtained as the boundary of a small tubular neighborhood of $K$. This construction used with the DMMF program will show a torus of the sphere, represented via the stereographic projection in the Euclidean space and knotted as $K$. However the knottedness is only an impression here. Indeed, although $K$ may be non trivial in $S^3$, it becomes trivial in $\mathbb{ R}^ 4$, and so does the corresponding torus. Nevertheless, such constructions provide many examples of explicit parametrized tori in $\mathbb{R}^4$, which are very far from being Lagrangian, and are excellent testing examples for our flow. In particular, we use this construction for $K$ a torus knot of type $(p,q)$, which gives $$z_1 = e^{p i\theta_1}, \quad z_2 = e^{q i\theta_1} + re^{i\theta_2},$$ where $p, q$ are integers and $r<1$ is a radius parameter.
• The spin torus on a $(p,q)$-knot. This construction provides examples of knotted tori in $\mathbb{R}^4$. By Luttinger theorem, the spin knotted tori do not admit any Lagrangian representative up to isotopy. Therefore, it should be most interesting to have a precise understanding of the behavior of the flow in the limit. The construction goes as follows: we remove a small neighborhood of a 2-plane in $\mathbb{R}^4$ and identify its complement with the product of the upper half space $H^3$ and a circle. Any knot in $H^3$ cross a circle produces an embedded torus of $\mathbb{R}^4$ by this construction. In particular, we choose a torus knot of type $(p,q)$ in $H^3$ and obtain the parametrization: $$z_1 = \cos( \theta_2) + i \sin(\theta_2) \times (x+5), \quad z_2=y+iz$$ where $$x=\cos(p\theta_1)(\cos(q\theta_1) +2),\quad y=\sin(p\theta_1)(\cos(q\theta_1) +2),\quad z= - \sin (q\theta_1).$$