The C compiler is too forgiving! sizeof(variable_name+1) allowed?

April 28, 2022 C/C++ development and debugging. , , , ,

I carelessly passed:

sizeof(s.st_size+1)

to an allocator call, instead of:

s.st_size+1

and corrupted memory nicely.

What the hell would sizeof(variable+1) even mean, and why on earth would the compiler think that is anything close to valid? Both gcc and clang, each with -Wall, are completely quiet about this error!

Curvilinear coordinates and reciprocal frames.

April 5, 2022 math and physics play

[Click here for a PDF version of this post]

Curvilinear coordinates.

Let’s start by considering a two parameter surface specified by \( \Bx = \Bx(a,b) \). This defines a surface, for which the partials are both tangent to at each point of the surface. We write
\begin{equation}\label{eqn:reciprocalAndTangentspace:20}
\begin{aligned}
\Bx_a &= \PD{a}{\Bx} \\
\Bx_b &= \PD{b}{\Bx}.
\end{aligned}
\end{equation}
We call \( \text{span}\setlr{ \Bx_a, \Bx_b } \) the tangent space of the surface at the parameter values \( a,b \). One important role of the curvilinear vectors \( \Bx_a, \Bx_b \) is to describe the area element for the subspace
\begin{equation}\label{eqn:reciprocalAndTangentspace:40}
d\Bx_a \wedge d\Bx_b
=
\lr{ \Bx_a \wedge \Bx_b } da db.
\end{equation}
Observe that for a two dimensional space, this has the form
\begin{equation}\label{eqn:reciprocalAndTangentspace:60}
d\Bx_a \wedge d\Bx_b =
\begin{vmatrix}
\Bx_a & \Bx_b
\end{vmatrix} \Bi\, da db,
\end{equation}
where \( \Bi \) is the pseudoscalar for the space. The reader may be familiar with the determinant here, which is the Jacobian encountered in a change of variable context. We may generalize this idea of tangent space to more variables in an obvious fashion. For example, given
\begin{equation}\label{eqn:reciprocalAndTangentspace:80}
\Bx = \Bx(a^1, a^2, \cdots, a^M),
\end{equation}
we write
\begin{equation}\label{eqn:reciprocalAndTangentspace:100}
\Bx_{a^i} = \PD{a^i}{\Bx}.
\end{equation}

Let’s look at some examples, starting with circular coordinates in a plane
\begin{equation}\label{eqn:reciprocalAndTangentspace:120}
\Bx(r, \theta) = r \Be_1 e^{i\theta},
\end{equation}
where \( i = \Be_1 \Be_2 \). Our tangent space vectors are
\begin{equation}\label{eqn:reciprocalAndTangentspace:140}
\Bx_r = \Be_1 e^{i\theta},
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:160}
\Bx_\theta
= r \Be_1 i e^{i\theta}
= r \Be_2 e^{i\theta}.
\end{equation}
The area element in this case is
\begin{equation}\label{eqn:reciprocalAndTangentspace:180}
d\Bx_r \wedge d\Bx_\theta
=
\Bx_r \wedge \Bx_\theta dr d\theta
=
\gpgradetwo{
\Be_1 e^{i\theta}
r \Be_2 e^{i\theta} }
dr d\theta
= i r dr d\theta.
\end{equation}
Integration over a circular region gives
\begin{equation}\label{eqn:reciprocalAndTangentspace:200}
\int_{r = 0}^R \int_{\theta=0}^{2\pi} d\Bx_r \wedge d\Bx_\theta
=
i \int_{r = 0}^R
r dr
\int_{\theta=0}^{2\pi}
d\theta
=
i \frac{R^2}{2} 2 \pi
= i \pi R^2.
\end{equation}
This is the area of the circle, scaled by the unit bivector that represents the orientation of the plane in this two dimensional subspace.

As another example, consider a spherical parameterization, as illustrated in fig. 1.
\begin{equation}\label{eqn:reciprocalAndTangentspace:220}
\Bx(r, \theta, \phi) = r \Be_1 e^{i\phi} \sin\theta + r \Be_3 \cos\theta.
\end{equation}

fig. 1. Spherical coordinates.

Our curvilinear vectors in this case are
\begin{equation}\label{eqn:reciprocalAndTangentspace:240}
\Bx_r = \Be_1 e^{i\phi} \sin\theta + \Be_3 \cos\theta,
\end{equation}
\begin{equation}\label{eqn:reciprocalAndTangentspace:260}
\Bx_\theta = r \Be_1 e^{i\phi} \cos\theta – r \Be_3 \sin\theta,
\end{equation}
\begin{equation}\label{eqn:reciprocalAndTangentspace:280}
\Bx_\phi = r \Be_2 e^{i\phi} \sin\theta.
\end{equation}
In this case our (pseudoscalar) volume element is
\begin{equation}\label{eqn:reciprocalAndTangentspace:300}
\begin{aligned}
d\Bx_r \wedge
d\Bx_\theta \wedge
d\Bx_\phi
&=
r^2 \sin\theta \gpgradethree{
\lr{ \Be_1 e^{i\phi} \sin\theta + \Be_3 \cos\theta }
\lr{ \Be_1 e^{i\phi} \cos\theta – \Be_3 \sin\theta }
\Be_2 e^{i\phi}
}
\, dr d\theta d\phi \\
&=
r^2 \sin\theta \gpgradethree{
\lr{ \Be_1 e^{i\phi} \sin\theta + \Be_3 \cos\theta }
\lr{ \Be_1 \cos\theta – \Be_3 e^{-i\phi} \sin\theta }
\Be_2
} \, dr d\theta d\phi \\
&=
r^2 \sin\theta \gpgradethree{
\lr{ -\Be_1 \Be_3 \sin^2\theta
+
\Be_3 \Be_1 \cos^2\theta
}
\Be_2
} \, dr d\theta d\phi \\
&=
\Be_3 \Be_1 \Be_2 r^2 \sin\theta
\, dr d\theta d\phi \\
&=
I r^2 \sin \theta
\, dr d\theta d\phi.
\end{aligned}
\end{equation}
This is just the standard spherical volume element, but scaled with the pseudoscalar. If we integrate the upper half of the volume (above the x-y plane), we would find \( \int_{r=0}^R \int_{\phi=0}^{2 \pi} \int_{\theta=0}^{\pi/2} d\Bx_r \wedge d\Bx_\theta \wedge d\Bx_\phi = (1/2) I (4/3) \pi R^3 \), half the volume of the sphere, again weighted by the pseudoscalar for the space. The sign would be negated for the lower half of plane, since our volume element is not strictly positive everywhere. This change of sign is not unique to this geometric algebra formulation, as we would have to integrate \( \int \Abs{\partial(x, y, z)/\partial(r,\theta, \phi)} \, dr d\theta d\phi \) if we were computing the spherical volume using a standard scalar change of variables (taking the absolute value of our Jacobian.)

As a final example, let’s pick the coordinates associated with a relativistic boost and scale parameterization in spacetime, illustrated in fig. 2, with \( r = 1 \).

fig. 2. Boost worldline.

\begin{equation}\label{eqn:reciprocalAndTangentspace:360}
x = r \gamma_0 e^{\gamma_0 \gamma_1 \alpha}.
\end{equation}
For this surface we have
\begin{equation}\label{eqn:reciprocalAndTangentspace:380}
\begin{aligned}
x_r &= \gamma_0 e^{\gamma_0 \gamma_1 \alpha} \\
x_\alpha &= r \gamma_1 e^{\gamma_0 \gamma_1 \alpha}.
\end{aligned}
\end{equation}
In this case the volume element is
\begin{equation}\label{eqn:reciprocalAndTangentspace:400}
dx_r \wedge dx_\alpha
= r dr d\alpha \gpgradetwo{
\gamma_0 e^{\gamma_{01} \alpha}
\gamma_1 e^{\gamma_{01} \alpha}
}
= r dr d\alpha \gpgradetwo{
\gamma_0
\gamma_1
e^{-\gamma_{01} \alpha}
e^{\gamma_{01} \alpha}
}
= \gamma_{01} r dr d\alpha.
\end{equation}
This is cosmetically similar to the circular area element above, also weighted by a pseudoscalar, but in this case, \( \alpha \) is not restricted to a bounded interval. We also see that the basic ideas here work for both Euclidean and non-Euclidean vector spaces.

