Month: August 2025

Some fun (complex) exponents

August 21, 2025 math and physics play , ,

[Click here for a PDF version of this post]

I saw a twitter post (but forgot to save the link) with a guy looking confused, captioned something like:
\begin{equation}\label{eqn:FunkyExponents:20}
\Abs{e^{i \pi}} = \Abs{\pi^{e i}} = \Abs{ i^{\pi e}} = 1.
\end{equation}

EDIT: this is the picture I saw posted on twitter.

If this is true, then the arguments of each of the absolutes are complex numbers on the unit circle. I suspect I’d seen that before, but forgot, so naturally, I had to verify for myself.

First, for \( \pi^{e i} \), we have
\begin{equation}\label{eqn:FunkyExponents:40}
\begin{aligned}
\pi^{e i}
&= \lr{ e^{\ln \pi} }^{e i} \\
&= \cos\lr{ e \ln \pi} + i \sin\lr{ e \ln \pi},
\end{aligned}
\end{equation}
and for \( i^{\pi e} \), we have
\begin{equation}\label{eqn:FunkyExponents:60}
\begin{aligned}
i^{\pi e}
&= \lr{ e^{i \pi/2}}^{\pi e} \\
&= e^{i e \pi^2/2}\\
&= \cos \lr{ e \pi^2/2} + i \sin \lr{ e \pi^2/2}.
\end{aligned}
\end{equation}

Sure enough, this is true. As it happens, two of these special values are nearly equal, because
\begin{equation}\label{eqn:FunkyExponents:80}
\begin{aligned}
e^{\pi} &= 23.1407 \\
\pi^e &= 22.4592,
\end{aligned}
\end{equation}
so \( e^{\pi i} \approx \pi^{e i} \). We can see this visually if we plot the three points, as done in fig. 1.

fig. 1. The three points.

New version of my book now tagged and uploaded: GAelectrodynamics.V0.3.6.4.pdf

August 11, 2025 Uncategorized ,

 

Changelog:

  • V0.3.6.4 (Aug 11, 2025)
    • Add solutions for problems 3.8 and 3.9, fixing sign errors in the parent topic (transverse fields.)
    • Add solution for statics_infiniteLineChargeMagneticLineCharge.tex, fixing problem statement (off by factor of two.)  Credit to itsapixel (discord) for finding the error.
    • Issue #5: WiredMic: SI abbreviation for Weber is Wb.
    • Fix units for definition 3.2. Credit to Frank Dininno (discord)
    • New figures didn’t have Mathematica notebook links (in non-print version).
    • Some other Mathematica notebooks for the book weren’t in the index.
    • new problem: twoForceStaticsProblem.tex

Thanks to Rasmus Enevoldsen, Frank Dininno, Timo van Veen, who found errors in the previous version!

There are now only a handful of problems left in the book that don’t have solutions.

The leanpub and free PDF version of the book have been updated, and links for those can be found in the usual place.  The amazon updates have been submitted, but will probably take a few days to process.

Transverse electric and magnetic field relations.

August 10, 2025 math and physics play , , , , , , , , , , , , , , ,

[Click here for a PDF version of this post]

I found a sign error in my book. Here’s I’ll re-derive all the results for myself here in a standalone fashion, also verifying signs as I go.

Setup

Suppose that a field is propagating in a medium along the z-axis. We may represent that field as the real part of
\begin{equation}\label{eqn:transverseField:20}
F = F(x,y) e^{j(\omega t – k z)}.
\end{equation}
This is a doubly complex relationship, as we have a scalar complex imaginary \( j \), as well as the spatial imaginary \(I = \Be_1 \Be_2 \Be_3 \) that is part of the multivector field itself
\begin{equation}\label{eqn:transverseField:40}
F = \BE + I \eta \BH.
\end{equation}

Let’s call
\begin{equation}\label{eqn:transverseField:60}
F_z = \lr{ \BE \cdot \Be_3} \Be_3 + I \eta \lr{ \BH \cdot \Be_3 } \Be_3,
\end{equation}
the propagation component of the field and \( F_t = F – F_z \) the transverse component of the field. We can write these in a more symmetric fashion by expanding the dot products and regrouping
\begin{equation}\label{eqn:transverseField:80}
\begin{aligned}
F_z
&= \lr{ \BE \cdot \Be_3} \Be_3 + I \eta \lr{ \BH \cdot \Be_3 } \Be_3 \\
&= \inv{2} \lr{ \BE \Be_3 + \Be_3 \BE } \Be_3 + \frac{I \eta}{2} \lr{ \BH \Be_3 + \Be_3 \BH} \Be_3 \\
&= \inv{2} \lr{ \BE + \Be_3 \BE \Be_3 } + \frac{I \eta}{2} \lr{ \BH + \Be_3 \BH \Be_3} \Be_3 \\
&= \inv{2} \lr{ F + \Be_3 F \Be_3 }.
\end{aligned}
\end{equation}
By subtraction, we also have
\begin{equation}\label{eqn:transverseField:100}
F_t = \inv{2} \lr{ F – \Be_3 F \Be_3 }.
\end{equation}

