## Duality transformation of the far field fields.

We’ve seen that the far field electric and magnetic fields associated with a magnetic vector potential were

\label{eqn:dualFarField:40}
\BE = -j \omega \textrm{Proj}_\T \BA,

\label{eqn:dualFarField:60}
\BH = \inv{\eta} \kcap \cross \BE.

It’s worth a quick note that the duality transformation for this, referring to [1] tab. 3.2, is

\label{eqn:dualFarField:100}
\BH = -j \omega \textrm{Proj}_\T \BF

\label{eqn:dualFarField:120}
\BE = -\eta \kcap \cross \BH.

What does $$\BH$$ look like in terms of $$\BA$$, and $$\BE$$ look like in terms of $$\BH$$?

The first is

\label{eqn:dualFarField:140}
\BH
= -\frac{j \omega}{\eta} \kcap \cross \lr{ \BA – \lr{\BA \cdot \kcap} \kcap },

in which the $$\kcap$$ crossed terms are killed, leaving

\label{eqn:dualFarField:160}
\BH
= -\frac{j \omega}{\eta} \kcap \cross \BA.

The electric field follows again using a duality transformation, so in terms of the electric vector potential, is

\label{eqn:dualFarField:180}
\BE = j \omega \eta \kcap \cross \BF.

These show explicitly that neither the electric or magnetic far field have any radial component, matching with intuition for transverse propagation of the fields.

# References

[1] Constantine A Balanis. Antenna theory: analysis and design. John Wiley & Sons, 3rd edition, 2005.

## On touch’s use of futimes() and a filesystem bug.

February 25, 2015 C/C++ development and debugging. No comments , , , , ,

In my last post, Why does touch include a utimensat() syscall?, I’d pointed out that strace reports an utimensat syscall from touch, and noted that this appeared to have the effect of clearing the subsecond portion of the files mtime.

It turns out that strace was slightly lying, and we actually have a call to futimens( fd, NULL ).  I was able to see that by debugging into coreutils’s touch.c and see what it is doing.  The purpose of this futimens() syscall is supposed to be to set the time to the current time.  It appears that clearcase V8 + MVFS + futimes() doesn’t respect the microsecond granular times that were implemented in V8.   This API, as currently implemented will set the file’s mtime to the current time, but only respects the seconds portion of that time.

With clearcase V8 MVFS view private files having the capability for subsecond granularity, the end result is that this pushes the modification time backwards if you get unlucky enough to execute the futimes() in the same second as the file creation.  That is almost always.  It can be seen to work correctly if you put a long enough sleep in the code between the initial creation point for one file, and the “touch” of the second.  Here’s a bit of standalone code that illustrates:

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <getopt.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>

int main( int argc, char ** argv )
{
int c                = 0 ;
long sleepTimeUsec    = 10000 ;
int fd1                = -1 ;
int fd2                = -1 ;
char * err             = NULL ;
int rc                = 0 ;
struct timespec ts = { 0, 0 } ;

while ( (c = getopt( argc, argv, "s:" )) != EOF )
{
if ( c == 's' )
{
sleepTimeUsec = strtol( optarg, &err, 10 ) ;
if ( err[0] )
{
fprintf( stderr, "unexpected input in -s parameter '%s'\n",
optarg ) ;
return 1 ;
}
}
}

fd1 = open( "touchFirst", O_CREAT ) ;
if ( -1 == fd1 )
{
fprintf( stderr, "create: 'touchFirst' failed: %d (%s)\n",
errno, strerror( errno ) ) ;
return 2 ;
}
close( fd1 ) ;

fd2 = open( "touchSecond", O_CREAT ) ;
if ( -1 == fd2 )
{
fprintf( stderr, "create: 'touchSecond' failed: %d (%s)\n",
errno, strerror( errno ) ) ;
return 3 ;
}

ts.tv_sec = sleepTimeUsec / 1000000 ;
ts.tv_nsec = (sleepTimeUsec % 1000000)*1000 ;
rc = nanosleep( &ts, NULL ) ;
if ( -1 == rc )
{
fprintf( stderr, "nanosleep(%lu,%lu) failed: %d (%s)\n",
(unsigned long)ts.tv_sec, (unsigned long)ts.tv_nsec,
errno, strerror( errno ) ) ;
return 4 ;
}

rc = futimens( fd2, NULL ) ;
if ( -1 == rc )
{
fprintf( stderr, "futimens failed: %d (%s)\n",
errno, strerror( errno ) ) ;
return 5 ;
}

close( fd2 ) ;

return 0 ;
}


Here’s a pair of calls that illustrate the bug.

/vbs/engn/t2> a.out -s 500000 ;  ls --full-time touch*
-r-x--xr-- 1 peeterj pdxdb2 0 2015-02-25 23:16:36.498049000 -0500 touchFirst
-r-x--xr-- 1 peeterj pdxdb2 0 2015-02-25 23:16:36.000000000 -0500 touchSecond
/vbs/engn/t2> a.out -s 500000 ;  ls --full-time touch*
-r-x--xr-- 1 peeterj pdxdb2 0 2015-02-25 23:16:38.900498000 -0500 touchFirst
-r-x--xr-- 1 peeterj pdxdb2 0 2015-02-25 23:16:39.000000000 -0500 touchSecond


The first is the buggy call, and the time goes backwards despite a half second sleep. The second call is okay, because 0.9+0.5 of a second ends up in the next second, so the second “touched” file has a timestamp after the creation of the second file (as expected.)

## Why does touch include a utimensat() syscall?

I’m seeing odd time sequencing of files when using clearcase version 8 dynamic views, which makes me wonder about an aspect of the (gnu) touch command. Running:

> cat u
rm -f touchedEarlier touchedLater

perl -e "open (F, '> touchedEarlier') || die"
touch touchedLater

ls --full-time touchedEarlier touchedLater


produces:

> ./u
-rw-r--r-- 1 peeterj pdxdb2 0 2015-02-25 11:42:05.833044000 -0500 touchedEarlier
-rw-r--r-- 1 peeterj pdxdb2 0 2015-02-25 11:42:05.000000000 -0500 touchedLater


Notice that the file that is touched by doing a perl “open” ends up with a later time, despite the fact that it was done logically earlier than the touch.

Running this command outside of a clearcase dynamic view shows zeros only in the subsecond times (also the behaviour of clearcase V7). Needless to say, this difference in file times from their creation sequence wreaks havoc on make.

I was curious how the two touch methods differed, and stracing them shows that the touch differs by including a utimesat() syscall. The perl touch is:

open(“touchedEarlier”, O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff29cd29f0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, …}) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
close(3) = 0
exit_group(0) = ?

whereas the touch command has:

open(“touchedLater”, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3
dup2(3, 0) = 0
close(3) = 0
dup2(0, 0) = 0
utimensat(0, NULL, NULL, 0) = 0
close(0) = 0
close(1) = 0
close(2) = 0
exit_group(0) = ?

It appears that the touch command explicitly zeros the subsecond portion of the files’ timestamp.

I also see that perl’s File::Touch module does the same thing, but uses a different mechanism. I see the following in a strace of such a Touch() call:

stat(“xxyyzz”, 0x656060)                = -1 ENOENT (No such file or directory)
open(“xxyyzz”, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff16bb3c60) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, …}) = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
close(3)                                = 0
utimes(“xxyyzz”, {{1424884553, 0}, {1424884553, 0}}) = 0

I am very curious why touch and perl’s File::Touch() both explicitly zero the subsecond modification time for the file (using utimensat() or utimes() syscalls)?

## Maxwell’s equations in tensor form with magnetic sources

Following the principle that one should always relate new formalisms to things previously learned, I’d like to know what Maxwell’s equations look like in tensor form when magnetic sources are included. As a verification that the previous Geometric Algebra form of Maxwell’s equation that includes magnetic sources is correct, I’ll start with the GA form of Maxwell’s equation, find the tensor form, and then verify that the vector form of Maxwell’s equations can be recovered from the tensor form.

### Tensor form

With four-vector potential $$A$$, and bivector electromagnetic field $$F = \grad \wedge A$$, the GA form of Maxwell’s equation is

\label{eqn:gaMagneticSourcesToTensorToVector:20}
\grad F = \frac{J}{\epsilon_0 c} + M I.

The left hand side can be unpacked into vector and trivector terms $$\grad F = \grad \cdot F + \grad \wedge F$$, which happens to also separate the sources nicely as a side effect

\label{eqn:gaMagneticSourcesToTensorToVector:60}
\grad \cdot F = \frac{J}{\epsilon_0 c}

\label{eqn:gaMagneticSourcesToTensorToVector:80}
\grad \wedge F = M I.

The electric source equation can be unpacked into tensor form by dotting with the four vector basis vectors. With the usual definition $$F^{\alpha \beta} = \partial^\alpha A^\beta – \partial^\beta A^\alpha$$, that is

