Sixty Days Later

The year started off like any other year, with the exception that there were significantly more ophthalmology based puns, until a little virus blossomed into a pandemic. The resulting quarantine is messy: toilet paper became a commodity worth it’s volume in gold, Zoom overtook Skype as the de facto way to FaceTime people, and the Baskin-Robbins logo is associated with Joe Exotic.

Another tragedy is my haircut. I’ve never really liked how my coiffure looked after an appointment, and I always say “it’ll look better after a few days.” This was a lie. The truth is, my hair didn’t get better. It was moreso I settled. It was (and still is) basically an unhappy relationship.

The barber always asked me how I wanted it cut, and I always replied “It was four weeks ago since my last haircut” then they trim off four weeks worth of hair and happily take my twenty dollars plus tip. The problem is, I usually never liked what my hair looked like four weeks ago, nor that haircut from eight weeks ago ad infinitum. Just a reminder, my hair looked like:

Please ignore the Transition glasses.

Within the last few months, I actually became more comfortable with my hair. And now, with this stupid quarantine, I’m going to stroll into the barbershop looking like the Geico caveman

and telling them “It’s been … two months since my last haircut. Please save me” and they happily take my $20 with tip.

Composite exponential limit

This nice problem was in the analysis section of Putnam and Beyond: prove

\begin{align*}
\lim_{n\to \infty} n^2 \int_0^{1/n} x^{x+1} \, dx = 1/2.
\end{align*}

The solution is quite nice, and simply relies on the fact that $\lim_{n\to 0^+} x^x = 1$, hence for $n$ large enough, we can approximate the integral with $\int_0^{1/n} x\, dx$ instead.
There’s an easy generalization of this problem:
\begin{align*}
\lim_{n\to \infty} n^{k+1} \int_0^{1/n} x^{x+k} \, dx = 1/(k + 1).
\end{align*}

Generalizing this fact, we don’t even need the composite exponential as the proof just need a $f(x)$ to be a function such that $\lim_{x\to 0^+} f(x) = 1$ with an integral bound approaching $0$.

Celeste Ng; Switch Switching

  • Recently finished reading Celeste Ng’s Everything I Never Told You in some five days while in Florida. I’ve never read a book written by an Asian-Americnan author before, nor one where Asian-American issues are discussed at great details.  A central tenant of a character, wanting to fit in but couldn’t, resonated with me. The issues I faced when I first moved here were less significant than the ones in the book (which took place in the 60s), but this concept of wanting people to figure out one’s differences from something else besides my skin color still holds today.
  • The left controller stick of my Switch has been suffering greatly from drift recently, and I finally managed to fix it.   The parts were quite cheap, with the tools included from Amazon. It felt quite nice again to work with my hands and really made me want to go do some small projects in the Brown design lab.

A Simple “Conforming” Tetrahedral Mesh of a Cube

My adviser told me about this meshing of a cube (or any hexahedral) into 6 different tetrahedrons which is easy to draw. For the sake of exposition, we will consider the cube $(-1,1)^3$ The procedure is as follows:

  1. Draw a diagonal from $(-1,-1, -1)$ to $(1,1,1)$.
  2. Now, project the diagonal to each of the 6 faces of the cube, which will result in a mesh of the cube.

While the procedure is simple enough, the individual tetrahedrons were a bit difficult to visualize. To help with that, I’ve made a small Mathematica script that one can play with:

pts = {{-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1}, {-1, -1, 
1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1}};
ti = {{1, 2, 6, 7}, {1, 2, 3, 7}, {1, 6, 7, 5}, {4, 1, 8, 7}, {1, 5,
8, 7}, {1, 4, 3, 7}}; Graphics3D[{Opacity@0.4,
Table[Tetrahedron[pts[[i]]], {i, ti}]}]

From that, we can easily see that mesh now.

So what does the “conforming” part of the title mean? Of course, there is an easier way to tile the cube using only 5 tetrahedrons, but if you put together multiple cubes, one have to be careful of how you orient them. Using the above meshing, as long as the cubes are not too distorted and can easily create the tetrahedral mesh by drawing the diagonal in the same direction.

For example, below we have a eight hexahedral elements laid in a cube, but there are three slab, three columns, and two cubes (with one significantly smaller). This whole thing was needed so that I can construct something as anisotropic as the mesh below without resorting to fancy software.

Mixed Finite Element Formulation and the necessity $H(\textrm{div})$

One can solve Poisson’s problem $-\Delta u = f$ in $d$ dimensions with homogeneous Dirichlet boundary conditions using a mixed formulation as explained below:

Let $\sigma = \nabla u$, then for a sufficiently smooth function $\tau$, by Green’s theorem
\begin{align*}
(\sigma, \tau) &= (\nabla u, \tau) \\
&= -(u, \textrm{div } \tau).
\end{align*}
Again, choosing $v$ a function sufficiently smooth, we have
\begin{align*}
f = -\textrm{div } \sigma \implies (f, v) = (-\textrm{div } \sigma, v).
\end{align*}
This gives the saddle-point problem: find $(u, \sigma) \in V \times M$ such that
\begin{align*}
(\sigma, \tau) + (u, \textrm{div } \tau) &= 0\\
(\textrm{div } \sigma, v) &= -(f, v)
\end{align*}
hold for all $(\tau, v) \in V \times M$. Note that we don’t have to take a derivative of $u$, hence it’s natural to try $M = L^2$, but what about the space $V$?