Relating the transverse and propagation direction fields

The multivector form of Maxwell’s equation, for source free conditions, is
\begin{equation}\label{eqn:transverseField:120}
0 = \lr{ \spacegrad + \inv{c} \partial_t } F.
\end{equation}
We split the gradient into a propagation direction component and a transverse component \( \spacegrad_t \)
\begin{equation}\label{eqn:transverseField:140}
\spacegrad = \spacegrad_t + \Be_3 \partial_z,
\end{equation}
so
\begin{equation}\label{eqn:transverseField:160}
\begin{aligned}
0
&= \lr{ \spacegrad_t + \Be_3 \partial_z + \inv{c} \partial_t } F \\
&= \lr{ \spacegrad_t + \Be_3 \partial_z + \inv{c} \partial_t } F(x,y) e^{j(\omega t – k z) } \\
&= \lr{ \spacegrad_t – j\Be_3 k + j\frac{\omega}{c} } F(x,y) e^{j(\omega t – k z) },
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:transverseField:180}
-j \lr{ \frac{\omega}{c} – k \Be_3 } F = \spacegrad_t F.
\end{equation}

Observe that
\begin{equation}\label{eqn:transverseField:200}
-j \lr{ \frac{\omega}{c} – k \Be_3 } \Be_3 F \Be_3 = -\spacegrad_t \Be_3 F \Be_3,
\end{equation}
which means that
\begin{equation}\label{eqn:transverseField:220}
-j \lr{ \frac{\omega}{c} – k \Be_3 } \inv{2} \lr{ F \pm \Be_3 F \Be_3 } = \spacegrad_t \inv{2} \lr{ F \mp \Be_3 F \Be_3 },
\end{equation}
or
\begin{equation}\label{eqn:transverseField:240}
\begin{aligned}
-j \lr{ \frac{\omega}{c} – k \Be_3 } F_z &= \spacegrad_t F_t \\
-j \lr{ \frac{\omega}{c} – k \Be_3 } F_t &= \spacegrad_t F_z.
\end{aligned}
\end{equation}

Provided \( \omega^2 \ne k^2 c^2 \), this can be inverted, meaning that \( F_t \) fully specifies \( F_z \) if known, as well as the opposite.

That inversion provides the propagation direction field in terms of the transverse
\begin{equation}\label{eqn:transverseField:260a}
F_z = j \frac{ \frac{\omega}{c} + k \Be_3 }{ \omega^2 \mu \epsilon – k^2 } \spacegrad_t F_t,
\end{equation}
and the transverse field in terms of the propagation direction field
\begin{equation}\label{eqn:transverseField:260b}
F_t = j \frac{ \frac{\omega}{c} + k \Be_3 }{ \omega^2 \mu \epsilon – k^2 } \spacegrad_t F_z.
\end{equation}

Transverse field in terms of propagation

Let’s expand \ref{eqn:transverseField:260b} in terms of component electric and magnetic fields. First note that
\begin{equation}\label{eqn:transverseField:280}
\begin{aligned}
\spacegrad_t F_z
&= \spacegrad_t \Be_3 \lr{ E_z + I \eta H_z } \\
&= -\Be_3 \spacegrad_t \lr{ E_z + I \eta H_z }.
\end{aligned}
\end{equation}
so
\begin{equation}\label{eqn:transverseField:300}
F_t = -j \frac{ \frac{\omega}{c} \Be_3 + k }{ \omega^2 \mu \epsilon – k^2 } \spacegrad_t \lr{ E_z + I \eta H_z }.
\end{equation}
This may now be split into electric and magnetic fields, but first note that the multivector operator
\begin{equation}\label{eqn:transverseField:320}
\begin{aligned}
\Be_3 \spacegrad_t
&=
\Be_3 \cdot \spacegrad_t + \Be_3 \wedge \spacegrad_t \\
&=
\Be_3 \wedge \spacegrad_t,
\end{aligned}
\end{equation}
has only a bivector component.