\label{eqn:gaMagneticSourcesToTensorToVector:100}
\begin{aligned}
\gamma^\mu \cdot \lr{ \grad \cdot F }
&=
\gamma^\mu \cdot \lr{ \grad \cdot \lr{ \grad \wedge A } } \\
&=
\gamma^\mu \cdot \lr{ \gamma^\nu \partial_\nu \cdot
\lr{ \gamma_\alpha \partial^\alpha \wedge \gamma_\beta A^\beta } } \\
&=
\gamma^\mu \cdot \lr{ \gamma^\nu \cdot \lr{ \gamma_\alpha \wedge \gamma_\beta
} } \partial_\nu \partial^\alpha A^\beta \\
&=
\inv{2}
\gamma^\mu \cdot \lr{ \gamma^\nu \cdot \lr{ \gamma_\alpha \wedge \gamma_\beta } }
\partial_\nu F^{\alpha \beta} \\
&=
\inv{2} \delta^{\nu \mu}_{[\alpha \beta]} \partial_\nu F^{\alpha \beta} \\
&=
\inv{2} \partial_\nu F^{\nu \mu}

\inv{2} \partial_\nu F^{\mu \nu} \\
&=
\partial_\nu F^{\nu \mu}.
\end{aligned}

So the first tensor equation is

\label{eqn:gaMagneticSourcesToTensorToVector:120}
\boxed{
\partial_\nu F^{\nu \mu} = \inv{c \epsilon_0} J^\mu.
}

To unpack the magnetic source portion of Maxwell’s equation, put it first into dual form, so that it has four vectors on each side

\label{eqn:gaMagneticSourcesToTensorToVector:140}
\begin{aligned}
M
&= – \lr{ \grad \wedge F} I \\
&= -\frac{1}{2} \lr{ \grad F I – F I \grad } \\
&= – \grad \cdot \lr{ F I }.
\end{aligned}

Dotting with $$\gamma^\mu$$ gives

\label{eqn:gaMagneticSourcesToTensorToVector:160}
\begin{aligned}
M^\mu
&= \gamma^\mu \cdot \lr{ \grad \cdot \lr{ – F I } } \\
&= \gamma^\mu \cdot \lr{ \gamma^\nu \partial_\nu \cdot \lr{ -\frac{1}{2}
\gamma^\alpha \wedge \gamma^\beta I F_{\alpha \beta} } } \\
&= -\inv{2}
\gamma^\mu \cdot \lr{ \gamma^\nu \cdot \lr{ \gamma^\alpha \wedge \gamma^\beta I } }
}
\partial_\nu F_{\alpha \beta}.
\end{aligned}

This scalar grade selection is a complete antisymmetrization of the indexes

\label{eqn:gaMagneticSourcesToTensorToVector:180}
\begin{aligned}
\gamma^\mu \cdot \lr{ \gamma^\nu \cdot \lr{ \gamma^\alpha \wedge \gamma^\beta I } }
}
&=
\gamma^\mu \cdot \lr{ \gamma^\nu \cdot \lr{
\gamma^\alpha \gamma^\beta
\gamma_0 \gamma_1 \gamma_2 \gamma_3
} }
} \\
&=
\gamma_0 \gamma_1 \gamma_2 \gamma_3
\gamma^\mu \gamma^\nu \gamma^\alpha \gamma^\beta
} \\
&=
\delta^{\mu \nu \alpha \beta}_{3 2 1 0} \\
&=
\epsilon^{\mu \nu \alpha \beta },
\end{aligned}

so the magnetic source portion of Maxwell’s equation, in tensor form, is

\label{eqn:gaMagneticSourcesToTensorToVector:200}
\boxed{
\inv{2} \epsilon^{\nu \alpha \beta \mu}
\partial_\nu F_{\alpha \beta}
=
M^\mu.
}

### Relating the tensor to the fields

The electromagnetic field has been identified with the electric and magnetic fields by

\label{eqn:gaMagneticSourcesToTensorToVector:220}
F = \boldsymbol{\mathcal{E}} + c \mu_0 \boldsymbol{\mathcal{H}} I ,

or in coordinates

\label{eqn:gaMagneticSourcesToTensorToVector:240}
\inv{2} \gamma_\mu \wedge \gamma_\nu F^{\mu \nu}
= E^a \gamma_a \gamma_0 + c \mu_0 H^a \gamma_a \gamma_0 I.

By forming the dot product sequence $$F^{\alpha \beta} = \gamma^\beta \cdot \lr{ \gamma^\alpha \cdot F }$$, the electric and magnetic field components can be related to the tensor components. The electric field components follow by inspection and are

\label{eqn:gaMagneticSourcesToTensorToVector:260}
E^b = \gamma^0 \cdot \lr{ \gamma^b \cdot F } = F^{b 0}.

The magnetic field relation to the tensor components follow from

\label{eqn:gaMagneticSourcesToTensorToVector:280}
\begin{aligned}
F^{r s}
&= F_{r s} \\
&= \gamma_s \cdot \lr{ \gamma_r \cdot \lr{ c \mu_0 H^a \gamma_a \gamma_0 I
} } \\
&=
c \mu_0 H^a \gpgradezero{ \gamma_s \gamma_r \gamma_a \gamma_0 I } \\
&=
c \mu_0 H^a \gpgradezero{ -\gamma^0 \gamma^1 \gamma^2 \gamma^3
\gamma_s \gamma_r \gamma_a \gamma_0 } \\
&=
c \mu_0 H^a \gpgradezero{ -\gamma^1 \gamma^2 \gamma^3
\gamma_s \gamma_r \gamma_a } \\
&=
– c \mu_0 H^a \delta^{[3 2 1]}_{s r a} \\
&=
c \mu_0 H^a \epsilon_{ s r a }.
\end{aligned}

Expanding this for each pair of spacelike coordinates gives

\label{eqn:gaMagneticSourcesToTensorToVector:320}
F^{1 2} = c \mu_0 H^3 \epsilon_{ 2 1 3 } = – c \mu_0 H^3

\label{eqn:gaMagneticSourcesToTensorToVector:340}
F^{2 3} = c \mu_0 H^1 \epsilon_{ 3 2 1 } = – c \mu_0 H^1

\label{eqn:gaMagneticSourcesToTensorToVector:360}
F^{3 1} = c \mu_0 H^2 \epsilon_{ 1 3 2 } = – c \mu_0 H^2,

or

\label{eqn:gaMagneticSourcesToTensorToVector:380}
\boxed{
\begin{aligned}
E^1 &= F^{1 0} \\
E^2 &= F^{2 0} \\
E^3 &= F^{3 0} \\
H^1 &= -\inv{c \mu_0} F^{2 3} \\
H^2 &= -\inv{c \mu_0} F^{3 1} \\
H^3 &= -\inv{c \mu_0} F^{1 2}.
\end{aligned}
}

### Recover the vector equations from the tensor equations

Starting with the non-dual Maxwell tensor equation, expanding the timelike index gives

\label{eqn:gaMagneticSourcesToTensorToVector:480}
\begin{aligned}
\inv{c \epsilon_0} J^0
&= \inv{\epsilon_0} \rho \\
&=
\partial_\nu F^{\nu 0} \\
&=
\partial_1 F^{1 0}
+\partial_2 F^{2 0}
+\partial_3 F^{3 0}
\end{aligned}

This is Gauss’s law

\label{eqn:gaMagneticSourcesToTensorToVector:500}
\boxed{
=
\rho/\epsilon_0.
}

For a spacelike index, any one is representive. Expanding index 1 gives

\label{eqn:gaMagneticSourcesToTensorToVector:520}
\begin{aligned}
\inv{c \epsilon_0} J^1
&= \partial_\nu F^{\nu 1} \\
&= \inv{c} \partial_t F^{0 1}
+ \partial_2 F^{2 1}
+ \partial_3 F^{3 1} \\
&= -\inv{c} E^1
+ \partial_2 (c \mu_0 H^3)
+ \partial_3 (-c \mu_0 H^2) \\
&=
\lr{ -\inv{c} \PD{t}{\boldsymbol{\mathcal{E}}} + c \mu_0 \spacegrad \cross \boldsymbol{\mathcal{H}} } \cdot \Be_1.
\end{aligned}

Extending this to the other indexes and multiplying through by $$\epsilon_0 c$$ recovers the Ampere-Maxwell equation (assuming linear media)

\label{eqn:gaMagneticSourcesToTensorToVector:540}
\boxed{
\spacegrad \cross \boldsymbol{\mathcal{H}} = \boldsymbol{\mathcal{J}} + \PD{t}{\boldsymbol{\mathcal{D}}}.
}

The expansion of the 0th free (timelike) index of the dual Maxwell tensor equation is

\label{eqn:gaMagneticSourcesToTensorToVector:400}
\begin{aligned}
M^0
&=
\inv{2} \epsilon^{\nu \alpha \beta 0}
\partial_\nu F_{\alpha \beta} \\
&=
-\inv{2} \epsilon^{0 \nu \alpha \beta}
\partial_\nu F_{\alpha \beta} \\
&=
-\inv{2}
\lr{
\partial_1 (F_{2 3} – F_{3 2})
+\partial_2 (F_{3 1} – F_{1 3})
+\partial_3 (F_{1 2} – F_{2 1})
} \\
&=

\lr{
\partial_1 F_{2 3}
+\partial_2 F_{3 1}
+\partial_3 F_{1 2}
} \\
&=

\lr{
\partial_1 (- c \mu_0 H^1 ) +
\partial_2 (- c \mu_0 H^2 ) +
\partial_3 (- c \mu_0 H^3 )
},
\end{aligned}

but $$M^0 = c \rho_m$$, giving us Gauss’s law for magnetism (with magnetic charge density included)

\label{eqn:gaMagneticSourcesToTensorToVector:420}
\boxed{
}