Reciprocal frame vectors.

Returning to a two dimensional surface, with tangent plane \( \text{span}\setlr{ \Bx_a, \Bx_b } \), any vector in that plane has the form
\begin{equation}\label{eqn:reciprocalAndTangentspace:320}
\By = y^a \Bx_a + y^b \Bx_b.
\end{equation}
This is illustrated in fig. 3.

fig. 3. Tangent plane for two parameter surface.

Coordinates.

We call \( y^a, y^b \) the coordinates of the vector \( \By \) with respect to the basis for the tangent space \( \text{span}\setlr{ \Bx_a, \Bx_b } \). The computation of these coordinates is facilitated by finding the reciprocal frame \( \Bx^a, \Bx^b \) for the tangent space that satisfies both \( \Bx^a, \Bx^b \in \text{span} \setlr{\Bx_a, \Bx_b } \), and
\begin{equation}\label{eqn:reciprocalAndTangentspace:340}
\Bx^\mu \cdot \Bx_\nu = {\delta^\mu}_\nu,
\end{equation}
for all \( \mu \in \setlr{a,b} \).

We may demonstrate that this works by example, dotting with each of our reciprocal frame vectors
\begin{equation}\label{eqn:reciprocalAndTangentspace:420}
\begin{aligned}
y \cdot \Bx^a
&=
\lr{ y^a \Bx_a + y^b \Bx_b } \cdot \Bx^a \\
&=
y^a \lr{ \Bx_a \cdot \Bx^a } + y^b \lr{\Bx_b \cdot \Bx^a } \\
&= y^a,
\end{aligned}
\end{equation}
and similarly
\begin{equation}\label{eqn:reciprocalAndTangentspace:440}
\begin{aligned}
y \cdot \Bx^b
&=
\lr{ y^a \Bx_a + y^b \Bx_b } \cdot \Bx^b \\
&=
y^a \lr{ \Bx_a \cdot \Bx^b } + y^b \lr{\Bx_b \cdot \Bx^b } \\
&= y^b.
\end{aligned}
\end{equation}
Provided we can find these reciprocal vectors, they provide the projections along each of the respective directions, allowing us to formulate the coordinate decomposition with respect to either the curvilinear or the reciprocal basis
\begin{equation}\label{eqn:reciprocalAndTangentspace:460}
\By =
\lr{ \By \cdot \Bx^a } \Bx_a
+
\lr{ \By \cdot \Bx^b } \Bx_b
=
\lr{ \By \cdot \Bx_a } \Bx^a
+
\lr{ \By \cdot \Bx_b } \Bx^b.
\end{equation}
For orthonornal Euclidean vectors, this reduces to the familiar sum of projections

\begin{equation}\label{eqn:reciprocalAndTangentspace:480}
\Bx = \sum_i \lr{ \Bx \cdot \Be_i } \Be_i.
\end{equation}
The reciprocal frame allows us to find the coordinates with respect to a oblique (non-orthonormal) basis, also not imposing a requirement for the space to be Euclidean.

Orthogonal curvilinear coordinates.

When our tangent plane vectors are orthogonal, computation of the reciprocal frame just requires scaling. That scaling, perhaps not suprisingly, given the name reciprocal, just requires a vector inverse. For our two parameter case, that is just
\begin{equation}\label{eqn:reciprocalAndTangentspace:500}
\Bx^a = \inv{\Bx_a} = \frac{\Bx_a}{\Bx_a \cdot \Bx_a}
, \quad
\Bx^b = \inv{\Bx_b} = \frac{\Bx_b}{\Bx_b \cdot \Bx_b}.
\end{equation}
The reader can readily verify that \( \Bx^a \cdot \Bx_a = \Bx^b \cdot \Bx_b = 1 \), and \( \Bx^a \cdot \Bx_b = \Bx^b \cdot \Bx_a = 0 \).

As an example, using the circular frame considered above, where we had
\begin{equation}\label{eqn:reciprocalAndTangentspace:520}
\begin{aligned}
\Bx_r &= \Be_1 e^{i\theta} \\
\Bx_\theta &= r \Be_2 e^{i\theta},
\end{aligned}
\end{equation}
the reciprocals are just
\begin{equation}\label{eqn:reciprocalAndTangentspace:540}
\begin{aligned}
\Bx^r &= \Be_1 e^{i\theta} \\
\Bx^\theta &= \inv{r} \Be_2 e^{i\theta}.
\end{aligned}
\end{equation}
In this specific case, the reader can also readily verify that \( \Bx^r \cdot \Bx_r = \Bx^\theta \cdot \Bx_\theta = 1 \), and \( \Bx^r \cdot \Bx_\theta = \Bx^\theta \cdot \Bx_r = 0 \).

Similarly, for the spherical frame basis (\ref{eqn:reciprocalAndTangentspace:240}, …), we have
\begin{equation}\label{eqn:reciprocalAndTangentspace:560}
\Bx_r^2 = \Abs{e^{i\phi} \sin\theta}^2 + \cos^2\theta = 1,
\end{equation}
\begin{equation}\label{eqn:reciprocalAndTangentspace:580}
\Bx_\theta^2 = r^2 \lr{ \Abs{e^{i\phi} \cos\theta}^2 + \sin^2\theta } = r^2,
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:600}
\Bx_\phi^2 = r^2 \sin^2\theta,
\end{equation}
so the spherical reciprocals are just
\begin{equation}\label{eqn:reciprocalAndTangentspace:620}
\Bx^r = \Be_1 e^{i\phi} \sin\theta + \Be_3 \cos\theta,
\end{equation}
\begin{equation}\label{eqn:reciprocalAndTangentspace:640}
\Bx^\theta = \inv{r} \lr{ \Be_1 e^{i\phi} \cos\theta – \Be_3 \sin\theta},
\end{equation}
\begin{equation}\label{eqn:reciprocalAndTangentspace:660}
\Bx^\phi = \inv{r \sin\theta} \Be_2 e^{i\phi}.
\end{equation}

Using straight inversion to compute the reciprocal frame vectors even works for non-Euclidean spaces. Consider the following example, using the relativisitic (Dirac) basis
\begin{equation}\label{eqn:reciprocalAndTangentspace:680}
x(a,b) = a \lr{ \gamma_1 + \gamma_2 } + b \gamma_3,
\end{equation}
for which we have
\begin{equation}\label{eqn:reciprocalAndTangentspace:700}
x_a = \gamma_1 + \gamma_2,
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:720}
x_b = \gamma_3.
\end{equation}
We have to be a bit more careful to compute the squares for this mixed metric space, but if we do that, we find
\begin{equation}\label{eqn:reciprocalAndTangentspace:740}
x_a^2 =
\gamma_1^2 + \gamma_2^2
= -2,
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:760}
x_b^2 = -1,
\end{equation}
so
\begin{equation}\label{eqn:reciprocalAndTangentspace:780}
x^a = -\inv{2} \lr{ \gamma_1 + \gamma_2} ,
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:800}
x^b = -\gamma_3.
\end{equation}
However, other than the fact that our vectors may square to either positive or negative values, the reciprocals are still trivial to calculate.