One very easy choice to guess is $V = [H^1(\Omega)]^d$ as we want the divergence to be all defined, but unfortunately this doesn’t work as the gradient of the solution to Poisson’s problem can easily not be in $[H^1(\Omega)]^d$.

In order to illustrate this, consider $u =\left(r^{2/3}-r^{5/3}\right) \sin \left(\frac{2 \theta }{3}\right)$ on the domain of the unit circle with bottom left quarter taken out. It’s not hard to see that $u = 0$ on the boundary of the domain, and we can easily find the $f$ such that it satisfies Poisson’s equation. Now, we can either calculate the gradient exactly or argue as follows.

First, recall how to take a gradient in polar coordinates. Note that $\partial_r u \approx r^{-1/3}$ plus higher order terms and that $\frac{1}{r}\partial_\theta u \approx r^{-1/3}$ plus higher order terms also. Now, one can easily calculate the $H^1$ seminorm to see that the derivative is unbounded as we’re integrating over $[0,1]$ with $(r^{-4/3})^2r$ terms (the extra $r$ comes from the change of basis from polar integration).

The above is an example of why the space $H(\textrm{div})$ is needed.

Celeste

Once again, Dunkey has proven himself to be a modern day Donald Draper… in some sense. I bought Celeste almost strictly due to how fun it seemed. It truly is a great game with tight controls and extremely interesting level design.

The first point is starting to get quite standard now, but I want to reiterate on the latter point. It seems many high-ceiling platformers like Supermeatboy or the age-old N game constantly rely on precision. Celeste throws that away with an emphasis on when/where/how you use the air dash. That air dash, that one extra mechanic, really is the crux. Honestly, it reminded me of Ori’s dash, but the level design here is more like a puzzle.

Of course, the game can get a bit annoying. There are places where precise timing is the only way through the level (or so it seems to me?). Flag number 9 is particularly annoying. One can turn on the assist mode, but it really breaks the game by making it very easy. Another quirk is that it doesn’t save automatically when quitting from the Switch; this caused me to have to beat certain levels twice as I was switching between games.

All in all, quite a fun game with a ton of content. Worth it for just $20.

A note on a paper by Babuska

This is a post regarding the paper Efficient Preconditioning for the $p$-Version Finite Element Method in Two Dimensions. In Lemma 3.3, the basis required is the bubble (or interior) polynomials, the set of edge functions orthogonal to the interiors, and linear (of bilinear) functions.

The edge functions orthogonality is explicitly stated as $\hat a(u, v) = 0$ for all $u \in \Gamma_i$ (edge space) and $v \in \mathcal{I}$ interior space. A very natural question is why the vertex functions does not need to be orthogonal to the interior functions. The fun fact is that it secretly is.

Note that the paper is for the $H^1$ semi-norm, hence $\hat a(u, v) = \int_T \nabla u \nabla v \, dx$. Now let $u$ be a hat (or bilinear) function, and let $v \in \mathcal{I}$. Then we have that
\begin{align*}
\int_T \nabla u \nabla v = \int_{\partial T} u \partial_n v – \int_T \Delta u v = 0.
\end{align*}
The first term is 0 due to the bubble functions vanishing on the boundary, and that $\Delta u = 0$ because it is linear.

Gray-Scott Equations

For our first two papers, we essentially reused the same few examples as model problems to test our method with (sine-Gordon and Brusselator). For our next paper, my advisor wanted something different and pointed towards the Grey-Scott equations. It’s a simple reaction diffusion equation as follows
\begin{align*}
\frac{\partial u}{\partial t} &= d_u\Delta u – uv^2 + F(1 – u) \\
\frac{\partial v}{\partial t} &= d_v\Delta v + uv^2 – (F+k)v
\end{align*}
where $F, k, d_u, d_v$ are constants.

There’s a short paper (“Complex Patterns in a Simple System,” by John E. Pearson) where he plots the function for different values of $F, k$. The problem for me in replicating that paper is that Pearson employed a periodic boundary condition, which is easy to implement for finite different and spectral methods, but a bit awkward for finite element methods (if you’re not using a very specific mesh).

The solution is quite nifty. Instead of a 2D plane, we simply project the domain onto a torus. It turns out FEM code on a surface is almost the same as on a plane, unless one uses curvilinear elements which then becomes a hassle. Furthermore, visualization gives pretty cool results… take a look at the two simulations below (their parameters differ just ever so slightly, but ends up giving drastically different patterns, though both reach a steady state):

New Year New Notes

Every year, I make the resolution of blogging and journalling more, and each passing year, I’ve noticed my failure. Yet here I am again stubborn as always to see how I can keep this up. Since it’s been awhile, here’s a laundry list of updates:

  1. Family and I went cruising on RCI to Haiti, Jamaica and Mexico over Christmas, and it felt just so artificial. There was a thin veneer of luxury painted over the backs of the employees, who were (almost) all from poor countries. Everything seems to be nickel and dimed…. nevertheless, it’s still relaxing not to do any chores or cooking.
  2. It’s incredibly hard to attempt to work at a place where you have never worked before. I look forward to getting back to writing and math tomorrow (and lifting/working out).
  3. Finished Sapiens, Fahrenheit 451 and How I Killed Pluto and Why It Had it Coming. All fun books to read, with Sapiens being a bit too long and Fahrenheit too short. The Pluto book was quite fun to read, and it’s interesting to see how other fields work.