For the spacelike indexes of the dual Maxwell equation, only one need be computed (say 1), and cyclic permutation will provide the rest. That is

\label{eqn:gaMagneticSourcesToTensorToVector:440}
\begin{aligned}
M^1
&= \inv{2} \epsilon^{\nu \alpha \beta 1} \partial_\nu F_{\alpha \beta} \\
&=
\inv{2} \lr{ \partial_2 \lr{F_{3 0} – F_{0 3}} }
+\inv{2} \lr{ \partial_3 \lr{F_{0 2} – F_{0 2}} }
+\inv{2} \lr{ \partial_0 \lr{F_{2 3} – F_{3 2}} } \\
&=
– \partial_2 F^{3 0}
+ \partial_3 F^{2 0}
+ \partial_0 F_{2 3} \\
&=
-\partial_2 E^3 + \partial_3 E^2 + \inv{c} \PD{t}{} \lr{ – c \mu_0 H^1 } \\
&= – \lr{ \spacegrad \cross \boldsymbol{\mathcal{E}} + \mu_0 \PD{t}{\boldsymbol{\mathcal{H}}} } \cdot \Be_1.
\end{aligned}

Extending this to the rest of the coordinates gives the Maxwell-Faraday equation (as extended to include magnetic current density sources)

\label{eqn:gaMagneticSourcesToTensorToVector:460}
\boxed{
\spacegrad \cross \boldsymbol{\mathcal{E}} = -\boldsymbol{\mathcal{M}} – \mu_0 \PD{t}{\boldsymbol{\mathcal{H}}}.
}

This takes things full circle, going from the vector differential Maxwell’s equations, to the Geometric Algebra form of Maxwell’s equation, to Maxwell’s equations in tensor form, and back to the vector form. Not only is the tensor form of Maxwell’s equations with magnetic sources now known, the translation from the tensor and vector formalism has also been verified, and miraculously no signs or factors of 2 were lost or gained in the process.

## Energy momentum conservation with magnetic sources. Comparison to frequency domain and reciprocity theorem.

February 20, 2015 ece1229 No comments , , ,

### In the frequency domain

In the frequency domain with $$\boldsymbol{\mathcal{E}} = \textrm{Re} \BE e^{j \omega t}, \boldsymbol{\mathcal{H}} = \textrm{Re} \BH e^{j \omega t}$$. Using the electric field dot product as an example, note that we can write

\label{eqn:energyMomentumWithMagneticSources:480}
\boldsymbol{\mathcal{E}} = \inv{2} \lr{ \BE e^{j \omega t} + \BE^\conj e^{-j \omega t} },

so

\label{eqn:energyMomentumWithMagneticSources:500}
\begin{aligned}
\boldsymbol{\mathcal{E}}^2
&=
\inv{2} \lr{ \BE e^{j \omega t} + \BE^\conj e^{-j \omega t} }
\cdot
\inv{2} \lr{ \BE e^{j \omega t} + \BE^\conj e^{-j \omega t} } \\
&=
\inv{4} \lr{
\BE^2 e^{2 j \omega t}
+ \BE \cdot \BE^\conj + \BE^\conj \cdot \BE
+\lr{\BE^\conj}^2 e^{-2 j \omega t}
} \\
&=
\inv{2} \textrm{Re}
\lr{
\BE \cdot \BE^\conj
+
\BE^2 e^{2 j \omega t}
}.
\end{aligned}

Similarly, for the cross product

\label{eqn:energyMomentumWithMagneticSources:540}
\begin{aligned}
\boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{H}}
&=
\inv{4}
\lr{
\BE \cross \BH e^{2 j \omega t}
+ \BE \cross \BH^\conj + \BE^\conj \cross \BH
+ \lr{ \BE^\conj \cross \BH^\conj } e^{-2 j \omega t}
} \\
&=
\inv{2}
\textrm{Re}
\lr{
\BE \cross \BH^\conj
+
\BE \cross \BH e^{2 j \omega t}
}.
\end{aligned}

Given phasor representations of the sources $$\boldsymbol{\mathcal{M}} = \BM e^{j \omega t}, \boldsymbol{\mathcal{J}} = \BJ e^{j \omega t}$$, \ref{eqn:energyMomentumWithMagneticSources:40} can be recast into (a messy) phasor form

\label{eqn:energyMomentumWithMagneticSources:560}
\begin{aligned}
\inv{2} &\textrm{Re} \inv{2} \PD{t}{} \lr{
\epsilon_0 \BE \cdot \BE^\conj
+ \mu_0 \BH \cdot \BH^\conj
+ \epsilon_0 \BE^2 e^{ 2 j \omega t}
+ \mu_0 \BH^2 e^{ 2 j \omega t}
} \\
&+
\BE \cross \BH^\conj
+\BE \cross \BH e^{ 2 j \omega t}
} \\
&=
\inv{2} \textrm{Re}
\lr{
– \BH \cdot \BM^\conj
– \BE \cdot \BJ^\conj
– \BH \cdot \BM e^{2 j \omega t}
– \BE \cdot \BJ e^{2 j \omega t}
}.
\end{aligned}

In particular, when averaged over one period, the oscillatory terms vanish. The time averaged equivalent of the Poynting theorem is thus

\label{eqn:energyMomentumWithMagneticSources:580}
0 =
{\left[
\textrm{Re}
\lr{
\inv{2} \PD{t}{} \lr{
\epsilon_0 \BE \cdot \BE^\conj
+ \mu_0 \BH \cdot \BH^\conj
}
+
\BE \cross \BH^\conj
}
+
\BH \cdot \BM^\conj
+
\BE \cdot \BJ^\conj
}
\right]
}_{\textrm{av}}.

### Comparison to the reciprocity theorem result

The reciprocity theorem had a striking similarity to the Poynting theorem above, which isn’t suprising since both were derived by calculating the divergence of a Poynting like quantity.

Here’s a repetition of the reciprocity divergence calculation without the single frequency (phasor) assumption

\label{eqn:energyMomentumWithMagneticSources:600}
\begin{aligned}
\boldsymbol{\mathcal{E}}^{(a)} \cross \boldsymbol{\mathcal{H}}^{(b)}
-\boldsymbol{\mathcal{E}}^{(b)} \cross \boldsymbol{\mathcal{H}}^{(a)}
} \\
&=
\boldsymbol{\mathcal{H}}^{(b)} \cdot \lr{ \spacegrad \cross \boldsymbol{\mathcal{E}}^{(a)} } -\boldsymbol{\mathcal{E}}^{(a)} \cdot \lr{ \spacegrad \cross \boldsymbol{\mathcal{H}}^{(b)} } \\
-\boldsymbol{\mathcal{H}}^{(a)} \cdot \lr{ \spacegrad \cross \boldsymbol{\mathcal{E}}^{(b)} } +\boldsymbol{\mathcal{E}}^{(b)} \cdot \lr{ \spacegrad \cross \boldsymbol{\mathcal{H}}^{(a)} } \\
&=
-\boldsymbol{\mathcal{H}}^{(b)} \cdot \lr{ \mu_0 \partial_t \boldsymbol{\mathcal{H}}^{(a)} + \boldsymbol{\mathcal{M}}^{(a)} }
-\boldsymbol{\mathcal{E}}^{(a)} \cdot \lr{ \boldsymbol{\mathcal{J}}^{(b)} + \epsilon_0 \partial_t \boldsymbol{\mathcal{E}}^{(b)} } \\
+\boldsymbol{\mathcal{H}}^{(a)} \cdot \lr{ \mu_0 \partial_t \boldsymbol{\mathcal{H}}^{(b)} + \boldsymbol{\mathcal{M}}^{(b)} }
+\boldsymbol{\mathcal{E}}^{(b)} \cdot \lr{ \boldsymbol{\mathcal{J}}^{(a)} + \epsilon_0 \partial_t \boldsymbol{\mathcal{E}}^{(a)} } \\
&=
\epsilon_0
\lr{
\boldsymbol{\mathcal{E}}^{(b)} \cdot \partial_t \boldsymbol{\mathcal{E}}^{(a)}
-\boldsymbol{\mathcal{E}}^{(a)} \cdot \partial_t \boldsymbol{\mathcal{E}}^{(b)}
}
+
\mu_0
\lr{
\boldsymbol{\mathcal{H}}^{(a)} \cdot \partial_t \boldsymbol{\mathcal{H}}^{(b)}
-\boldsymbol{\mathcal{H}}^{(b)} \cdot \partial_t \boldsymbol{\mathcal{H}}^{(a)}
} \\
&+\boldsymbol{\mathcal{H}}^{(a)} \cdot \boldsymbol{\mathcal{M}}^{(b)}
-\boldsymbol{\mathcal{H}}^{(b)} \cdot \boldsymbol{\mathcal{M}}^{(a)}
+\boldsymbol{\mathcal{E}}^{(b)} \cdot \boldsymbol{\mathcal{J}}^{(a)}
-\boldsymbol{\mathcal{E}}^{(a)} \cdot \boldsymbol{\mathcal{J}}^{(b)}
\end{aligned}

What do these time derivative terms look like in the frequency domain?