This example also serves to point out the importance of the span constraint \( x^a, x^b \in \text{span} \setlr{ x_a, x_b } \). For example, suppose we altered one of the reciprocal frames with a vector component that is orthogonal to either of the original \( x_a, x_b \) vectors, such as
\begin{equation}\label{eqn:reciprocalAndTangentspace:820}
x^b = -\gamma_3 + 2 \gamma_0.
\end{equation}
We still have \( x^a \cdot x_a = x^b \cdot x_b = 1 \), and \( x^a \cdot x_b = x^b \cdot x_a = 0 \), but can no longer write \( y = \lr{ y \cdot x_a } x^a + \lr{ y \cdot x_b } x^b \) for any vector \( y \in \text{span} \setlr{ x_a, x_b } \), since this would now introduce a contribution in space that no longer lies in the tangent plane.

Another gotcha to consider for non-Euclidean spaces is that we will need some other way to compute the reciprocals if we have lightlike vectors (with zero square) as in the following parameterization
\begin{equation}\label{eqn:reciprocalAndTangentspace:840}
x(a,b) = a \lr{ \gamma_0 + \gamma_1 } + b \lr{ \gamma_0 – \gamma_1 }.
\end{equation}
Here both of the tangent space vectors
\begin{equation}\label{eqn:reciprocalAndTangentspace:860}
\begin{aligned}
x_a &= \gamma_0 + \gamma_1 \\
x_b &= \gamma_0 – \gamma_1,
\end{aligned}
\end{equation}
are lightlike. This basis spans the \(ct,x\) spacetime plane (\(\text{span} \setlr{ \gamma_0, \gamma_1 } \)), so we can reach any points on that plane. Clearly it must be possible to find the coordinates of vectors on that plane with respect to this basis, but we will have to figure out how to do so. We also do not know how to find the coordinates of vectors that lie in the tangent planes with curvilinear basis vectors that are non-orthogonal.

Reciprocal frame for non-orthogonal coordinates.

Now let’s figure out how to compute the reciprocal vectors for the more general case where the tangent space vectors are not orthogonal. Doing so for a two parameter surface will be sufficient, as the generalization to higher degree surfaces will be clear.

Given \( \Bx^a, \Bx^b \in \text{span} \setlr{ \Bx_a, \Bx_b } \), we set
\begin{equation}\label{eqn:reciprocalAndTangentspace:880}
\begin{aligned}
\Bx^a &= \alpha^1 \Bx_a + \alpha^2 \Bx_b \\
\Bx^b &= \beta^1 \Bx_a + \beta^2 \Bx_b,
\end{aligned}
\end{equation}
subject to the constraints \( \Bx^\mu \cdot \Bx_\nu = {\delta^\mu}_\nu, \forall \mu,\nu \in a,b \). That is
\begin{equation}\label{eqn:reciprocalAndTangentspace:900}
\begin{aligned}
\Bx^a \cdot \Bx_a &= \alpha^1 \Bx_a \cdot \Bx_a + \alpha^2 \Bx_b \cdot \Bx_a = 1 \\
\Bx^a \cdot \Bx_b &= \alpha^1 \Bx_a \cdot \Bx_b + \alpha^2 \Bx_b \cdot \Bx_b = 0 \\
\Bx^b \cdot \Bx_a &= \beta^1 \Bx_a \cdot \Bx_a + \beta^2 \Bx_b \cdot \Bx_a = 0 \\
\Bx^b \cdot \Bx_b &= \beta^1 \Bx_a \cdot \Bx_b + \beta^2 \Bx_b \cdot \Bx_b = 1.
\end{aligned}
\end{equation}
With
\begin{equation}\label{eqn:reciprocalAndTangentspace:920}
D =
\begin{bmatrix}
\Bx_a \cdot \Bx_a & \Bx_b \cdot \Bx_a \\
\Bx_a \cdot \Bx_b & \Bx_b \cdot \Bx_b
\end{bmatrix},
\end{equation}
that is
\begin{equation}\label{eqn:reciprocalAndTangentspace:940}
\begin{aligned}
D
\begin{bmatrix}
\alpha^1 \\
\alpha^2 \\
\end{bmatrix}
&=
\begin{bmatrix}
1 \\
0
\end{bmatrix} \\
D
\begin{bmatrix}
\beta^1 \\
\beta^2 \\
\end{bmatrix}
&=
\begin{bmatrix}
0 \\
1
\end{bmatrix} \\
\end{aligned}.
\end{equation}
Since
\begin{equation}\label{eqn:reciprocalAndTangentspace:960}
D^{-1}
=
\inv{
\begin{vmatrix}
\Bx_a \cdot \Bx_a & \Bx_b \cdot \Bx_a \\
\Bx_a \cdot \Bx_b & \Bx_b \cdot \Bx_b
\end{vmatrix}
}
\begin{bmatrix}
\Bx_b \cdot \Bx_b & -\Bx_b \cdot \Bx_a \\
-\Bx_a \cdot \Bx_b & \Bx_a \cdot \Bx_a
\end{bmatrix},
\end{equation}
we have
\begin{equation}\label{eqn:reciprocalAndTangentspace:980}
\begin{aligned}
\begin{bmatrix}
\alpha^1 \\
\alpha^2 \\
\end{bmatrix}
&=
\inv{
\Bx_a^2 \Bx_b^2 – \lr{ \Bx_a \cdot \Bx_b }^2
}
\begin{bmatrix}
\Bx_b \cdot \Bx_b \\
-\Bx_a \cdot \Bx_b
\end{bmatrix} \\
\begin{bmatrix}
\beta^1 \\
\beta^2 \\
\end{bmatrix}
&=
\inv{
\Bx_a^2 \Bx_b^2 – \lr{ \Bx_a \cdot \Bx_b }^2
}
\begin{bmatrix}
-\Bx_b \cdot \Bx_a \\
\Bx_a \cdot \Bx_a
\end{bmatrix}.
\end{aligned}
\end{equation}
Back substitution gives
\begin{equation}\label{eqn:reciprocalAndTangentspace:1000}
\begin{aligned}
\Bx^a
&=
\frac{
\Bx_b^2 \Bx_a – \lr{\Bx_a \cdot \Bx_b} \Bx_b
}
{
\Bx_a^2 \Bx_b^2 – \lr{ \Bx_a \cdot \Bx_b }^2
} \\
\Bx^b
&=
\frac{
-\lr{ \Bx_b \cdot \Bx_a } \Bx_a
+
\Bx_a^2 \Bx_b
}
{
\Bx_a^2 \Bx_b^2 – \lr{ \Bx_a \cdot \Bx_b }^2
}.
\end{aligned}
\end{equation}

Geometric algebra form of the reciprocal frame vectors.

The mess of dot products above is not terribly desirable. This can be cleaned up significantly, by observing that a bivector term can be factored from both the numerator and denominator. In particular, using the distribution identity, a squared bivector has the form
\begin{equation}\label{eqn:reciprocalAndTangentspace:1020}
\begin{aligned}
\lr{ \Ba \wedge \Bb }^2
&=
\lr{ \Ba \wedge \Bb }
\cdot
\lr{ \Ba \wedge \Bb } \\
&=
\lr{ \lr{ \Ba \wedge \Bb } \cdot \Ba } \cdot \Bb \\
&=
\lr{ \lr{ \Bb \cdot \Ba } \Ba – \Ba^2 \Bb } \cdot \Bb \\
&=
\lr{ \Bb \cdot \Ba }^2 – \Ba^2 \Bb^2.
\end{aligned}
\end{equation}
Also
\begin{equation}\label{eqn:reciprocalAndTangentspace:1040}
\lr{ \Ba \wedge \Bb } \cdot \Bc =
\lr{ \Bb \cdot \Bc } \Ba

\lr{ \Ba \cdot \Bc } \Bb.
\end{equation}