For the transverse electric field component, we have
\begin{equation}\label{eqn:transverseField:340}
\begin{aligned}
\gpgradeone{ \lr{ \frac{\omega}{c} \Be_3 + k } \spacegrad_t \lr{ E_z + I \eta H_z } }
&=
k \spacegrad_t E_z + \frac{\omega}{c} \Be_3 \wedge \spacegrad_t \lr{ I \eta H_z } \\
&=
k \spacegrad_t E_z – \frac{\eta \omega}{c} \Be_3 \cross \spacegrad_t H_z.
\end{aligned}
\end{equation}
and for the magnetic field component
\begin{equation}\label{eqn:transverseField:360}
\begin{aligned}
\gpgradetwo{ \lr{ \frac{\omega}{c} \Be_3 + k } \spacegrad_t \lr{ E_z + I \eta H_z } }
=
\frac{\omega}{c} \Be_3 \wedge \spacegrad_t E_z + I \eta k \spacegrad_t H_z
\end{aligned}
\end{equation}

This means that
\begin{equation}\label{eqn:transverseField:380}
\begin{aligned}
\BE_t &= \frac{j}{\omega^2 \mu \epsilon – k^2 } \lr{ -k \spacegrad_t E_z + \frac{\eta \omega}{c} \Be_3 \cross \spacegrad_t H_z } \\
\eta I \BH_t &= -\frac{j}{\omega^2 \mu \epsilon – k^2 } \lr{ \frac{\omega}{c} \Be_3 \wedge \spacegrad_t E_z + I \eta k \spacegrad_t H_z }
\end{aligned}
\end{equation}

Cancelling out the \( \eta I \) factors in the magnetic field component, and substituting \( \eta/c = \mu, 1/(c\eta) = \epsilon \), leaves us with
\begin{equation}\label{eqn:transverseField:400}
\begin{aligned}
\BE_t &= \frac{j}{\omega^2 \mu \epsilon – k^2 } \lr{ -k \spacegrad_t E_z + \mu \omega \Be_3 \cross \spacegrad_t H_z } \\
\BH_t &= -\frac{j}{\omega^2 \mu \epsilon – k^2 } \lr{ \epsilon \omega \Be_3 \cross \spacegrad_t E_z + k \spacegrad_t H_z }.
\end{aligned}
\end{equation}

Propagation field in terms of transverse.

Now let’s invert \ref{eqn:transverseField:260a}. We seek the grade selections
\begin{equation}\label{eqn:transverseField:420}
\gpgrade{ \lr{ \frac{\omega}{c} + k \Be_3 } \spacegrad_t F_t }{1,2}
\end{equation}

Performing each of these four grade selections in turn, for the \( \spacegrad_t F_t \) products we have
\begin{equation}\label{eqn:transverseField:440}
\begin{aligned}
\gpgradeone{ \spacegrad_t F_t }
&=
\gpgradeone{ \spacegrad_t \lr{ \BE_t + I \eta \BH_t } } \\
&=
\eta \gpgradeone{ I \spacegrad_t \BH_t } \\
&=
\eta I \lr{ \spacegrad_t \wedge \BH_t } \\
&=
-\eta \lr{ \spacegrad_t \cross \BH_t }.
\end{aligned}
\end{equation}
Because \( \spacegrad_t \BE_t \) has only 0,2 grades, so the grade-one selection was zero, leaving us with only \( \BH_t \) dependence.

For the grade two selection of the same, we have
\begin{equation}\label{eqn:transverseField:460}
\begin{aligned}
\gpgradetwo{ \spacegrad_t F_t }
&=
\gpgradetwo{ \spacegrad_t \lr{ \BE_t + I \eta \BH_t } } \\
&=
\spacegrad_t \wedge \BE_t \\
&=
I \lr{ \spacegrad_t \cross \BE_t }.
\end{aligned}
\end{equation}
This time we note that the vector-bivector product \( \spacegrad_t (I \BH_t) \) has only 1,3 grades, and is killed by the grade-2 selection.

For the \( \Be_3 \spacegrad_t F_t \) products, we have
\begin{equation}\label{eqn:transverseField:480}
\begin{aligned}
\gpgradeone{ \Be_3 \spacegrad_t F_t }
&=
\gpgradeone{ \Be_3 \spacegrad_t \lr{ \BE_t + I \eta \BH_t } } \\
&=
\gpgradeone{ \lr{ \Be_3 \cdot \spacegrad_t + \Be_3 \wedge \spacegrad_t } \BE_t }
+
\eta \gpgradeone{ I \Be_3 \lr{ \spacegrad_t \cdot \BH_t + \spacegrad_t \wedge \BH_t } } \\
&=
\gpgradeone{ I \lr{ \Be_3 \cross \spacegrad_t } \BE_t } \\
&=
-\lr{ \Be_3 \cross \spacegrad_t } \cross \BE_t.
\end{aligned}
\end{equation}
Observe that we’ve made use of \( \Be_3 \cdot \spacegrad_t = 0 \), regardless of what it operates on. For the \( \BH_t \) dependence, we had a bivector-scalar product \( (I \Be_3) (\spacegrad_t \cdot \BH_t) \), and a bivector-bivector product \( (I \Be_3) (\spacegrad_t \wedge \BH_t) \), neither of which have any vector grades.