\label{eqn:energyMomentumWithMagneticSources:620}
\begin{aligned}
\boldsymbol{\mathcal{E}}^{(b)} \cdot \partial_t \boldsymbol{\mathcal{E}}^{(a)}
&=
\inv{4}
\lr{
\BE^{(b)} e^{j \omega t}
+
{\BE^{(b)}}^\conj e^{-j \omega t}
}
\cdot
\partial_t
\lr{
\BE^{(a)} e^{j \omega t}
+
{\BE^{(a)}}^\conj e^{-j \omega t}
} \\
&=
\frac{j \omega}{4}
\lr{
\BE^{(b)} e^{j \omega t}
+
{\BE^{(b)}}^\conj e^{-j \omega t}
}
\cdot
\lr{
\BE^{(a)} e^{j \omega t}

{\BE^{(a)}}^\conj e^{-j \omega t}
} \\
&=
\frac{\omega}{4}
\lr{
j \BE^{(a)} \cdot { \BE^{(b)} }^\conj
-j \BE^{(b)} \cdot { \BE^{(a)} }^\conj
+j \BE^{(a)} \cdot \BE^{(b)} e^{ 2 j \omega t }
-j { \BE^{(a)}}^\conj \cdot { \BE^{(b)} }^\conj e^{ -2 j \omega t }
} \\
&=
\inv{2} \textrm{Re}
\lr{
j \omega \BE^{(a)} \cdot { \BE^{(b)} }^\conj
+ j \omega \BE^{(a)} \cdot \BE^{(b)} e^{ 2 j \omega t }
}
\end{aligned}

Taking the difference,

\label{eqn:energyMomentumWithMagneticSources:640}
\begin{aligned}
\boldsymbol{\mathcal{E}}^{(b)} \cdot \partial_t \boldsymbol{\mathcal{E}}^{(a)}
-\boldsymbol{\mathcal{E}}^{(a)} \cdot \partial_t \boldsymbol{\mathcal{E}}^{(b)}
&=
\inv{2} \textrm{Re}
\lr{
j \omega \BE^{(a)} \cdot { \BE^{(b)} }^\conj
– j \omega \BE^{(b)} \cdot { \BE^{(a)} }^\conj
+ j \omega \BE^{(a)} \cdot \BE^{(b)} e^{ 2 j \omega t }
– j \omega \BE^{(b)} \cdot \BE^{(a)} e^{ 2 j \omega t }
} \\
&=
– \omega \textrm{Im}
\lr{
\BE^{(a)} \cdot { \BE^{(b)} }^\conj
+ \BE^{(a)} \cdot \BE^{(b)} e^{ 2 j \omega t }
},
\end{aligned}

so we have

\label{eqn:energyMomentumWithMagneticSources:660}
0
=
{
\left[
\BE^{(a)} \cross {\BH^{(b)}}^\conj
-\BE^{(b)} \cross {\BH^{(a)}}^\conj
}
+
\omega \textrm{Im}
\lr{
\epsilon_0
\BE^{(a)} \cdot { \BE^{(b)} }^\conj
+
\mu_0
\BH^{(a)} \cdot { \BH^{(b)} }^\conj
}
+ \textrm{Re}
\lr{
-\BH^{(a)} \cdot { \BM^{(b)} }^\conj
+\BH^{(b)} \cdot { \BM^{(a)} }^\conj
-\BE^{(b)} \cdot { \BJ^{(a)} }^\conj
+\BE^{(a)} \cdot { \BJ^{(b)} }^\conj
}
\right]
}_{\textrm{av}}.

Observe that the perfect cancellation of the time derivative terms only occurs when the cross product differences were those of the phasors. When those cross differences are those of the actual fields, like those in the Poynting theorem, there is a frequency dependent term is that expansion.

## Maxwell’s equations with magnetic sources

The form of Maxwell’s equations to be used here are expressed in terms of $$\boldsymbol{\mathcal{E}}$$ and $$\boldsymbol{\mathcal{H}}$$, assume linear media, and do not assume a phasor representation

\label{eqn:energyMomentumWithMagneticSources:120}
\spacegrad \cross \boldsymbol{\mathcal{E}} = – \boldsymbol{\mathcal{M}} – \mu_0 \PD{t}{\boldsymbol{\mathcal{H}}}

\label{eqn:energyMomentumWithMagneticSources:140}
\spacegrad \cross \boldsymbol{\mathcal{H}} = \boldsymbol{\mathcal{J}} + \epsilon_0 \PD{t}{\boldsymbol{\mathcal{E}}}

\label{eqn:energyMomentumWithMagneticSources:160}

\label{eqn:energyMomentumWithMagneticSources:180}

## Energy momentum conservation

With magnetic sources the Poynting and energy conservation relationship has to be adjusted slightly. Let’s derive that result, starting with the divergence of the Poynting vector

\label{eqn:energyMomentumWithMagneticSources:20}
\begin{aligned}
\spacegrad \cdot \lr{ \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{H}} }
&=
\boldsymbol{\mathcal{H}} \cdot \lr{ \spacegrad \cross \boldsymbol{\mathcal{E}} }
-\boldsymbol{\mathcal{E}} \cdot \lr{ \spacegrad \cross \boldsymbol{\mathcal{H}} } \\
&=
-\boldsymbol{\mathcal{H}} \cdot \lr{ \mu_0 \partial_t \boldsymbol{\mathcal{H}} + \boldsymbol{\mathcal{M}} }
-\boldsymbol{\mathcal{E}} \cdot \lr{ \boldsymbol{\mathcal{J}} + \epsilon_0 \partial_t \boldsymbol{\mathcal{E}} } \\
&=
– \mu_0 \boldsymbol{\mathcal{H}} \cdot \partial_t \boldsymbol{\mathcal{H}} – \boldsymbol{\mathcal{H}} \cdot \boldsymbol{\mathcal{M}}
– \epsilon_0 \boldsymbol{\mathcal{E}} \cdot \partial_t \boldsymbol{\mathcal{E}} – \boldsymbol{\mathcal{E}} \cdot \boldsymbol{\mathcal{J}},
\end{aligned}

or

\label{eqn:energyMomentumWithMagneticSources:40}
\boxed{
\inv{2} \PD{t}{} \lr{ \epsilon_0 \boldsymbol{\mathcal{E}}^2 + \mu_0 \boldsymbol{\mathcal{H}}^2 }
+
\spacegrad \cdot \lr{ \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{H}} }
=
– \boldsymbol{\mathcal{H}} \cdot \boldsymbol{\mathcal{M}}
– \boldsymbol{\mathcal{E}} \cdot \boldsymbol{\mathcal{J}}.
}

The usual relationship is only modified by one additional term. Recall from electrodynamics [2] that \ref{eqn:energyMomentumWithMagneticSources:40} (when the magnetic current density $$\boldsymbol{\mathcal{M}}$$ is omitted) is just one of four components of the energy momentum conservation equation

\label{eqn:energyMomentumWithMagneticSources:80}
\partial_\mu T^{\mu \nu} = – \inv{c} F^{\nu \lambda} j_\lambda.

Note that \ref{eqn:energyMomentumWithMagneticSources:80} was likely not in SI units. The next task is to generalize this classical relationship to incorporate the magnetic sources used in antenna theory. With an eye towards the relativistic nature of the energy momentum tensor, it is natural to assume that the remainder of the energy momentum tensor conservation relation can be found by taking the time derivatives of the Poynting vector.

\label{eqn:energyMomentumWithMagneticSources:200}
\PD{t}{} \lr{ \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{H}} }
=
\PD{t}{\boldsymbol{\mathcal{E}}} \cross \boldsymbol{\mathcal{H}}
+ \boldsymbol{\mathcal{E}} \cross \PD{t}{\boldsymbol{\mathcal{H}} }
=
\inv{\epsilon_0}
\lr{ \spacegrad \cross \boldsymbol{\mathcal{H}} – \boldsymbol{\mathcal{J}} } \cross \boldsymbol{\mathcal{H}}
+
\inv{\mu_0}
\boldsymbol{\mathcal{E}} \cross
\lr{

\spacegrad \cross \boldsymbol{\mathcal{E}} – \boldsymbol{\mathcal{M}} },

or

\label{eqn:energyMomentumWithMagneticSources:220}
\inv{c^2} \PD{t}{} \lr{ \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{H}} }
+
\mu_0 \boldsymbol{\mathcal{J}} \cross \boldsymbol{\mathcal{H}}
+\epsilon_0
\boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{M}}
=
-\mu_0 \boldsymbol{\mathcal{H}} \cross \lr{ \spacegrad \cross \boldsymbol{\mathcal{H}} }
– \epsilon_0 \boldsymbol{\mathcal{E}} \cross \lr{ \spacegrad \cross \boldsymbol{\mathcal{E}} }.

The $$\mu_0 \boldsymbol{\mathcal{J}} \cross \boldsymbol{\mathcal{H}} = \boldsymbol{\mathcal{J}} \cross \BB$$ is a portion of the Lorentz force equation in its density form. To put \ref{eqn:energyMomentumWithMagneticSources:220} into the desired form, the remainder of the Lorentz force force equation $$\rho \boldsymbol{\mathcal{E}} = \epsilon_0 \boldsymbol{\mathcal{E}} \spacegrad \cdot \boldsymbol{\mathcal{E}}$$ must be added to both sides. To extend the magnetic current term to its full dual (magnetic) Lorentz force structure, the quantity to add to both sides is $$\rho_m \boldsymbol{\mathcal{H}} = \mu_0 \boldsymbol{\mathcal{H}} \spacegrad \cdot \boldsymbol{\mathcal{H}}$$. Performing these manipulations gives