Using these, we can write
\begin{equation}\label{eqn:reciprocalAndTangentspace:1060}
\begin{aligned}
\Bx^a
&=
\frac{
\Bx_b \cdot \lr{ \Bx_a \wedge \Bx_b }
}
{
\lr{ \Bx_a \wedge \Bx_b }^2
} \\
\Bx^b
&=
\frac{
-\Bx_a \cdot \lr{ \Bx_a \wedge \Bx_b }
}
{
\lr{ \Bx_a \wedge \Bx_b }^2
} \\
\end{aligned},
\end{equation}
or
\begin{equation}\label{eqn:reciprocalAndTangentspace:1080}
\begin{aligned}
\Bx^a
&=
\Bx_b \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b } } \\
\Bx^b
&=
-\Bx_a \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b } }.
\end{aligned}
\end{equation}

It’s immediately clear why this works. Take for example
\begin{equation}\label{eqn:reciprocalAndTangentspace:1100}
\begin{aligned}
\Bx_a \cdot \Bx^a
&=
\Bx_a \cdot \lr{ \Bx_b \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b } } } \\
&=
\lr{ \Bx_a \wedge \Bx_b } \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b } } \\
&=
1,
\end{aligned}
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:1120}
\begin{aligned}
\Bx_b \cdot \Bx^a
&=
\Bx_b \cdot \lr{ \Bx_b \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b } } } \\
&=
\lr{ \Bx_b \wedge \Bx_b } \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b } } \\
&=
0.
\end{aligned}
\end{equation}

It’s immediately obvious that if we generalize to a three parameter surface, then we must have
\begin{equation}\label{eqn:reciprocalAndTangentspace:1140}
\begin{aligned}
\Bx^a
&=
\lr{ \Bx_b \wedge \Bx_c } \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b \wedge \Bx_c } } \\
\Bx^b
&=
-\lr{ \Bx_a \wedge \Bx_c } \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b \wedge \Bx_c } } \\
\Bx^c
&=
\lr{ \Bx_a \wedge \Bx_b } \cdot \inv{ \lr{ \Bx_a \wedge \Bx_b \wedge \Bx_c } }.
\end{aligned}
\end{equation}

How to generalize to still higher dimensions is clear. Specifically, given \( \Bx = \Bx(a^1, a^2, \cdots, a^m) \), let’s write \( \Bx_i = \PDi{a^i}{\Bx} \), with reciprocals \( \Bx^i \). Then the reciprocals are given by
\begin{equation}\label{eqn:reciprocalAndTangentspace:1300}
\Bx^i = (-1)^{i-1} \lr{ \Bx_1 \wedge \cdots \Bx_{i-1} \wedge \Bx_{i+1} \cdots \Bx_m } \cdot \inv{ \Bx_1 \wedge \Bx_2 \wedge \cdots \Bx_m }.
\end{equation}
In the leading blade, we have a wedge of all the basis elements, except for \( \Bx_i \), and each time we move down the line, the sign changes by a factor of one.

Let’s apply this blade dot product form of the reciprocal frame vectors to some non-orthogonal examples. For the first example, consider an elliptical parameterization illustrated in fig. 4.

fig. 4. Elliptical parameter differentials.

\begin{equation}\label{eqn:reciprocalAndTangentspace:1320}
\Bx = a \Be_1 \cos\theta + a \epsilon \Be_2 \sin\theta.
\end{equation}
We find that curvilinear bases vectors
\begin{equation}\label{eqn:reciprocalAndTangentspace:1340}
\begin{aligned}
\Bx_a &= \Be_1 \cos\theta + \epsilon \Be_2 \sin\theta \\
\Bx_\theta &= -a \Be_1 \sin\theta + a \epsilon \Be_2 \cos\theta.
\end{aligned}
\end{equation}
We can check that these are generally non-orthogonal as
\begin{equation}\label{eqn:reciprocalAndTangentspace:1360}
\Bx_a \cdot \Bx_\theta = – a \cos\theta \sin\theta + a \epsilon^2 \cos\theta \sin\theta
= \frac{a}{2} \lr{ \epsilon^2 -1 } \sin\lr{ 2 \theta },
\end{equation}
which shows that these vectors are orthogonal only in the limiting circular case, where the eccentricity \( \epsilon \) goes to one, or at the specific points \( \theta = n \pi/2 \). The area element is
\begin{equation}\label{eqn:reciprocalAndTangentspace:1380}
\begin{aligned}
d\Bx_a \wedge d\Bx_\theta
&= \lr{ \Be_1 \cos\theta + \epsilon \Be_2 \sin\theta } \wedge \lr{ -a \Be_1 \sin\theta + a \epsilon \Be_2 \cos\theta } \, da d\theta \\
&= a \epsilon \Be_1 \Be_2 \lr{ \cos^2 \theta + \sin^2 \theta } \, da d\theta \\
&= i a \epsilon da d\theta.
\end{aligned}
\end{equation}
We can use this to find the (unit pseudoscalar scaled) area of an ellipse, which is
\begin{equation}\label{eqn:reciprocalAndTangentspace:1400}
\begin{aligned}
A &= \int_{a = 0}^a \int_{\theta = 0}^{2\pi} d\Bx_a \wedge d\Bx_\theta \\
&= \int_{a = 0}^a \int_{\theta = 0}^{2\pi} i a \epsilon da d\theta \\
&= i \frac{a^2}{2} \epsilon \lr{ 2 \pi } \\
&= i \pi a \lr{ a \epsilon }.
\end{aligned}
\end{equation}
As a check observe that we recover the circular area in the limit \( \epsilon \rightarrow 1 \), where \( a = a \epsilon \) is the radius of the circle. Now let’s find our reciprocals
\begin{equation}\label{eqn:reciprocalAndTangentspace:1420}
\begin{aligned}
\Bx^a
&= \Bx_\theta \cdot \inv{ i a \epsilon } \\
&= \inv{a \epsilon} \lr{ -a \Be_1 \sin\theta + a \epsilon \Be_2 \cos\theta } \cdot \lr{ \Be_2 \Be_1 } \\
&= \inv{\epsilon} \lr{ \Be_2 \sin\theta + \epsilon \Be_1 \cos\theta },
\end{aligned}
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:1440}
\begin{aligned}
\Bx^\theta
&= -\Bx_a \cdot \inv{ i a \epsilon } \\
&= -\inv{a \epsilon} \lr{ \Be_1 \cos\theta + \epsilon \Be_2 \sin\theta } \cdot \lr{ \Be_2 \Be_1 } \\
&= \inv{a \epsilon} \lr{ \Be_2 \cos\theta – \epsilon \Be_1 \sin\theta }.
\end{aligned}
\end{equation}

Let’s return to the relativistic two parameter surface of \ref{eqn:reciprocalAndTangentspace:840}. Our area element is
\begin{equation}\label{eqn:reciprocalAndTangentspace:1460}
\begin{aligned}
dx_a \wedge dx_b &=
\lr{
\gamma_0 + \gamma_1
}
\wedge
\lr{
\gamma_0 – \gamma_1
}
\, da db \\
&= 2 \gamma_1 \gamma_0\, da db.
\end{aligned}
\end{equation}
so our reciprocals are
\begin{equation}\label{eqn:reciprocalAndTangentspace:1480}
\begin{aligned}
x^a
&= x_b \cdot \inv{ 2 \gamma_{10} } \\
&= \inv{2} \lr{ \gamma_0 – \gamma_1 } \cdot \gamma_{01} \\
&= \inv{2} \lr{ \gamma_1 – \gamma_0 },
\end{aligned}
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:1500}
\begin{aligned}
x^b
&= -x_a \cdot \inv{ 2 \gamma_{10} } \\
&= – \inv{2} \lr{ \gamma_0 + \gamma_1 } \cdot \gamma_{01} \\
&= – \inv{2} \lr{ \gamma_1 + \gamma_0 }.
\end{aligned}
\end{equation}
Sure enough we are able to compute a set of reciprocal frame vectors, satisfying the definition. In this case, both of those are also lightlike, even though they span the \( ct,x\) plane.