Finally
\begin{equation}\label{eqn:transverseField:500}
\begin{aligned}
\gpgradetwo{ \Be_3 \spacegrad_t F_t }
&=
\eta \gpgradetwo{ I \Be_3 \spacegrad_t \BH_t } \\
&=
-\eta \gpgradetwo{ \lr{\Be_3 \cross \spacegrad_t} \BH_t } \\
&=
-\eta I \lr{\Be_3 \cross \spacegrad_t} \cross \BH_t.
\end{aligned}
\end{equation}
Here we’ve discarded the \( \BE_t \) dependent terms, since the bivector-vector product \( \lr{ \Be_3 \wedge \spacegrad_t } \BE_t \) has only grades 1,3, and we seek grade 2 only.

Putting all the pieces together, noting that \( \eta/c = \mu \) and \( 1/(c \eta) = \epsilon \), we have
we have
\begin{equation}\label{eqn:transverseField:520}
\BE_z = -\frac{j}{\omega^2 \mu \epsilon – k^2 } \lr{ \omega \mu \lr{ \spacegrad_t \cross \BH_t } + k \lr{ \Be_3 \cross \spacegrad_t } \cross \BE_t },
\end{equation}
and
\begin{equation}\label{eqn:transverseField:540}
\BH_z = \frac{j}{\omega^2 \mu \epsilon – k^2 } \lr{ \omega \epsilon \lr{ \spacegrad_t \cross \BE_t } – k \lr{\Be_3 \cross \spacegrad_t} \cross \BH_t }.
\end{equation}

An update to floatexplorer.

August 4, 2025 C/C++ development and debugging.

The IEEE 32-bit float explorer that I wrote about previously, has now been extended from just float (e8m23) to include floating point support for a number of other representations, including additional CPU floating point types:

  • 64-bit IEEE (double: e11m52),
  • Intel “80-bit” (long double: e15m64),
  • 128-bit IEEE (long double on ARM Linux: e15m122).   This is also the GCC quadmath representation,

and GPU floating point types:

  • e5m2
  • e4m3
  • fp16 (e5m10)
  • bf16 (e8m7)

The CUDA API is used for floating point conversions of the GPU floating point types (if available), and a manual convertor has been implemented if CUDA is not available.

The Intel long double format is currently only supported when building on x64.  This type is different from all the others, where normal values do not use an implicit leading mantissa bit.

I have not implemented mainframe HEXFLOAT support.

Here is some sample output:

type: bf16
value:    3
hex:      4040
bits:     0100000001000000
sign:     0
exponent:  10000000                        (127 +1)
mantissa:          1000000
number:          1.1000000 x 2^(1)

type: fp16
value:    3
hex:      4200
bits:     0100001000000000
sign:     0
exponent:  10000                        (15 +1)
mantissa:       1000000000
number:       1.1000000000 x 2^(1)

type: e4m3
value:    3
hex:      44
bits:     01000100
sign:     0
exponent:  1000                        (7 +1)
mantissa:      100
number:      1.100 x 2^(1)

type: e5m2
value:    3
hex:      42
bits:     01000010
sign:     0
exponent:  10000                        (15 +1)
mantissa:       10
number:       1.10 x 2^(1)

type: float
value:    3
hex:      40400000
bits:     01000000010000000000000000000000
sign:     0
exponent:  10000000                        (127 +1)
mantissa:          10000000000000000000000
number:          1.10000000000000000000000 x 2^(1)

type: double
value:    3
hex:      4008000000000000
bits:     0100000000001000000000000000000000000000000000000000000000000000
sign:     0
exponent:  10000000000                                                     (1023 +1)
mantissa:             1000000000000000000000000000000000000000000000000000
number:             1.1000000000000000000000000000000000000000000000000000 x 2^(1)

type: long double
value:    3
hex:      4000C000000000000000
bits:     01000000000000001100000000000000000000000000000000000000000000000000000000000000
sign:     0
exponent:  100000000000000                                                     (16383 +1)
mantissa:                 1100000000000000000000000000000000000000000000000000000000000000
number:                 0.1100000000000000000000000000000000000000000000000000000000000000 x 2^(2)

type: float128
value:    3.000000
hex:      40008000000000000000000000000000
bits:     01000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
sign:     0
exponent:  100000000000000                                                     (16383 +1)
mantissa:                 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
number:                 1.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 x 2^(1)