\label{eqn:energyMomentumWithMagneticSources:240}
\inv{c^2} \PD{t}{} \lr{ \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{H}} }
+
\rho \BE + \mu_0 \boldsymbol{\mathcal{J}} \cross \boldsymbol{\mathcal{H}}
+ \rho_m \boldsymbol{\mathcal{H}}
+ \epsilon_0 \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{M}}
=
\mu_0
\lr{
-\boldsymbol{\mathcal{H}} \cross \lr{ \spacegrad \cross \boldsymbol{\mathcal{H}} }
}
+ \epsilon_0
\lr{

\boldsymbol{\mathcal{E}} \cross \lr{ \spacegrad \cross \boldsymbol{\mathcal{E}} }
}.

It seems slightly surprising the sign of the magnetic equivalent of the Lorentz force terms have an alternation of sign. This is, however, consistent with the duality transformations outlined in ([1] table 3.2)

\label{eqn:energyMomentumWithMagneticSources:280}
\rho \rightarrow \rho_m

\label{eqn:energyMomentumWithMagneticSources:300}
\boldsymbol{\mathcal{J}} \rightarrow \boldsymbol{\mathcal{M}}

\label{eqn:energyMomentumWithMagneticSources:320}
\mu_0 \rightarrow \epsilon_0

\label{eqn:energyMomentumWithMagneticSources:340}
\boldsymbol{\mathcal{E}} \rightarrow \boldsymbol{\mathcal{H}}

\label{eqn:energyMomentumWithMagneticSources:360}
\boldsymbol{\mathcal{H}} \rightarrow -\boldsymbol{\mathcal{E}},

for

\label{eqn:energyMomentumWithMagneticSources:380}
\rho \BE + \mu_0 \boldsymbol{\mathcal{J}} \cross \boldsymbol{\mathcal{H}}
\rightarrow
\rho_m \BH + \epsilon_0 \boldsymbol{\mathcal{M}} \cross \lr{ -\boldsymbol{\mathcal{E}}}
=
\rho_m \BH + \epsilon_0 \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{M}}.

Comfortable that the LHS has the desired structure, the RHS can expressed as a divergence. Just expanding one of the differences of vector products on the RHS does not obviously show that this is possible, for example

\label{eqn:energyMomentumWithMagneticSources:400}
\begin{aligned}
\Be_a \cdot
\lr{

\boldsymbol{\mathcal{E}} \cross \lr{ \spacegrad \cross \boldsymbol{\mathcal{E}} }
}
&=
E_a \partial_b E_b

\epsilon_{a b c} E_b \epsilon_{c r s} \partial_r E_s \\
&=
E_a \partial_b E_b

\delta_{a b}^{[r s]} E_b \partial_r E_s \\
&=
E_a \partial_b E_b

E_b \lr{
\partial_a E_b
-\partial_b E_a
} \\
&=
E_a \partial_b E_b
– E_b \partial_a E_b
+ E_b \partial_b E_a.
\end{aligned}

This happens to equal

\label{eqn:energyMomentumWithMagneticSources:420}
\begin{aligned}
\spacegrad \cdot \lr{ \lr{E_a E_b – \inv{2} \delta_{a b} \boldsymbol{\mathcal{E}}^2 } \Be_b }
&=
\partial_b
\lr{E_a E_b – \inv{2} \delta_{a b} \boldsymbol{\mathcal{E}}^2 } \\
&=
E_b \partial_b E_a
+ E_a \partial_b E_b

\inv{2} \delta_{a b} 2 E_c \partial_b E_c \\
i&=
E_b \partial_b E_a
+ E_a \partial_b E_b
– E_b \partial_a E_b.
\end{aligned}

This allows a final formulation of the remaining energy momentum conservation equation in its divergence form. Let

\label{eqn:energyMomentumWithMagneticSources:440}
T^{a b} =
\epsilon_0 \lr{ E_a E_b – \inv{2} \delta_{a b} \boldsymbol{\mathcal{E}}^2 }
+ \mu_0 \lr{ H_a H_b – \inv{2} \delta_{a b} \boldsymbol{\mathcal{H}}^2 },

so that the remaining energy momentum conservation equation, extended to both electric and magnetic sources, is

\label{eqn:energyMomentumWithMagneticSources:460}
\boxed{
\inv{c^2} \PD{t}{} \lr{ \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{H}} }
+
\rho \BE + \mu_0 \boldsymbol{\mathcal{J}} \cross \boldsymbol{\mathcal{H}}
+ \rho_m \boldsymbol{\mathcal{H}}
+ \epsilon_0 \boldsymbol{\mathcal{E}} \cross \boldsymbol{\mathcal{M}}
=
\Be_a \spacegrad \cdot \lr{ T^{a b} \Be_b }.
}

On the LHS we have the rate of change of momentum density, the electric Lorentz force density terms, the dual (magnetic) Lorentz force density terms, and on the RHS the the momentum flux terms.

# References

[1] Constantine A Balanis. Antenna theory: analysis and design. John Wiley \& Sons, 3rd edition, 2005.

[2] Peeter Joot. Relativistic Electrodynamics., chapter {Energy Momentum Tensor.} peeterjoot.com, 2011. URL http://peeterjoot.com/archives/math2011/phy450.pdf. [Online; accessed 18-February-2015].

## Reciprocity theorem in Geometric Algebra

The reciprocity theorem involves a Poynting like antisymmetric difference of the following form

\label{eqn:reciprocityTheoremGA:20}
\BE^{(a)} \cross \BH^{(b)} – \BE^{(b)} \cross \BH^{(a)}.

This smells like something that can probably be related to a combined electromagnetic field multivectors in some sort of structured fashion. Guessing that this is related to the antisymmetic sum of two electromagnetic field multivectors turns out to be correct. Let

\label{eqn:reciprocityTheoremGA:60}
F^{(a)} = \BE^{(a)} + I c \BB^{(a)}

\label{eqn:reciprocityTheoremGA:80}
F^{(b)} = \BE^{(b)} + I c \BB^{(b)}.

Now form the antisymmetic sum

\label{eqn:reciprocityTheoremGA:100}
\begin{aligned}
\inv{2} \lr{ F^{(a)} F^{(b)} – F^{(b)} F^{(a)} }
&=
\inv{2} \lr{\BE^{(a)} + I c \BB^{(a)}}
\lr{\BE^{(b)} + I c \BB^{(b)}} \\
&-
\inv{2} \lr{\BE^{(b)} + I c \BB^{(b)}}
\lr{\BE^{(a)} + I c \BB^{(a)}} \\
&=
\inv{2} \lr{ \BE^{(a)} \BE^{(b)} -\BE^{(b)} \BE^{(a)} }
+ \frac{I c}{2} \lr{ \BE^{(a)} \BB^{(b)} – \BB^{(b)} \BE^{(a)} }\\&
+ \frac{I c}{2} \lr{ \BB^{(a)} \BE^{(b)} – \BE^{(b)} \BB^{(a)} }
+ \frac{c^2}{2} \lr{ \BB^{(b)} \BB^{(a)} – \BB^{(a)} \BB^{(b)} } \\
&=
\BE^{(a)} \wedge \BE^{(b)} + c^2 \lr{ \BB^{(b)} \wedge \BB^{(a)} }
+ I c \lr{
\BE^{(a)} \wedge \BB^{(b)}
+
\BB^{(a)} \wedge \BE^{(b)}
} \\
&=
I \BE^{(a)} \cross \BE^{(b)} + c^2 I \lr{ \BB^{(b)} \cross \BB^{(a)} }

c \lr{
\BE^{(a)} \cross \BB^{(b)}
+
\BB^{(a)} \cross \BE^{(b)}
}
\end{aligned}

This has two components, the first is a bivector (pseudoscalar times vector) that includes all the non-mixed products, and the second is a vector that includes all the mixed terms. We can therefore write the antisymmetic difference of the reciprocity theorem by extracting just the grade one terms of the antisymmetric sum of the combined electromagnetic field

\label{eqn:reciprocityTheoremGA:120}
\BE^{(a)} \cross \BH^{(b)} – \BE^{(b)} \cross \BH^{(a)}
=
-\frac{1}{2 c \mu_0} \gpgradeone{ \lr{ F^{(a)} F^{(b)} – F^{(b)} F^{(a)} } }.

Observing that the antisymmetrization used in the reciprocity theorem is only one portion of the larger electromagnetic field antisymmetrization, introduces two new questions

1. How would the reciprocity theorem be derived directly in terms of $$F^{(a)} F^{(b)} – F^{(b)} F^{(a)}$$?
2. What is the significance of the other portion of this antisymmetrization $$\BE^{(a)} \cross \BE^{(b)} – c^2 \mu_0^2 \lr{ \BH^{(a)} \cross \BH^{(b)} }$$ ?

… more to come.

## Reciprocity theorem: background

The class slides presented a derivation of the reciprocity theorem, a theorem that contained the integral of

\label{eqn:reciprocityTheorem:360}
\int \lr{ \BE^{(a)} \cross \BH^{(b)} – \BE^{(b)} \cross \BH^{(a)} } \cdot d\BS = \cdots

over a surface, where the RHS was a volume integral involving the fields and (electric and magnetic) current sources.
The idea was to consider two different source loading configurations of the same system, and to show that the fields and sources in the two configurations can be related.