Matrix solution of the reciprocal frame vectors.

An alternative, one that is possibly more computationally effecient, is using matrix algebra to perform the same computation. Consider an m-parameter surface \( \Bx = \Bx(a^1, \cdots, a^m) \), with \( \Bx_i = \PDi{a^i}{\Bx} \), we can form a Jacobian matrix of all the partials
\begin{equation}\label{eqn:reciprocalAndTangentspace:1160}
J^\T =
\begin{bmatrix}
\Bx_1 & \Bx_2 & \cdots & \Bx_m
\end{bmatrix}.
\end{equation}
We can now cast each reciprocal vector into a matrix equation to be solved, say
\begin{equation}\label{eqn:reciprocalAndTangentspace:1180}
\Bx^i = J^\T \Balpha_i,
\end{equation}
where \( \Balpha_i \) is an unknown column matrix to be determined for each reciprocal vector.
The m-parameter generalization of \ref{eqn:reciprocalAndTangentspace:920} is
\begin{equation}\label{eqn:reciprocalAndTangentspace:2140}
D \Balpha_i = \Be_i,
\end{equation}
where
\begin{equation}\label{eqn:reciprocalAndTangentspace:1200}
D = J G J^\T,
\end{equation}
and \( G \) is the metric matrix for the space.  Note that for most of physics, there are really only two metrics of interest. The first is the identity matrix \( G = I \), which we use for Euclidean spaces, and \( G = \pm \text{diag}(1,-1,-1,-1) \), the metric for special relativity.

In block matrix form, we have
\begin{equation}\label{eqn:reciprocalAndTangentspace:2160}
J G J^\T
\begin{bmatrix}
\Balpha_1 & \cdots & \Balpha_m
\end{bmatrix}
= I,
\end{equation}
or
\begin{equation}\label{eqn:reciprocalAndTangentspace:2220}
\begin{bmatrix}
\Balpha_1 & \cdots & \Balpha_m
\end{bmatrix}
=
\lr{J G J^\T}^{-1}.
\end{equation}

Let
\begin{equation}\label{eqn:reciprocalAndTangentspace:2180}
X =
\begin{bmatrix}
\Bx^1 & \cdots & \Bx^m
\end{bmatrix},
\end{equation}
so
\begin{equation}\label{eqn:reciprocalAndTangentspace:2200}
X = J^\T
\begin{bmatrix}
\Balpha_1 & \cdots & \Balpha_m
\end{bmatrix}
=
J^\T
\lr{J G J^\T}^{-1}.
\end{equation}

In the special case where the number of parameters equals the dimension of the vector space, \( J^\T \) is both square and (generally) invertible, so we can simplify things considerably
\begin{equation}\label{eqn:reciprocalAndTangentspace:2100}
\begin{aligned}
X
&=
J^\T \lr{ J G J^\T }^{-1} \\
&=
J^\T (J^\T)^{-1} G^{-1} J^{-1} \\
&=
G^{-1} J^{-1} \\
&=
\lr{ J G }^{-1}.
\end{aligned}
\end{equation}

Gradient in curvilinear coordinates.

We define the gradient \(\spacegrad\), implicitly as a directional derivative of the following form
\begin{equation}\label{eqn:reciprocalAndTangentspace:1520}
\Ba \cdot \spacegrad f = \evalbar{ \ddt{} f(\Bx + \Ba t) }{t = 0}.
\end{equation}
Expanding by chain rule, this is
\begin{equation}\label{eqn:reciprocalAndTangentspace:1540}
\Ba \cdot \spacegrad f
= \evalbar{ \PD{(x^i + a^i t)}{f} \PD{t}{(x^i + a^i t)} }{ t = 0 }
= a^i \PD{x^i}{f}
= \lr{ \Ba \cdot \Be^i} \PD{x^i}{f}
= \Ba \cdot \lr{ \Be^i \PD{x^i}{} } f,
\end{equation}
so, the gradient with respect to the standard basis \( \setlr{ \Be_i } \), and it’s reciprocal frame \( \setlr{\Be^i} \), is
\begin{equation}\label{eqn:reciprocalAndTangentspace:1560}
\spacegrad = \Be^i \PD{x^i}{}.
\end{equation}
The reciprocal basis pairing here is an allowance for non-Euclidean spaces, and for Euclidean spaces reduces to the usual, since \( \Be^i = \Be_i \).
Next we consider a change of coordinates, where
\begin{equation}\label{eqn:reciprocalAndTangentspace:1580}
x^i = x^i( a^1, a^2, \cdots, a^n ).
\end{equation}
Expressing the gradient in terms of these parameters, we have
\begin{equation}\label{eqn:reciprocalAndTangentspace:1600}
\spacegrad = \Be^i \PD{x^i}{a^j} \PD{a^j}{}.
\end{equation}
With
\begin{equation}\label{eqn:reciprocalAndTangentspace:1620}
\Bx^j = \Be^i \PD{x^i}{a^j} = \spacegrad a^j,
\end{equation}
we have
\begin{equation}\label{eqn:reciprocalAndTangentspace:1640}
\spacegrad = \Bx^j \PD{a^j}{},
\end{equation}
a curvilinear representation of the gradient.

These parameter gradients have been written as \( \Bx^j \)’s as they are reciprocal to \( \Bx_j = \PDi{a_j}{\Bx} \). To show this, we just have to computing the dot products of such a pair, and apply the chain rule in reverse
\begin{equation}\label{eqn:reciprocalAndTangentspace:1660}
\begin{aligned}
\Bx^i \cdot \Bx_j &= \lr{ \Be^k \PD{x^k}{a^i} } \cdot \PD{a^j}{\Bx} \\
&= \lr{ \Be^k \PD{x^k}{a^i} } \cdot \lr{ \PD{a^j}{x^m} \Be_m } \\
&= {\delta^k}_m \PD{x^k}{a^i} \PD{a^j}{x^m} \\
&= \PD{x^m}{a^i} \PD{a^j}{x^m} \\
&= \PD{a^j}{a^i} \\
&= {\delta^i}_j.
\end{aligned}
\end{equation}
This provides yet another way to compute our reciprocal frame. Manually computing the reciprocal frame vectors this way can be pretty hard if we try to do this in the straightforward braindead way, but we will see there is an easier way.

