Meat Parade

Playing Paper Mario on the Switch right now.

It is a game where Mario is a piece of paper, and you explore this cute little world, where literally everything is paper (even the water???)  to defeat an enemy who wants to fold everyone to create a kingdom for origami.

Idea sounds ridiculous right? Yes… but the game is fun.


There was a cut scene where Toads were throwing confetti (e.g. paper) at Mario because he (controlled by the player of course) performed a heroic deed. But if Mario is also made of paper in this universe, isn’t this like throwing little pieces of liver at the Macy’s parade?

Maxwell’s Equations


This is a “short” note deriving the Maxwell’s equations from first principles and experiments of physics; I will assume that one is familiar with div-curl-grad and all that. This is essentially an extremely condensed version of Griffith’s textbook which discusses the fundamental laws. Some level of rigor is dropped for conciseness.

1. Electrostatics We start with the idea of electrostatics, which studies the forces exerted on charged particle(s) from static (non-moving) sources. The governing equation is Couloumb’s law
\begin{align}\label{eqn:coul}
F = \frac{1}{4\pi\varepsilon_0} \frac{q_1q_2}{r^2} \vec{r}
\end{align}
where $q_i$ are the charges, $\varepsilon_0$ is some constant (permittivity of free space) and $\vec r$ is the vector between the two charges. The sign is repulsive if $q_1, q_2$ have the same charge and vice versa.

Suppose we have a single charge $Q$.  If there exists a multiple sources affecting $Q$, we can simply take the sum of them (superposition). Similarly, we can take the integral if the sources has a distribution over some $n$-dimensional volume; this leads to the concept of the electric field, defined as
\begin{align}\label{eqn:elec}
E(r) = \frac{1}{4\pi\varepsilon_0} \sum_{k=1}^n\frac{q_k}{r_k^2} \vec{r_k} \to E(r) = \frac{1}{4\pi\varepsilon_0} \int \frac{1}{r^2} \vec r \, dq
\end{align}
where $dq$ is the charge per unit volume. I am abusing a bit of notation here with $E(r) \sim \int \frac{1}{r^2} \vec r \, dq$, but the electric field has a value at any point in space and $r^2$ term is simply the distance. With \cref{eqn:elec}, one can calculate the force on $Q$ as $F = QE(r)$.

Focusing on a single charge, suppose that it’s a positive charge at the origin; the electric field $E(r)$ of this configuration radiates away from the origin. If we think about it, we see the total flux of the electric field through a spherical (in fact any shape $S$) surface surrounding the single charge only depends on the value of the charge inside. This is equivalent to saying
\begin{align}
\oint_S E \cdot da = \frac{1}{\varepsilon_0} Q_{enc}.
\end{align}
Applying divergence theorem, we have that
\begin{align*}
\oint_S E \cdot da = \int_V \nabla \cdot E \, dV = \frac{1}{\varepsilon_0}\int_V \rho dV
\end{align*}
where $Q_{enc} = \int_V \rho$ with $\rho$ the charge density inside the volume, leading to Gauss’s law:
\begin{align}
\nabla \cdot E = \frac{1}{\varepsilon_0} \rho.
\end{align}

What about the curl of the electric field $E(r)$? If we assume that the charges aren’t moving, then we actually have $\nabla \times E = 0$; the proof is by visualization from a single point charge as the fields point outwards. Note again, that this is not true once we introduce motion since magnetism arises.

2. Magnetostatics Moving to the more difficult magnetism aspect, the key concept here is that moving charges generates a magnetic field $B$. So besides the electric field, a moving charge (which is related to the concept of current) produces a magnetic field $B$. In particular, along a wire, the magnetic field satisfies the right hand rule meaning we expect to see cross products here. Thus, for two wires parallel to each other with current running in the same direction, using the right hand rule, we see that the wires will attract.