To derive the result in question, a simple way to start is to look at the divergence of the difference of cross products above. This will require the phasor form of the two cross product Maxwell’s equations

\label{eqn:reciprocityTheorem:100}
\spacegrad \cross \BE = – (\BM + j \omega \mu_0 \BH) % \BM^{(a)} + j \omega \mu_0 \BH^{(a)}

\label{eqn:reciprocityTheorem:120}
\spacegrad \cross \BH = \BJ + j \omega \epsilon_0 \BE, % \BJ^{(a)} + j \omega \epsilon_0 \BE^{(a)}

so the divergence is

\label{eqn:reciprocityTheorem:380}
\begin{aligned}
\lr{ \BE^{(a)} \cross \BH^{(b)} – \BE^{(b)} \cross \BH^{(a)} }
&=
\BH^{(b)} \cdot \lr{ \spacegrad \cross \BE^{(a)} } -\BE^{(a)} \cdot \lr{ \spacegrad \cross \BH^{(b)} } \\
&-\BH^{(a)} \cdot \lr{ \spacegrad \cross \BE^{(b)} } +\BE^{(b)} \cdot \lr{ \spacegrad \cross \BH^{(a)} } \\
&=
-\BH^{(b)} \cdot \lr{ \BM^{(a)} + j \omega \mu_0 \BH^{(a)} } -\BE^{(a)} \cdot \lr{ \BJ^{(b)} + j \omega \epsilon_0 \BE^{(b)} } \\
&+\BH^{(a)} \cdot \lr{ \BM^{(b)} + j \omega \mu_0 \BH^{(b)} } +\BE^{(b)} \cdot \lr{ \BJ^{(a)} + j \omega \epsilon_0 \BE^{(a)} }.
\end{aligned}

The non-source terms cancel, leaving

\label{eqn:reciprocityTheorem:440}
\boxed{
\lr{ \BE^{(a)} \cross \BH^{(b)} – \BE^{(b)} \cross \BH^{(a)} }
=
-\BH^{(b)} \cdot \BM^{(a)} -\BE^{(a)} \cdot \BJ^{(b)}
+\BH^{(a)} \cdot \BM^{(b)} +\BE^{(b)} \cdot \BJ^{(a)}
}

Should we be suprised to have a relation of this form? Probably not, given that the energy momentum relationship between the fields and currents of a single source has the form

\label{eqn:reciprocityTheorem:n}
\PD{t}{}\frac{\epsilon_0}{2} \left(\BE^2 + c^2 \BB^2\right) + \spacegrad \cdot \inv{\mu_0}(\BE \cross \BB) = -\BE \cdot \BJ.

(this is without magnetic sources).

This suggests that the reciprocity theorem can be expressed more generally in terms of the energy-momentum tensor.

## far field integral form

Employing the divergence theorem over a sphere the identity above takes the form

\label{eqn:reciprocityTheorem:480}
\int_S
\lr{ \BE^{(a)} \cross \BH^{(b)} – \BE^{(b)} \cross \BH^{(a)} } \cdot \rcap dS
=
\int_V \lr{
-\BH^{(b)} \cdot \BM^{(a)} -\BE^{(a)} \cdot \BJ^{(b)}
+\BH^{(a)} \cdot \BM^{(b)} +\BE^{(b)} \cdot \BJ^{(a)}
}
dV

In the far field, the cross products are strictly radial. That surface integral can be written as

\label{eqn:reciprocityTheorem:500}
\begin{aligned}
\int_S
\lr{ \BE^{(a)} \cross \BH^{(b)} – \BE^{(b)} \cross \BH^{(a)} } \cdot \rcap dS
&=
\inv{\mu_0}
\int_S
\lr{ \BE^{(a)} \cross \lr{ \rcap \cross \BE^{(b)}} – \BE^{(b)} \cross \lr{ \rcap \cross \BE^{(a)}} } \cdot \rcap dS \\
&=
\inv{\mu_0}
\int_S
\lr{ \BE^{(a)} \cdot \BE^{(b)} – \BE^{(b)} \cdot \BE^{(a)}
}
dS \\
&= 0
\end{aligned}

The above expansions used \ref{eqn:reciprocityTheorem:540} to expand the terms of the form

\label{eqn:reciprocityTheorem:560}
\lr{ \BA \cross \lr{ \rcap \cross \BC } } \cdot \rcap
= \BA \cdot \BC -\lr{ \BA \cdot \rcap } \lr{ \BC \cdot \rcap },

in which only the first dot product survives due to the transverse nature of the fields.

So in the far field we have a direct relation between the fields and sources of two source configurations of the same system of the form

\label{eqn:reciprocityTheorem:580}
\boxed{
\int_V \lr{
\BH^{(a)} \cdot \BM^{(b)} +\BE^{(b)} \cdot \BJ^{(a)}
}
dV
=
\int_V \lr{
\BH^{(b)} \cdot \BM^{(a)} +\BE^{(a)} \cdot \BJ^{(b)}
}
dV
}

## Application to antenna

This is the underlying reason that we are able to pose the problem of what an antenna can recieve, in terms of what the antenna can transmit.

More on that to come.

## Identities

Lemma: Divergence of a cross product.

\label{thm:polarizationReview:400}
\spacegrad \cdot \lr{ \BA \cross \BB } =

Proof.

\label{eqn:reciprocityTheorem:420}
\begin{aligned}
\spacegrad \cdot \lr{ \BA \cross \BB }
&=
\partial_a \epsilon_{a b c} A_b B_c \\
&=
\epsilon_{a b c} (\partial_a A_b )B_c

\epsilon_{b a c} A_b (\partial_a B_c) \\
&=
\end{aligned}

Lemma: Triple cross product dotted
\label{thm:polarizationReview:520}
\begin{aligned}
\lr{ \BA \cross \lr{ \BB \cross \BC } } \cdot \BD
=
\lr{ \BA \cdot \BC } \lr{ \BB \cdot \BD }
-\lr{ \BA \cdot \BB } \lr{ \BC \cdot \BD }
\end{aligned}

Proof.

\label{eqn:reciprocityTheorem:540}
\begin{aligned}
\lr{ \BA \cross \lr{ \BB \cross \BC } } \cdot \BD
&=
\epsilon_{a b c} A_b \epsilon_{r s c } B_r C_s D_a \\
&=
\delta_{[a b]}^{r s}
A_b B_r C_s D_a \\
&=
A_s B_r C_s D_r
-A_r B_r C_s D_s \\
&=
\lr{ \BA \cdot \BC } \lr{ \BB \cdot \BD }
-\lr{ \BA \cdot \BB } \lr{ \BC \cdot \BD }.
\end{aligned}

## Notes for Balantis chapter 4: linear wire antennas.

These are notes for the UofT course ECE1229, Advanced Antenna Theory, taught by Prof. Eleftheriades, covering ch. 4 [1] content.

Unlike most of the other classes I have taken, I am not attempting to take comprehensive notes for this class. The class is taught on slides that match the textbook so closely, there is little value to me taking notes that just replicate the text. Instead, I am annotating my copy of textbook with little details instead. My usual notes collection for the class will contain musings of details that were unclear, or in some cases, details that were provided in class, but are not in the text (and too long to pencil into my book.)

## Magnetic Vector Potential.

In class and in the problem set $$\BA$$ was referred to as the Magnetic Vector Potential.  I only recalled this referred to as the Vector Potential.  Prefixing this with magnetic seemed counter intuitive to me since it is generated by electric sources (charges and currents).
This terminology can be justified due to the fact that $$\BA$$ generates the magnetic field by its curl. Some mention of this can be found in [4], which also points out that the Electric Potential refers to the scalar $$\phi$$. Prof. Eleftheriades points out that Electric Vector Potential refers to the vector potential $$\BF$$ generated by magnetic sources (because in that case the electric field is generated by the curl of $$\BF$$.)

## Plots of infinitesimal dipole radial dependence.

In section 4.2 of [1] are some discussions of the $$kr < 1$$, $$kr = 1$$, and $$kr > 1$$ radial dependence of the fields and power of a solution to an infinitesimal dipole system. Here are some plots of those $$k r$$ dependence, along with the $$k r = 1$$ contour as a reference. All the $$\theta$$ dependence and any scaling is left out.

The CDF notebook visualizeDipoleFields.cdf is available to interactively plot these, rotate the plots and change the ranges of what is plotted.

A plot of the real and imaginary parts of $$H_\phi = \frac{j k}{r} e^{-j k r} \lr{ 1-\frac{j}{k r} }$$ can be found in fig. 1 and fig. 2.

fig 1. Radial dependence of Re H_phi

fig 2. Radial dependence of Im H_phi

A plot of the real and imaginary parts of $$E_r = \inv{r^2} \lr{1-\frac{j}{k r}} e^{-j k r}$$ can be found in fig. 3 and fig. 4.

fig 3. Radial dependence of Re E_r

fig 4. Radial dependence of Im E_r

Finally, a plot of the real and imaginary parts of $$E_\theta = \frac{ j k }{r} \lr{1 -\frac{j}{k r} -\frac{1}{k^2 r^2} } e^{-j k r}$$ can be found in fig. 5 and fig. 6.

fig. 5. Radial dependence of Re E_theta

fig. 6. Radial dependence of Im E_theta

## Electric Far field for a spherical potential.

It is interesting to look at the far electric field associated with an arbitrary spherical magnetic vector potential, assuming all of the radial dependence is in the spherical envelope. That is