Illustrating by example, consider the circular parameterization again, with
\begin{equation}\label{eqn:reciprocalAndTangentspace:1680}
\Bx = \Be_1 e^{i \theta}, \quad i = \Be_1 \Be_2.
\end{equation}
In order to take the gradients of \( r, \theta \), we can first write out our parameterization in coordinates
\begin{equation}\label{eqn:reciprocalAndTangentspace:1700}
\begin{aligned}
x &= r \cos\theta \\
y &= r \sin\theta,
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:reciprocalAndTangentspace:1720}
\begin{aligned}
r^2 &= x^2 + y^2 \\
\tan\theta = \frac{y}{x}.
\end{aligned}
\end{equation}
The \( r \) gradient is easy to compute
\begin{equation}\label{eqn:reciprocalAndTangentspace:1740}
\spacegrad r^2
= 2 x \Be_1 + 2 y \Be_2,
\end{equation}
or
\begin{equation}\label{eqn:reciprocalAndTangentspace:1760}
\spacegrad r
= \frac{x}{r} \Be_1 + \frac{y}{r} \Be_2
= \cos\theta \Be_1 + \sin\theta \Be_2
= \Be_1 e^{i\theta}.
\end{equation}
For the \( \theta \) gradient we have
\begin{equation}\label{eqn:reciprocalAndTangentspace:1780}
\sec^2 \theta \spacegrad \theta
= \spacegrad
\frac{y}{x}
=
\Be_1 \PD{x}{} \frac{y}{x}
+
\Be_2 \PD{y}{} \frac{y}{x}
=
-\Be_1 \frac{y}{x^2} + \Be_2 \inv{x},
\end{equation}
so
\begin{equation}\label{eqn:reciprocalAndTangentspace:1800}
\begin{aligned}
\spacegrad \theta
&=
\cos^2\theta \lr{ -\Be_1 \frac{r \sin\theta}{r^2 \cos^2\theta} + \Be_2 \inv{r \cos\theta} } \\
&=
\inv{r} \lr{ -\Be_1 \sin\theta + \Be_2 \cos\theta } \\
&=
\frac{\Be_2}{r} \lr{ -\Be_2 \Be_1 \sin\theta + \cos\theta } \\
&=
\inv{r} \Be_2 e^{i\theta}.
\end{aligned}
\end{equation}
As well as finding our reciprocals \( \Bx^r = \spacegrad r, \Bx^\theta = \spacegrad \theta \), we now know the circular representation of the gradient
\begin{equation}\label{eqn:reciprocalAndTangentspace:2120}
\spacegrad
=
\Be_1 e^{i\theta}
\PD{r}{}
+
\inv{r} \Be_2 e^{i\theta} \PD{\theta}{}
= \rcap \PD{r}{} + \inv{r} \thetacap \PD{\theta}{}.
\end{equation}

It was a lot trickier to compute the reciprocal frame vectors this way than our previous vector-bivector dot products or matrix inverse methods. That computation also only seemed possible because we could solve for \( r, \theta \) in this specific case. What would we do when we have more complicated and unseparable parameterizations? Well, we don’t actually have to be able to solve for the parameters as functions of the coordinates, since we can use the same implicit differentiation methods used above in a more systematic fashion. Given
\begin{equation}\label{eqn:reciprocalAndTangentspace:2240}
x^i = x^i(a^1, a^2, \cdots, a^n),
\end{equation}
the gradients of each of these coordinates is
\begin{equation}\label{eqn:reciprocalAndTangentspace:2260}
\begin{aligned}
\spacegrad x^i
=
e^j \PD{x^j}{x^i}
= e^j {\delta^i}_j
= e^i.
\end{aligned}
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:2280}
\begin{aligned}
\spacegrad x^i
&=
e^j \PD{x^j}{x^i} \\
&=
e^j \PD{a^k}{x^i} \PD{x^j}{a^k} \\
&=
\PD{a^k}{x^i} \spacegrad a^k
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:reciprocalAndTangentspace:2300}
\PD{a^k}{x^i} \spacegrad a^k = \Be^i.
\end{equation}
In block matrix form, this is
\begin{equation}\label{eqn:reciprocalAndTangentspace:2320}
\begin{bmatrix}
\spacegrad a^1 & \cdots & \spacegrad a^n
\end{bmatrix}
\begin{bmatrix}
\PD{a^1}{x^1} & \cdots & \PD{a^1}{x^n} \\
\vdots & & \\
\PD{a^n}{x^1} & \cdots & \PD{a^n}{x^n}
\end{bmatrix}
=
\begin{bmatrix}
\Be^1 & \cdots & \Be^n
\end{bmatrix}.
\end{equation}
Note that
\begin{equation}\label{eqn:reciprocalAndTangentspace:2340}
{
\begin{bmatrix}
\Be_1 & \cdots & \Be_n
\end{bmatrix}
}^\T
G
\begin{bmatrix}
\Be^1 & \cdots & \Be^n
\end{bmatrix}
= I,
\end{equation}
or
\begin{equation}\label{eqn:reciprocalAndTangentspace:2360}
\begin{bmatrix}
\Be^1 & \cdots & \Be^n
\end{bmatrix}
= G^{-1},
\end{equation}
so
\begin{equation}\label{eqn:reciprocalAndTangentspace:2380}
\begin{bmatrix}
\spacegrad a^1 & \cdots & \spacegrad a^n
\end{bmatrix}
J = G^{-1}.
\end{equation}
This gives us
\begin{equation}\label{eqn:reciprocalAndTangentspace:2400}
X =
G^{-1}
J^{-1}
=
\lr{J G}^{-1},
\end{equation}
as we found previously.

Let’s write this out explicitly for the two parameter (Euclidean) case, and apply it to our circular parameterization
\begin{equation}\label{eqn:reciprocalAndTangentspace:1960}
\begin{bmatrix}
\spacegrad a & \spacegrad b
\end{bmatrix}
=
{\begin{bmatrix}
\PD{a}{x^1} & \PD{a}{x^2} \\
\PD{b}{x^1} & \PD{b}{x^2}
\end{bmatrix}
}^{-1}
=
\frac{
\begin{bmatrix}
\PD{b}{x^2} & -\PD{a}{x^2} \\
-\PD{b}{x^1} & \PD{a}{x^1}
\end{bmatrix}
}{
\PD{a}{x^1} \PD{b}{x^2} – \PD{b}{x^1} \PD{a}{x^2}
},
\end{equation}
or
\begin{equation}\label{eqn:reciprocalAndTangentspace:1980}
\begin{aligned}
\spacegrad a &= \inv{\Abs{J}} \lr{ \PD{b}{x^2} \Be_1 -\PD{b}{x^1} \Be_2 } \\
\spacegrad b &= \inv{\Abs{J}} \lr{ -\PD{a}{x^2} \Be_1 + \PD{a}{x^1} \Be_2 }.
\end{aligned}
\end{equation}

Application to the our familiar circular parameterization gives
\begin{equation}\label{eqn:reciprocalAndTangentspace:2000}
\begin{aligned}
x &= r \cos\theta \\
y &= r \sin\theta,
\end{aligned}
\end{equation}
so
\begin{equation}\label{eqn:reciprocalAndTangentspace:2020}
J^\T =
\begin{bmatrix}
\cos\theta & -r \sin\theta \\
\sin\theta & r \cos\theta
\end{bmatrix},
\end{equation}
so
\begin{equation}\label{eqn:reciprocalAndTangentspace:2040}
\Abs{J} = r \lr{ \cos^2\theta + \sin^2 \theta } = r.
\end{equation}
Our gradients are
\begin{equation}\label{eqn:reciprocalAndTangentspace:2060}
\begin{aligned}
\spacegrad r
&= \inv{r} \lr{ \Be_1 \PD{\theta}{} (r \sin\theta) – \Be_2 \PD{\theta}{} (r \cos\theta) } \\
&= \Be_1 \cos\theta + \Be_2 \sin\theta \\
&= \Be_1 e^{i\theta},
\end{aligned}
\end{equation}
and
\begin{equation}\label{eqn:reciprocalAndTangentspace:2080}
\begin{aligned}
\spacegrad \theta
&= \inv{r} \lr{ -\Be_1 \PD{r}{} (r \sin\theta) + \Be_2 \PD{r}{} (r \cos\theta) } \\
&= \inv{r} \lr{ -\Be_1 \sin\theta + \Be_2 \cos\theta } \\
&= \frac{\Be_2}{r} \lr{ -\Be_2 \Be_1 \sin\theta + \cos\theta } \\
&= \inv{r} \Be_2 e^{i \theta},
\end{aligned}
\end{equation}
as expected.

Gauge freedom and four-potentials in the STA form of Maxwell’s equation.

March 27, 2022 math and physics play , , , , , , , , , , , , , , , , , , , , ,

[If mathjax doesn’t display properly for you, click here for a PDF of this post]

Motivation.

In a recent video on the tensor structure of Maxwell’s equation, I made a little side trip down the road of potential solutions and gauge transformations. I thought that was worth writing up in text form.