In fact, Lorentz force law (axiom of the theory) states that the force on a charge $Q$, moving with velocity $v$ in a field of $B$ is
\begin{align*}
F_{mag} = Q(v \times B).
\end{align*}
Note that since the velocity is cross-producted with $B$, the resulting force is perpendicular to the velocity, meaning no work is done by the magnetic force since it can only change direction of the charge but not the speed. The total force, including electric force, is
\begin{align*}
F = Q(E + (v \times B)).
\end{align*}

Before moving, on we have to define a “current” which is charge per unit time passing a single point with a unit of amps or coulombs per second. A current carrying wire with charge moving at velocity $v$ and charge $\lambda$ is $I = \lambda v$. If the charge flow is over a surface/volume, we use the unit “surface/volume current density” to describe it.
The formula is at velocity $v$ and density $\sigma$ then $J = \rho v$ where $J$ is called the volume current density and $\rho$ volume charge density. Calculating the magnetic force on an volume is
\begin{align*}
F_{mag} = \int (v \times B) \rho \, dV = \int (J \times B) \, dV
\end{align*}
with appropriate changes for lower dimensional entities.

The total current crossing a surface $S$ is simply
\begin{align*}
I = \int_S J \cdot da.
\end{align*}
In particular, the charge per unit time leaving a volume is
\begin{align*}
\oint_S J \cdot da = \int_V (\nabla \cdot J) \, dV
\end{align*}
by divergence theorem. Since charge is conserved, after all, one can visualize them as little particles, the flow outside must come from inside, meaning we have the “continuity equation”
\begin{align}\label{eqn:cont}
\nabla \cdot J = – \frac{\partial \rho}{\partial t}.
\end{align}
In the study of magnetostatics, we assume that $\frac{\partial \rho}{\partial t} = 0$.

This allows us to discuss magnetostatics, where instead of stationary charges like electrostatics, we have steady currents $\frac{\partial J}{\partial t} = 0$. These types of situations don’t arise in experiments, but it’s oddly accurate even in household applications. The corresponding Couloumb’s law here is called Biot-Savart law, given by
\begin{align}\label{eqn:B}
B(r) = \frac{\mu_0}{4\pi} \int \frac{J(r’) \times \vec r}{r^2} \, dV’
\end{align}
on a volume where $\mu_0$ is called the permeability of free space with the units coming out of the $B$ is in terms of teslas $T$ (or gauss) which is Newton per amp-meter. We also abused notation here where $r^2$ is the distance and $\vec r$ is the direction.

In the most basic case of magnetostatics, we consider a single wire with current (comparable to a single point charge in electrostatics). The magnetic field lines are simply circles around the wire meaning the curl is non-zero. One can find from calculation is that
\begin{align*}
\oint B \, dl = \mu_0 I
\end{align*}
where we are integrating a circular path of radius $s$ around the wire; this generalizes by superposition to multiple wires carrying current. In fact, the domain doesn’t matter, as long as it goes around the wire as the magnetic field loses strength at the same rate of increase from the circumference/perimeter. Now, the current $I$ enclosed by the volume can be expressed as
\begin{align*}
I = \int J \cdot dA
\end{align*}
where $J$ is the volume current density, meaning applying Stokes theorem gives us
\begin{align*}
\nabla \times B = \mu_0 J
\end{align*}
The above is a nice thought experiment, but it doesn’t generalize lol. One of the assumptions made (which is not obvious) is that the wire is of infinite straight wires! It is better to look at the Bio-Savart law itself.

We really want to look at \cref{eqn:B}. Note that $B$ is a function of $(x,y,z)$, the current distribution depends on $(x’, y’, z’)$, while $r$ is the distance between the point and the tilde points with the integral over the tilde; a key note is the div and curl of $B$ are over the unprimed coordinates.

With some amount of work using product rules and all that, one can show that $\nabla \cdot B = 0$, and taking a curl results in
\begin{align*}
\nabla \times B = \mu_0 J(r) \rightarrow \oint B \cdot dI = \mu_0 I_{enc}
\end{align*}
which is called Ampere’s law (so our above derivation is actually correct!).

