**Getting Started**

Please implement the following routines in

`core/geometry.js`:`laplaceMatrix``massMatrix`

`projects/poisson-problem/scalar-poisson-problem.js`:- constructor
- solve

`projects/geometric-flow/mean-curvature-flow.js`:- buildFlowOperator
`integrate`

`projects/geometric-flow/modified-mean-curvature-flow.js`:`constructor``buildFlowOperator`

**Notes **

- Sections 6.4-6 of the course notes describe how to build the cotan-Laplace matrix and mass matrices, and outline how they can be used to solve equations on a mesh. In these applications you will be required to setup and solve a linear system of equations $Ax = b$ where $A$ is the Laplace matrix, or some slight modification thereof. Highly efficient numerical methods such as Cholesky Factorization can be used to solve such systems, but require $A$ to be symmetric positive definite. Notice that the cotan-Laplace matrix described in the notes is
**negative semi-definite**. To make it compatible for use with numerical methods like the Cholesky Factorization, your implementation of`laplaceMatrix`should instead produce a**positive definite**matrix,*i.e.*, it should represent the expression\[ (\Delta u)_i = \tfrac{1}{2}\sum_{ij} (\cot\alpha_{ij} + \cot\beta_{ij})(u_i – u_j). \](Note that $u_i-u_j$ is reversed relative to the course notes.) To make this matrix strictly positive definite (rather than semidefinite), you should also add a small offset such as $10^{-8}$ to the diagonal of the matrix (which can be expressed in code as a floating point value

`1e-8`). This technique is known as Tikhonov regularization. - The mass matrix is a diagonal matrix containing the barycentric dual area of each vertex.
- In the scalar Poisson problem, your goal is to discretize and solve the equation $\Delta \phi = \rho$ where $\rho$ is a scalar density on vertices and $\Delta$ is the Laplace operator. Be careful about appropriately incorporating dual areas into the discretization of this equation (i.e., think about where and how the mass matrix should appear); also remember that the right-hand side cannot have a constant component (since then there is no solution).
- In your implementation of the implicit mean curvature flow algorithm, you can encode the surface $f : M \rightarrow \mathbb{R}^3$ as a single DenseMatrix of size $|V| x 3$, and solve with the same (scalar) cotan-Laplace matrix used for the previous part.
- The modified mean curvature flow is nearly identical to standard mean curvature flow. The one and only difference is that you should
**not**update the cotan-Laplace matrix each time step,*i.e.*, you should always be using the cotans from the original input mesh. The mass matrix, however, must change on each iteration.

**Submission Instructions**

Please rename your `geometry.js, scalar-poisson-problem.js, mean-curvature-flow.js `and

In fact, it wouldn’t be hard to implement in the same code framework we’re using for the class, since you can think of a plane curve as a “mesh” consisting of a single flat polygon with many edges.

The paper I mentioned on discrete curve shortening with no crossings is:

Hass and Scott, *“Shortening Curves on Surfaces”*, Topology 33, (1994) 25-43.

It would be fun to see an implementation of something like this on a surface (I’ve never done it myself!).

]]>\[

\nabla_a A = \tfrac{1}{2} N \times (b-c).

\]

This formula can be obtained via a simple geometric argument, has a clear geometric meaning, and generally leads to a an efficient and error-free implementation.

In contrast, here’s the expression produced by taking partial derivatives via *Mathematica* (even after calling `FullSimplify[]`):

Longer expressions like these will of course produce the same values. But without further simplification (by hand) it will be less efficient, and could potentially exhibit poorer numerical behavior due to the use of a longer sequence of floating-point operations. Moreover, they are far less easy to understand/interpret, especially if this calculation is just one small piece of a much larger equation (as it often is).

In general, taking gradients the “geometric way” often provides greater simplicity and deeper insight than just grinding everything out in components. Your current assignment will give you some opportunity to see how this all works.

*Update:* As mentioned by Peter in the comments, here’s the expression for the gradient of angle via partial derivatives (as computed by Mathematica). Hopefully by the time you’re done with your homework, you’ll realize there’s a better way!