The initial point of that side trip was just to point out that the Faraday tensor can be expressed in terms of four potential coordinates
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:20}
F_{\mu\nu} = \partial_\mu A_\nu – \partial_\nu A_\mu,
\end{equation}
but before I got there I tried to motivate this. In this post, I’ll outline the same ideas.

STA representation of Maxwell’s equation.

We’d gone through the work to show that Maxwell’s equation has the STA form
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:40}
\grad F = J.
\end{equation}
This is a deceptively compact representation, as it requires all of the following definitions
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:60}
\grad = \gamma^\mu \partial_\mu = \gamma_\mu \partial^\mu,
\end{equation}
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:80}
\partial_\mu = \PD{x^\mu}{},
\end{equation}
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:100}
\gamma^\mu \cdot \gamma_\nu = {\delta^\mu}_\nu,
\end{equation}
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:160}
\gamma_\mu \cdot \gamma_\nu = g_{\mu\nu},
\end{equation}
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:120}
\begin{aligned}
F
&= \BE + I c \BB \\
&= -E^k \gamma^k \gamma^0 – \inv{2} c B^r \gamma^s \gamma^t \epsilon^{r s t} \\
&= \inv{2} \gamma^{\mu} \wedge \gamma^{\nu} F_{\mu\nu},
\end{aligned}
\end{equation}
and
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:140}
\begin{aligned}
J &= \gamma_\mu J^\mu \\
J^\mu &= \frac{\rho}{\epsilon} \gamma_0 + \eta (\BJ \cdot \Be_k).
\end{aligned}
\end{equation}

Four-potentials in the STA representation.

In order to find the tensor form of Maxwell’s equation (starting from the STA representation), we first split the equation into two, since
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:180}
\grad F = \grad \cdot F + \grad \wedge F = J.
\end{equation}
The dot product is a four-vector, the wedge term is a trivector, and the current is a four-vector, so we have one grade-1 equation and one grade-3 equation
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:200}
\begin{aligned}
\grad \cdot F &= J \\
\grad \wedge F &= 0.
\end{aligned}
\end{equation}
The potential comes into the mix, since the curl equation above means that \( F \) necessarily can be written as the curl of some four-vector
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:220}
F = \grad \wedge A.
\end{equation}
One justification of this is that \( a \wedge (a \wedge b) = 0 \), for any vectors \( a, b \). Expanding such a double-curl out in coordinates is also worthwhile
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:240}
\begin{aligned}
\grad \wedge \lr{ \grad \wedge A }
&=
\lr{ \gamma_\mu \partial^\mu }
\wedge
\lr{ \gamma_\nu \partial^\nu }
\wedge
A \\
&=
\gamma^\mu \wedge \gamma^\nu \wedge \lr{ \partial_\mu \partial_\nu A }.
\end{aligned}
\end{equation}
Provided we have equality of mixed partials, this is a product of an antisymmetric factor and a symmetric factor, so the full sum is zero.

Things get interesting if one imposes a \( \grad \cdot A = \partial_\mu A^\mu = 0 \) constraint on the potential. If we do so, then
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:260}
\grad F = \grad^2 A = J.
\end{equation}
Observe that \( \grad^2 \) is the wave equation operator (often written as a square-box symbol.) That is
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:280}
\begin{aligned}
\grad^2
&= \partial^\mu \partial_\mu \\
&= \partial_0 \partial_0
– \partial_1 \partial_1
– \partial_2 \partial_2
– \partial_3 \partial_3 \\
&= \inv{c^2} \PDSq{t}{} – \spacegrad^2.
\end{aligned}
\end{equation}
This is also an operator for which the Green’s function is well known ([1]), which means that we can immediately write the solutions
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:300}
A(x) = \int G(x,x’) J(x’) d^4 x’.
\end{equation}
However, we have no a-priori guarantee that such a solution has zero divergence. We can fix that by making a gauge transformation of the form
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:320}
A \rightarrow A – \grad \chi.
\end{equation}
Observe that such a transformation does not change the electromagnetic field
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:340}
F = \grad \wedge A \rightarrow \grad \wedge \lr{ A – \grad \chi },
\end{equation}
since
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:360}
\grad \wedge \grad \chi = 0,
\end{equation}
(also by equality of mixed partials.) Suppose that \( \tilde{A} \) is a solution of \( \grad^2 \tilde{A} = J \), and \( \tilde{A} = A + \grad \chi \), where \( A \) is a zero divergence field to be determined, then
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:380}
\grad \cdot \tilde{A}
=
\grad \cdot A + \grad^2 \chi,
\end{equation}
or
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:400}
\grad^2 \chi = \grad \cdot \tilde{A}.
\end{equation}
So if \( \tilde{A} \) does not have zero divergence, we can find a \( \chi \)
\begin{equation}\label{eqn:gaugeFreedomAndPotentialsMaxwell:420}
\chi(x) = \int G(x,x’) \grad’ \cdot \tilde{A}(x’) d^4 x’,
\end{equation}
so that \( A = \tilde{A} – \grad \chi \) does have zero divergence.

References

[1] JD Jackson. Classical Electrodynamics. John Wiley and Sons, 2nd edition, 1975.

Green’s function video series is now done

March 15, 2022 math and physics play , , , , , , , ,

I’ve been working on a Green’s function video series, available on both Odysee and the old legacy CensorshipTube.  In this series, I am working from the great Dover book [1].  You can think of this book as a one stop shop containing most of the advanced mathematical tricks that any graduate student in physics or engineering would ever need.

I chose to leisurely visit most of the single variable Green’s function content from chapter 7 of this book in this video series, with focus on the damped forced harmonic oscillator problem
\begin{equation}\label{eqn:greens:20}
\LL x(t) = F(t),
\end{equation}
where
\begin{equation}\label{eqn:greens:40}
\LL = \frac{d^2}{dt^2} + 2 \gamma \frac{d}{dt} + \omega_0^2.
\end{equation}
In more pedestrian notation, this problem is the differential equation
\begin{equation}\label{eqn:greens:60}
x”(t) + 2 \gamma x'(t) + \omega_0^2 x(t) = F(t).
\end{equation}

Green’s function solution to the forced damped harmonic oscillator

In the first video, of what I thought would probably be three videos, we formally solve this problem, by attacking it with Fourier transform pairs
\begin{equation}\label{eqn:greens:80}
\begin{aligned}
\hat{f}(k) &= \inv{\sqrt{2\pi}} \int_{-\infty}^\infty e^{i k t} f(t) dt \\
f(t) &= \inv{\sqrt{2\pi}} \int_{-\infty}^\infty e^{-i k t} \hat{f}(k) dk,
\end{aligned}
\end{equation}
and find a specific solution to the forcing problem
\begin{equation}\label{eqn:greens:100}
x(t) = \int_{-\infty}^\infty G(t,t’) F(t’) dt’,
\end{equation}
where our convolution kernel (later shown to satisfy the Green’s function criteria) is
\begin{equation}\label{eqn:greens:120}
G(t,t’) = -\inv{2 \pi} \int_{-\infty}^\infty \frac{e^{-ik(t-t’)}}{k^2 + 2 i \gamma k – \omega_0^2} dk.
\end{equation}
We also find that the homogeneous solutions have the form
\begin{equation}\label{eqn:greens:140}
x(t) = e^{-\gamma t \pm i \alpha t},
\end{equation}
where \( \alpha = \sqrt{ \omega_0^2 – \gamma_2 } \).

Evaluating the Fourier convolution kernel for the forced damped harmonic oscillator