Let’s do a quick review of magnetostatics and electrostatics:

  1. [Electrostatics]: Gauss’s law discusses the divergence and of the electric field, and the curl of it is always zero. These are called Maxwell’s equations for electrostatics. Essentially derived from Coulomb’s law plus superposition.

  2. [Magnetostatics]: Ampere’s law discusses the curl of the magnetic field, while the divergence is zero.  Again, these are Maxwell’s equations and derived from Biot-Savart law.

There’s more things to discuss, like the potential for magnetism, but we will skip it to move onto more interesting stuff.

3. Electrodynamics When there’s a current, there needs to a be a force moving those charges. Apparently, for most substances, one has
\begin{align*}
J = \sigma f
\end{align*}
where $J$ is the current density, $f$ force per unit charge, and $\sigma$ is a proportionality factor related to the conductivity/resistivity of a matter. For our purposes (e.g. not chemical or gravitational or nuclear), we have
\begin{align*}
J = \sigma (E + v \times B)
\end{align*}
but a good first-order approximation, since $v$ is usually small, is $J = \sigma E$ (called Ohm’s law usually written as $V = IR$).

Another way of describing this force is called the electromotive force, or emf, of the circuit. The emf is not a force, but rather defined as
\begin{align*}
\mathcal{E} = \oint f \cdot dl
\end{align*}
which is really force per unit charge. Another interpretation is it’s the work done per unit charge by the source (such as a battery). From this again, one can easily tie in what a generator is which uses motional emfs as the principle. The action of moving a wire through a magnetic field generates an emf of $\mathcal{E} = vBh$ where $h$ is the length of the wire, $v$ is the velocity and $B$ the magnetic field; this is very much an interpretation of work. Indeed, if we let $\Phi$ be the flux of the $B$ through the loop of wire, then $\mathcal{E} = -\frac{d\Phi}{dt}$.

A key concept of electrodynamics is the fact that a changing magnetic field induces an electric field. Through experimentation, this relation can be better quantified as $\oint E dl = – \int \frac{\partial B}{\partial t} da$ which means that, by Stokes’ theorem, $\nabla \times E = – \frac{\partial B}{\partial t}$; this is called Faraday’s law. This generalizes electrostatic to be time-dependent regime. With Ampere’s law, we can talk about Maxwell’s contribution, which at the time, was
\begin{align*}
\nabla \cdot E &= \frac{1}{\varepsilon_0} \rho, \\
\nabla \cdot B &= 0, \\
\nabla \times E &= – \frac{\partial B}{\partial t}, \\
\nabla \times B &= \mu_0 J.
\end{align*}

The problem with the above formula is that it’s not consistent with simple exterior calculus rules. In particular, div of curl should be zero, but the divergence of the curl of the magnetic field is not zero. Of course, for steady current, $\nabla \cdot J = 0$, but in general no.

The problem is that $\nabla \cdot J$ isn’t zero; we can rewrite this term using \cref{eqn:cont}
\begin{align*}
\nabla \cdot J = – \frac{\partial \rho}{\partial t} = – \frac{\partial}{\partial t}(\varepsilon_0 \nabla \cdot E) = – \nabla \cdot (\varepsilon_0 \frac{\partial E}{\partial t}).
\end{align*}
It goes without saying that just adding the above term will kill the divergence term! Lab experiments couldn’t find this term since $J$ is quite large usually, but arises in so called electromagnetic waves.

 

RAS syndrome

Tommy was really excited about his new store. Ever since he was in high school, he had an unusual fondness for antiques. Whether it be the history of the chair, or the lost art of a hand-crafted mortise and tenon joint, he didn’t know or care. He just knew that he liked antiques.

The store was a labor of love, and took hours comprising of locating an appropriate retail location to securing the bank loans. Unfortunately, the literal pay off after the grand opening was non-existent. It was due to the fact that he opened Tommy’s Antiques during the 1970s downturn. People didn’t have that much money, and those that did wanted to spend it on new mass manufactured crap instead. Those unrefined new money he would grovel under his breath.