\label{eqn:chapter4Notes:20}
\BA = \frac{e^{-j k r}}{r} \lr{
\rcap a_r\lr{ \theta, \phi }
+\thetacap a_\theta\lr{ \theta, \phi }
+\phicap a_\phi\lr{ \theta, \phi }
}.

The electric field is

\label{eqn:chapter4Notes:40}
\BE = – j \omega \BA – j \frac{1}{\omega \mu_0 \epsilon_0 } \spacegrad \lr{\spacegrad \cdot \BA }.

The divergence and gradient in spherical coordinates are

\label{eqn:chapter4Notes:80}
\begin{aligned}
&=
\inv{r^2} \PD{r}{} \lr{ r^2 A_r }
+ \inv{r \sin\theta } \PD{\theta}{} \lr{A_\theta \sin\theta}
+ \inv{r \sin\theta } \PD{\phi}{A_\phi}
\end{aligned}

\label{eqn:chapter4Notes:100}
\begin{aligned}
&=
\rcap \PD{r}{\psi}
+\frac{\thetacap}{r} \PD{\theta}{\psi}
+ \frac{\phicap}{r \sin\theta} \PD{\phi}{\psi}.
\end{aligned}

For the assumed potential, the divergence is

\label{eqn:chapter4Notes:120}
\begin{aligned}
&=
\frac{a_r}{r^2} \PD{r}{} \lr{ r^2 \frac{e^{-j k r}}{r} }
+ \inv{r \sin\theta } \frac{e^{-j k r}}{r} \PD{\theta}{} \lr{\sin\theta a_\theta}
+ \inv{r \sin\theta } \frac{e^{-j k r}}{r} \PD{\phi}{a_\phi} \\
&=
a_r
e^{-j k r}
\lr{
\inv{r^2}
-j k \inv{r}
}
+ \inv{r^2 \sin\theta } e^{-j k r} \PD{\theta}{} \lr{\sin\theta a_\theta}
+ \inv{r^2 \sin\theta } e^{-j k r} \PD{\phi}{a_\phi} \\
&\approx
-j k \frac{a_r}{r}
e^{-j k r}.
\end{aligned}

The last approximation dropped all the $$1/r^2$$ terms that will be small compared to $$1/r$$ contribution that dominates when $$r \rightarrow \infty$$, the far field.

The gradient can now be computed

\label{eqn:chapter4Notes:140}
\begin{aligned}
&\approx
-j k
\lr{
\frac{a_r}{r}
e^{-j k r}
} \\
&=
-j k \lr{
\rcap \PD{r}{}
+\frac{\thetacap}{r} \PD{\theta}{}
+ \frac{\phicap}{r \sin\theta} \PD{\phi}{}
}
\frac{a_r}{r}
e^{-j k r} \\
&=
-j k \lr{
\rcap a_r \PD{r}{} \lr{
\frac{1}{r}
e^{-j k r}
}
+\frac{\thetacap}{r^2}
e^{-j k r}
\PD{\theta}{a_r}
+
e^{-j k r}
\frac{\phicap}{r^2 \sin\theta}
\PD{\phi}{a_r}
} \\
&=
-j k \lr{
-\rcap \frac{a_r}{r^2} \lr{
1
+ j k r
}
+\frac{\thetacap}{r^2}
\PD{\theta}{a_r}
+
\frac{\phicap}{r^2 \sin\theta}
\PD{\phi}{a_r}
}
e^{-j k r} \\
&\approx
– k^2 \rcap \frac{a_r}{r}
e^{-j k r}.
\end{aligned}

Again, a far field approximation has been used to kill all the $$1/r^2$$ terms.

The far field approximation of the electric field is now possible

\label{eqn:chapter4Notes:160}
\begin{aligned}
\BE
&= – j \omega \BA – j \frac{1}{\omega \mu_0 \epsilon_0 } \spacegrad \lr{\spacegrad \cdot \BA } \\
&=
– j \omega
\frac{e^{-j k r}}{r} \lr{
\rcap a_r\lr{ \theta, \phi }
+\thetacap a_\theta\lr{ \theta, \phi }
+\phicap a_\phi\lr{ \theta, \phi }
}
+ j \frac{1}{\omega \mu_0 \epsilon_0 }
k^2 \rcap \frac{a_r}{r}
e^{-j k r} \\
&=
– j \omega
\frac{e^{-j k r}}{r} \lr{
\rcap a_r\lr{ \theta, \phi }
+\thetacap a_\theta\lr{ \theta, \phi }
+\phicap a_\phi\lr{ \theta, \phi }
}
+ j \frac{c^2}{\omega }
\lr{\frac{\omega}{c}}^2 \rcap \frac{a_r}{r}
e^{-j k r}
\\
&=
– j \omega
\frac{e^{-j k r}}{r} \lr{
\thetacap a_\theta\lr{ \theta, \phi }
+\phicap a_\phi\lr{ \theta, \phi }
}.
\end{aligned}

Observe the perfect, somewhat miraculous seeming, cancellation of all the radial components of the field. If $$\BA_{\textrm{T}}$$ is the non-radial projection of $$\BA$$, the electric far field is just

\label{eqn:chapter4Notes:180}
\boxed{
\BE_{\textrm{ff}} = -j \omega \BA_{\textrm{T}}.
}

## Magnetic Far field for a spherical potential.

Application of the same assumed representation for the magnetic field gives
\label{eqn:chapter4Notes:220}
\begin{aligned}
\BB
&=
&=
\frac{\rcap}{r \sin\theta} \partial_\theta \lr{A_\phi \sin\theta}
+ \frac{\thetacap}{r} \lr{ \inv{\sin\theta} \partial_\phi A_r – \partial_r \lr{r A_\phi}}
+ \frac{\phicap}{r} \lr{ \partial_r\lr{r A_\theta} – \partial_\theta A_r} \\
&=
\frac{\rcap}{r \sin\theta} \partial_\theta \lr{
\frac{e^{-j k r}}{r} a_\phi
\sin\theta}
+ \frac{\thetacap}{r} \lr{ \inv{\sin\theta} \partial_\phi \lr{
\frac{e^{-j k r}}{r} a_r
} – \partial_r \lr{r
\frac{e^{-j k r}}{r} a_\phi
}
}
+ \frac{\phicap}{r} \lr{ \partial_r\lr{r
\frac{e^{-j k r}}{r} a_\theta
} – \partial_\theta
\lr{
\frac{e^{-j k r}}{r} a_r
}
} \\
&=
\frac{\rcap}{r \sin\theta}
\frac{e^{-j k r}}{r}
\partial_\theta \lr{
a_\phi
\sin\theta}
+ \frac{\thetacap}{r} \lr{ \inv{\sin\theta}
\frac{e^{-j k r}}{r}
\partial_\phi
a_r
– \partial_r \lr{
e^{-j k r}
}
a_\phi
}
+ \frac{\phicap}{r} \lr{
\partial_r
\lr{
e^{-j k r}
}
a_\theta

\frac{e^{-j k r}}{r}
\partial_\theta
a_r
}
\approx
j k \lr{ \thetacap a_\phi

\phicap a_\theta
}
\frac{e^{-j k r}}{r} \\
&=
-j k \rcap \cross \lr{
\thetacap a_\theta
+\phicap a_\phi
}
\frac{e^{-j k r}}{r} \\
&=
\inv{c} \BE_{\textrm{ff}}.
\end{aligned}

The approximation above drops the $$1/r^2$$ terms. Since

\label{eqn:chapter4Notes:240}
\inv{\mu_0 c} = \inv{\mu_0} \sqrt{\mu_0\epsilon_0} = \sqrt{\frac{\epsilon_0}{\mu_0}} = \inv{\eta},

the magnetic far field can be expressed in terms of the electric far field as
\label{eqn:chapter4Notes:260}
\boxed{
\BH = \inv{\eta} \rcap \cross \BE.
}

## Plane wave relations between electric and magnetic fields

I recalled an identity of the form \ref{eqn:chapter4Notes:260} in [3], but didn’t think that it required a far field approximation.
The reason for this was because the Jackson identity assumed a plane wave representation of the field, something that the far field assumptions also locally require.

Assuming a plane wave representation for both fields

\label{eqn:chapter4Notes:300}
\boldsymbol{\mathcal{E}}(\Bx, t) = \BE e^{j \lr{\omega t – \Bk \cdot \Bx}}

\label{eqn:chapter4Notes:320}
\boldsymbol{\mathcal{B}}(\Bx, t) = \BB e^{j \lr{\omega t – \Bk \cdot \Bx}}

The cross product relation between the fields follows from the Maxwell-Faraday law of induction

\label{eqn:chapter4Notes:340}
0 = \spacegrad \cross \boldsymbol{\mathcal{E}} + \PD{t}{\boldsymbol{\mathcal{B}}},

or

\label{eqn:chapter4Notes:360}
\begin{aligned}
0
&=
\Be_r \cross \BE \partial_r e^{j\lr{ \omega t – \Bk \cdot \Bx}}
+
j \omega \BB e^{j \lr{\omega t – \Bk \cdot \Bx}} \\
&=
-j \Be_r k_r \cross \BE e^{j \lr{\omega t – \Bk \cdot \Bx}}
+
j \omega \BB e^{j \lr{\omega t – \Bk \cdot \Bx}} \\
&=
\lr{ – \Bk \cross \BE + \omega \BB } j
e^{j \lr{\omega t – \Bk \cdot \Bx}},
\end{aligned}