In the second video we proceed to dig out our coutour integration techniques and use them to evaluate the convolution kernel. I do a very quick non-rigorous refresher and justification of contour integration and residue analysis, and then proceed to tackle our convolution kernel, rewritten as
\begin{equation}\label{eqn:greens:160}
G(t,t’) = -\inv{2 \pi} \int_{-\infty}^\infty \frac{e^{-ik(t-t’)}}{\lr{k – k_1}\lr{ k – k_2}} dk.
\end{equation}
We evaluate this in top and bottom half plane infinite closed semi-circular contours (both of which include the real axis component that we are interested in).  We find that the upper half semi-circular path is zero for \( t – t’ < 0 \), as is the entire integral, as it encloses no poles. We find that the lower half semi-circular path is zero for \( t – t’ > 0 \), so the real axis integral can be evaluated by computing the two residues.  In the end we find
\begin{equation}\label{eqn:greens:180}
G(t,t’) = \Theta(t – t’) e^{-\gamma(t-t’)} \frac{\sin(\alpha (t – t’))}{\alpha}.
\end{equation}
Incidentally, we see that the Green’s function, in this case, is a Heavyside-theta weighted superposition of homogeneous solutions. Specifically, if
\begin{equation}\label{eqn:greens:200}
\begin{aligned}
x_1(t) &= e^{-\gamma t + i \alpha t} \\
x_2(t) &= e^{-\gamma t – i \alpha t},
\end{aligned}
\end{equation}
then
\begin{equation}\label{eqn:greens:220}
G(t,t’) = \Theta(t-t’) \lr{
\frac{x_1(-t’)}{2 i \alpha} x_1(t)

\frac{x_2(-t’)}{2 i \alpha} x_2(t)
}.
\end{equation}
This becomes relevant later in the series when we derive and utilize Wrokskian determinant form of the Green’s function.

Showing that the convolution kernel for the forced damped harmonic oscillator is a Greens function

In the third video, we demonstrate that the convolution kernel that we derived using Fourier transforms, and contour integration, is in fact a Green’s function for the problem. That is
\begin{equation}\label{eqn:greens:240}
\LL G(t,t’) = \delta(t- t’).
\end{equation}
This is a formal way of expressing the fact that the Green’s function is an inverse of the linear operator. Specifically, given
\begin{equation}\label{eqn:greens:260}
x(t) = \int_{-\infty}^{\infty} G(t,t’) F(t’) dt’,
\end{equation}
then application of our linear operator to both sides gives
\begin{equation}\label{eqn:greens:280}
\LL x(t) = \int_{-\infty}^{\infty} \LL G(t,t’) F(t’) dt’,
\end{equation}
so if \ref{eqn:greens:240} is true, we have
\begin{equation}\label{eqn:greens:300}
\LL x(t) = F(t),
\end{equation}
as desired.

Green’s function for a first order linear system: two different ways

My trilogy in four parts steps backwards slightly in preparation for examination of the Wronskian method of Green’s function construction. Here I tackle one of the simplest first order single variable systems, that of
\begin{equation}\label{eqn:greens:320}
\LL = \frac{d}{dt} + \alpha.
\end{equation}
We derive the Green’s function, first using the now familiar Fourier transform and contour integration methods, and then attempt to find the Green’s function by demanding that it has the structure of a piecewise superposition of homogeneous solutions, which is the method used in the book for second order systems. Since we have a first order system, our superposition is trivially simple, as it requires only scaling our homogeneous solution \( x_1(t) = e^{-\alpha t} \) in each of the domains
\begin{equation}\label{eqn:greens:340}
\begin{aligned}
G(t,t’) &= A x_1(t), \quad t – t’ > 0 \\
G(t,t’) &= B x_1(t), \quad t – t’ < 0.
\end{aligned}
\end{equation}
We find that
\begin{equation}\label{eqn:greens:360}
G(t,t’) = B e^{-\alpha t} + \Theta(t- t’) e^{-\alpha (t – t’) }.
\end{equation}
The second term is precisely what we found by direct Fourier transformation, and the first is related to the boundary conditions for the Green’s function itself, something that we address in the final video.

Wronskian form for the Green’s Function of a general 2nd order one variable differential equation

In this part of my trilogy in five parts, we derive the Wronskian form of the Green’s function for a second order differential equation. Given
\begin{equation}\label{eqn:greens:380}
\LL = f_0(t) \frac{d^2}{dt^2} + f_1(t) \frac{d}{dt} + f_2(t),
\end{equation}
and two homogenous solutions \( x_1(t), x_2(t) \), we find
\begin{equation}\label{eqn:greens:400}
G(t,t’) = \alpha x_1(t) + \beta x_2(t) +
\frac{\Theta(t- t’)}{f_0(t’)} \frac{
\begin{vmatrix}
x_1(t’) & x_2(t’) \\
x_1(t) & x_2(t) \\
\end{vmatrix}
}
{
\begin{vmatrix}
x_1(t’) & x_2(t’) \\
x_1′(t’) & x_2′(t’) \\
\end{vmatrix}
}.
\end{equation}
We use this to re-derive the Green’s function for the forced, damped, harmonic oscillator, finding the previous result from Fourier-transform and contour integration (provided we set \( \alpha = \beta = 0 \).)

Green’s function boundary value conditions

In this final sixth video, my channelling of Douglas Adams (trilogy in four and then five parts) fails completely. However, I do finally address boundary conditions for the Green’s function itself. I don’t use the damped forced harmonic oscillator, but the very simplest second order system
\begin{equation}\label{eqn:greens:420}
x”(t) = F(t).
\end{equation}
I chose this equation, and not the damped forced HO, because the Green’s function for this system was derived twice in the text by direct integration. Once for the single point boundary condition
\begin{equation}\label{eqn:greens:440}
\begin{aligned}
x(a) &= x_0 \\
x'(a) &= \bar{x}_0,
\end{aligned}
\end{equation}
and once for a two point boundary condition
\begin{equation}\label{eqn:greens:460}
\begin{aligned}
x(0) &= x_0 \\
x(1) &= x_1.
\end{aligned}
\end{equation}

I apply the Wronskian method to derive the Green’s function for this differential operator, which is just
\begin{equation}\label{eqn:greens:480}
G(t,t’) = \alpha + \beta t + \lr{t-t’} \Theta(t-t’),
\end{equation}
and then proceed to apply the pair of boundary conditions to the Green’s function, fixing the \( \alpha \) and \( \beta \) constants for each. There’s a bit of subtlety and hand waving required to get the right results, so it is probably worth repeating the problem for some more complex cases in the future and making sure that I do fully understand how this works. I am able to rederive the Green’s functions from the text for each of the two boundary condition cases.

This business of application of the boundary conditions to the Green’s function itself is very important, and as I found back when I took QM-I (phy356). If you don’t do it, then you get the wrong answers. Perhaps, now finally armed with a better understanding of the tools, I should go back, find that problem again and try it anew.

References

[1] F.W. Byron and R.W. Fuller. Mathematics of Classical and Quantum Physics. Dover Publications, 1992.

Switching from YouTube to Odysee as a video sharing platform

March 10, 2022 math and physics play , , ,

YouTube’s rampant censorship over the last two years (and even before that), has been increasingly hard to stomach.

In light of that, I am going to transition to odysee as my primary video sharing platform.  I’ll probably post backup copies on YouTube too, but will treat that platform as a secondary mirror (despite the fact that subscribers and viewers will probably find stuff there first.)

In the grand scheme of things, my viewership is infinitesimal and will surely stay that way, and I don’t monetize anything anyways, so this switch has zero impact to me, and is more of a conceptual switch than anything else.  Since, I’m talking about math and physics, which I can’t imagine that YouTube should would ever find a reason to censor, but we should all start treating it as a compromised platform, and breaking any dependencies that we have on it.

As a first step towards this transition, I’ve uploaded all my geometric algebra videos to odysee.  I’ve also uploaded my Green’s function videos (so far all related to the damped forced harmonic oscillator), but haven’t put those in a playlist yet, but it will be here when I do.

I have a couple cool Manim based geometric algebra videos that I have been working on for a while.  I’ll post those soon too.