One day, while looking for new income streams, Tommy noticed a new fangled ad for an “ATM.” A machine which can dispense cash, freeing the consumer from the shackles of bank hours. Unbeknownst to Tommy, the arrival of ATMs marked a tectonic shift in the banking industry. But Tommy just saw the immediate profit potential of owning a machine, and placed an order.

The wait for the delivery and setup wasn’t too long. In the meantime, Tommy ran into another problem, how does one advertise the fact that he now owns an ATM? Often, the easiest solution is the most effective and so he decided to place a placard in the median of Menaul boulevard with the simple phrase “ATM” and an arrow.

The advertisement worked. People came in to see the new gizmo on the weekend, and also realized the beauty of the furnitures. Tommy’s business bloomed from the passive traffic generated by the ATM and he eventually sold the store to a couple when the arthritis started effecting his store keeping duties.

To this day, that placard remains on the median.


In response to a placard on Menaul blvd that advertises an ATM… in the year 2021.

KKT Conditions

I need to relearn optimization, so here’s my incredibly short review.

The most basic problem to solve is to minimize $f(x)$ such that $g(x) = 0$. Since the constraint is an equality condition, we use the Lagrange multiplier. We look at the Lagrangian function $\mathcal{L}(x, \lambda) = f(x) – \lambda g(x)$; it’s easy to see that the minima of the original problem satisfies some sort of saddle point condition. This Lagrangian minimization problem can be solved by taking the gradients and setting it equal to 0.

As an example, let’s consider the curl-curl problem I’ve been looking at.
\begin{align*}
A u &= f, \\
B u &= 0
\end{align*}
with some appropriate boundary conditions which I will skip. The matrix $A$ corresponds to a curl-curl operator in strong form and $B$ is a div operator. The zero-divergence condition on the function is critical for the physics; $u$ should be thought of as a magnetic field and thus satisfy Gauss’s law.

Since $A$ is positive semi-definite, this is really a minimization problem $\min J(u) = u^T A u/2 – f^T u$ with corresponding Lagrangian $\mathcal{L}(u, \lambda) = u^T A u/ 2 – f^T u – \lambda^T Bu$ (note that in this case, $\lambda$ is a vector). The gradient with respect to the multiplier gives $Bu = 0$ as expected, and the gradient with respect to $u$ gives $Au – B^T\lambda = f$. Combining these gives the saddle point problem that we are familiar with. We can also obtain this sort of result using the functional formulation; without diving into too much details, it’s a similar process except with the Euler-Lagrange equation.

So what in the world is KKT conditions then? It’s just the generalization of Lagrange multipliers to inequalities… Specifically, one forms the Lagrangian again, and then set all the gradients equal to 0 and magically we get the correct minimum. Now looking back on this, this is a really strong result. But man, the way the econ professors taught this was tragically bad.

Parallel Timelines

I probably spent dozens of hours fretting about with my college admission essays. At the time, a good application meant a great college, meaning a great career and a happily ever after. The writing was not an easy process; turns out I really didn’t have that much life experience as a… let me check… seventeen year old boy. Nevertheless, I crafted something that I was relatively proud of.

Eleven years later, I remember nothing about that essay. My mom had to remind me that I actually written about a Chinese idiom. The essay is nowhere to be found on my computer hard drives. A probable victim of the great purges of my Linux reinstalls before I found out about home mounting.

All things considered, I had a decent application process. I got into some nice schools, and proceeded to have a pretty decent life so far. Still, I wonder how much did that essay matter? Would I be as (—insert flattering/demeaning adjective of me here–) if I slacked off? Maybe the Marshall who stayed close to home and went to FSU ultimately found his true calling of inner tube water polo coach.

Maybe the above is a farcical question. The Marshall of eleven years yonder would’ve never slacked off.