or

\label{eqn:chapter4Notes:380}
\begin{aligned}
\BH
&= \frac{ k}{k c \mu_0 } \kcap \cross \BE \\
&= \inv{ \eta } \kcap \cross \BE,
\end{aligned}

which also finds \ref{eqn:chapter4Notes:260}, but with much less work and less mess.

## Transverse only nature of the far-field fields

Also observe that its possible to tell that the far field fields have only transverse components using the same argument that they are locally plane waves at that distance. The plane waves must satisfy the zero divergence Maxwell’s equations

\label{eqn:chapter4Notes:420}

\label{eqn:chapter4Notes:440}

so by the same logic

\label{eqn:chapter4Notes:480}
\Bk \cdot \BE = 0

\label{eqn:chapter4Notes:500}
\Bk \cdot \BB = 0.

In the far field the electric field must equal its transverse projection

\label{eqn:chapter4Notes:520}
\BE = \textrm{Proj}_\T \lr{-j \omega \BA
– j \frac{1}{\omega \mu_0 \epsilon_0 } \spacegrad \lr{\spacegrad \cdot \BA } }.

Since by \ref{eqn:chapter4Notes:140} the scalar potential term has only a radial component, that leaves

\label{eqn:chapter4Notes:540}
\BE = -j \omega \textrm{Proj}_\T \BA,

which provides \ref{eqn:chapter4Notes:180} with slightly less work.

## Vertical dipole reflection coefficient

In class a ground reflection scenario was covered for a horizontal dipole. Reading the text I was surprised to see what looked like the same sort of treatment section 4.7.2, but ending up with a quite different result. It turns out the difference is because the text was treating the vertical dipole configuration, whereas Prof. Eleftheriades was treating a horizontal dipole configuration, which have different reflection coefficients. These differing reflection coefficients are due to differences in the polarization of the field.

To understand these differences in reflection coefficients, consider first the field due to a vertical dipole as sketched in fig. 7, with a wave vector directed from the transmission point downwards in the z-y plane.

fig. 7. vertical dipole configuration.

The wave vector has direction

\label{eqn:chapter4Notes:560}
\kcap = \zcap e^{\zcap \xcap \theta} = \zcap \cos\theta + \ycap \sin\theta.

Suppose that the (magnetic) vector potential is that of an infinitesimal dipole

\label{eqn:chapter4Notes:580}
\BA = \zcap \frac{\mu_0 I_0 l}{4 \pi r} e^{-j k r} %= \frac{A_r}{4 \pi r} e^{-j k r}

The electric field, in the far field, can be computed by computing the normal projection to the wave vector direction

\label{eqn:chapter4Notes:600}
\begin{aligned}
\BE
&= -j \omega \lr{\BA \wedge \kcap} \cdot \kcap \\
&= -j \omega \frac{\mu_0 I_0 l}{4 \pi r} \lr{\zcap \wedge \lr{\zcap \cos\theta
+ \ycap \sin\theta} } \lr{\zcap \cos\theta + \ycap \sin\theta} \\
&= -j \omega \frac{\mu_0 I_0 l}{4 \pi r} \lr{ \zcap \ycap \sin\theta }
\lr{\zcap \cos\theta + \ycap \sin\theta} \\
&= -j \omega \frac{\mu_0 I_0 l}{4 \pi r} \sin\theta \lr{-\ycap \cos\theta +
\zcap \sin\theta} \\
&= j \omega \frac{\mu_0 I_0 l}{4 \pi r} \sin\theta \ycap e^{\zcap \ycap \theta}.
\end{aligned}

This is directed in the z-y plane rotated an additional $$\pi/2$$ past $$\kcap$$. The magnetic field must then be directed into the page, along the x axis. This is sketched in fig. 8.

fig. 8. Electric and magnetic field directions

Referring to [2] (\eqntext 4.40) for the coefficient of reflection component

\label{eqn:chapter4Notes:620}
R
=
\frac{
n_t \cos\theta_i – n_i \cos\theta_t
}
{
n_i \cos\theta_i + n_t \cos\theta_t
}

This is the Fresnel equation for the case when
that corresponds to

$$\BE$$ lies in the plane of incidence, and the magnetic field is completely parallel to the plane of reflection). For the no transmission case, allowing $$v_t \rightarrow 0$$, the index of refraction is $$n_t = c/v_t \rightarrow \infty$$, and the reflection coefficient is $$1$$ as claimed in section 4.7.2 of [1]. Because of the symmetry of this dipole configuration, the azimuthal angle that the wave vector is directed along does not matter.

## Horizontal dipole reflection coefficient

In the class notes, a horizontal dipole coming out of the page is indicated. With the page representing the z-y plane, this is a magnetic vector potential directed along the x-axis direction

\label{eqn:chapter4Notes:640}
\BA = \xcap \frac{\mu_0 I_0 l}{4 \pi r} e^{-j k r}.

For a wave vector directed in the z-y plane as in \ref{eqn:chapter4Notes:560}, the electric far field is directed along

\label{eqn:chapter4Notes:660}
\begin{aligned}
\lr{ \xcap \wedge \kcap } \cdot \kcap
&=
\xcap – \lr{ \xcap \cdot \kcap } \kcap \\
&=
\xcap – \lr{ \xcap \cdot \lr{
\zcap \cos\theta + \ycap \sin\theta
} } \kcap \\
&= \xcap.
\end{aligned}

The electric far field lies completely in the plane of reflection. From [2] (\eqntext 4.34), the Fresnel reflection coefficients is

\label{eqn:chapter4Notes:680}
R =
\frac{
n_i \cos\theta_i – n_t \cos\theta_t
}
{
n_i \cos\theta_i + n_t \cos\theta_t
},

which approaches $$-1$$ when $$n_t \rightarrow \infty$$. This is consistent with the image theorem summation that Prof. Eleftheriades used in class.

### Azimuthal angle dependency of the reflection coefficient

Now consider a horizontal dipole directed along the y-axis. For the same wave vector direction as avove, the electric far field is now directed along

\label{eqn:chapter4Notes:700}
\begin{aligned}
\lr{ \ycap \wedge \kcap } \cdot \kcap
&=
\ycap – \lr{ \ycap \cdot \kcap } \kcap \\
&=
\ycap – \lr{ \ycap \cdot \lr{
\zcap \cos\theta + \ycap \sin\theta
} } \kcap \\
&=
\ycap – \kcap \sin\theta \\
&=
\ycap – \sin\theta \lr{
\zcap \cos\theta + \ycap \sin\theta
} \\
&=
\ycap \cos^2 \theta – \sin\theta \cos\theta \zcap \\
&= \cos\theta \lr{ \ycap \cos\theta – \sin\theta \zcap } \\
&= \cos\theta \ycap e^{ \zcap \ycap \theta }.
\end{aligned}

That is

\label{eqn:chapter4Notes:720}
\BE =
-j \omega \frac{\mu_0 I_0 l}{4 \pi r} e^{-j k r}
\cos\theta \ycap e^{ \zcap \ycap \theta }.

This far field electric field lies in the plane of incidence (a direction of $$\thetacap$$ rotated by $$\pi/2$$), not in the plane of reflection. The corresponding magnetic field should be directed along the plane of reflection, which is easily confirmed by calculation

\label{eqn:chapter4Notes:740}
\begin{aligned}
\kcap \cross
\lr{ \ycap \cos\theta – \sin\theta \zcap }
&=
\lr{ \zcap \cos\theta + \ycap \sin\theta } \cross
\lr{ \ycap \cos\theta – \sin\theta \zcap } \\
&=
-\xcap \cos^2 \theta – \xcap \sin^2\theta \\
&= -\xcap.
\end{aligned}

The far field magnetic field is seen to be

\label{eqn:chapter4Notes:721}
\BH =
j \omega \frac{I_0 l}{4 \pi r} e^{-j k r}
\cos\theta \xcap,

so a reflection coefficient of $$1$$ is required to calculate the power loss after a single ground reflection signal bounce for this relative orientation of antenna to the target.

I fail to see how the horizontal dipole treatment in section 4.7.5 can use a single reflection coefficient without taking into account the azimuthal dependency of that reflection coefficient.

# References

[1] Constantine A Balanis. Antenna theory: analysis and design. John Wiley \& Sons, 3rd edition, 2005.

[2] E. Hecht. Optics. 1998.

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

[4] Wikipedia. Magnetic potential — Wikipedia, The Free Encyclopedia, 2015. URL https://en.wikipedia.org/w/index.php?title=Magnetic_potential&oldid=642387563. [Online; accessed 5-February-2015].

## A first raspberry pi circuit

February 14, 2015 electronics No comments , , ,

For reasons not completely known to myself, I bought a raspberry pi recently.  Here’s a first circuit, a collaboration between myself and Lance.  Lance added a switch between the GPIO output port and the LED, so that the port has to be enabled by both software, and by the physical switch

pi and the circuit

the circuit

I tried two different ways of controlling the GPIO, the first using a command line tool:

#!/bin/bash

# https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/

gpio mode 0 out
gpio write 0 1
sleep 5
gpio write 0 0


and the second with a bit of python code:

#! /usr/bin/python
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)

GPIO.output( 17, 1 ) ;
time.sleep( 5 ) ;
GPIO.output( 17, 0 ) ;