Etiquette

Having a big boy job for the first time means that I had access to movers for the first time ever. It’s a luxury, that once experienced, becomes a necessity. I’ve moved around quite a bit in college and grad school, but this past move to Albuquerque is the smoothest ever. There was no need to worry about boxes nor trigger my anxiety by driving the UHaul with no rearview mirror.

The guys would come in, pack/unload my stuff, and call me “boss.” I’ve never been called “boss” so many times within 2 hours in my life before, and honestly, I was so flattered.

But as a side effect, I just felt… bad for the movers the whole time. Am I supposed to really just stand around while three hard working men are moving my stuff? It just doesn’t really suit me.

Honestly, they need to have a “for you to do” task just for the antsy ones.

“Here’s a box, load up your stupid plates in there. Should take you longer than us to pack up the rest of your house.”

 

 

The Year

During grad school, a tangible indication that I was actually learning things was to note the publication date of the papers I were reading, and actually comprehending a majority of it. From basic analysis with textbooks written and polished to a shine during the 50s-60s, to the fundamentals of numerics written in the 60s and 70s to finally my advisor’s research papers written in the 2000s; it just feels nice to really see that I was growing as a researcher.

I guess part of the reason why PhDs are useful is the fact that I don’t have to “start” over from the basics when learning another topic. Analysis will always be relevant in whatever mathematical field one chooses to dive into, and the intuition developed *should* also carry over.

I guess my point here is that in the span of 3 days, I have learned how to code up PINNs (2015s ish…) using Tensorflow lol. See here. Man, ML is such a new field.

Sock Run

A friend in Providence told me she visited Albuquerque once. Her deepest impression of the Duke City is “the streets are really wide.” Without a doubt, this was probably one of the oddest comment I’ve heard regarding any destination.

“Was it easier to drive?”

“No, it was just really … wide.” But I’ve grown to understand what she meant by it now.

Like most people these days, I simply took to YouTube and became an instant urban planner expert and civil engineer. In particular, the channel Not Just Bikes was especially enlightening.

Without repeating the content of the linked video above, it’s painfully obvious that Albuquerque was built without the pedestrian in mind. While there are sidewalks, the scale of the city is simply larger with huge, empty parking lots placed in front of businesses and crosswalks that cut through at least four lanes of traffic, some 60 feet. Let’s not talk about the zoning issues where the residential areas, with low density housing, are completely separate from businesses.  It just never feel safe, nor fast to walk.

A prime example happened yesterday when I needed to buy some socks. There’s a Dick’s Sporting Good store in the mall right by the hotel I’m staying, approximately half a mile away. I knew the route since I drive past it to the climbing gym, so I know how unfriendly it is to pedestrians.

Shamefully, I drove.

A renaissance fair is just a state fair from a few hundred years ago.

Very much true.

Also, armored combat (e.g. video) is BRUTAL.

Two Updates

I have officially moved to Albuquerque. For the past couple of weeks, I’ve thought this transition is scarier than those in the past. But I’ve had a hard time moving to Providence too; those first couple of weeks were difficult though my classmates alleviated the dread. Same as Ithaca. Same as DC. Same as Budapest.

Moving is just hard in general. Making connections is even harder.


I actually submitted to NYTimes awhile back  a very similar puzzle to the 9/9/2021 theme, and this was their response:

I’m writing in response to your “Metric” 15x submission. With regrets, we are going to pass on this puzzle. Solid work, but unfortunately we recently accepted a puzzle with a very similar theme. That said, wanted to compliment your playful and creative cluing angles, as well as some fun entries in the bonus fill like MAC AND CHEESE, ELECTRIC EELS, SOULMATES and SINE WAVES!

So sorry for the disappointing news this time. Appreciate you giving us a chance to review your puzzle, and hope to see more from you soon!

Here was my (much easier, was envisioning Wednesday) take: https://crosshare.org/crosswords/vvMLFE4CJYs7JPZ4Ulja