Month: March 2015

Tschebyscheff polynomials

March 13, 2015 ece1229 , , ,

[Click here for a PDF of this post with nicer formatting]

In ancient times (i.e. 2nd year undergrad) I recall being very impressed with Tschebyscheff polynomials for designing lowpass filters. I’d used Tschebyscheff filters for the hardware we used for a speech recognition system our group built in the design lab. One of the benefits of these polynomials is that the oscillation in the \( \Abs{x} < 1 \) interval is strictly bounded. This same property, as well as the unbounded nature outside of the \( [-1,1] \) interval turns out to have applications to antenna array design.

The Tschebyscheff polynomials are defined by

\begin{equation}\label{eqn:tschebyscheff:40}
T_m(x) = \cos\lr{ m \cos^{-1} x }, \quad \Abs{x} < 1 \end{equation} \begin{equation}\label{eqn:tschebyscheff:60} T_m(x) = \cosh\lr{ m \cosh^{-1} x }, \quad \Abs{x} > 1.
\end{equation}

Range restrictions and hyperbolic form.

Prof. Eleftheriades’s notes made a point to point out the definition in the \( \Abs{x} > 1 \) interval, but that can also be viewed as a consequence instead of a definition if the range restriction is removed. For example, suppose \( x = 7 \), and let

\begin{equation}\label{eqn:tschebyscheff:160}
\cos^{-1} 7 = \theta,
\end{equation}

so
\begin{equation}\label{eqn:tschebyscheff:180}
\begin{aligned}
7
&= \cos\theta \\
&= \frac{e^{i\theta} + e^{-i\theta}}{2} \\
&= \cosh(i\theta),
\end{aligned}
\end{equation}

or

\begin{equation}\label{eqn:tschebyscheff:200}
-i \cosh^{-1} 7 = \theta.
\end{equation}

\begin{equation}\label{eqn:tschebyscheff:220}
\begin{aligned}
T_m(7)
&= \cos( -m i \cosh^{-1} 7 ) \\
&= \cosh( m \cosh^{-1} 7 ).
\end{aligned}
\end{equation}

The same argument clearly applies to any other value outside of the \( \Abs{x} < 1 \) range, so without any restrictions, these polynomials can be defined as just

\begin{equation}\label{eqn:tschebyscheff:260}
\boxed{
T_m(x) = \cos\lr{ m \cos^{-1} x }.
}
\end{equation}

Polynomial nature.

Eq. \ref{eqn:tschebyscheff:260} does not obviously look like a polynomial. Let’s proceed to verify the polynomial nature for the first couple values of \( m \).

  • \( m = 0 \).\begin{equation}\label{eqn:tschebyscheff:280}
    \begin{aligned}
    T_0(x)
    &= \cos( 0 \cos^{-1} x ) \\
    &= \cos( 0 ) \\
    &= 1.
    \end{aligned}
    \end{equation}
  • \( m = 1 \).\begin{equation}\label{eqn:tschebyscheff:300}
    \begin{aligned}
    T_1(x)
    &= \cos( 1 \cos^{-1} x ) \\
    &= x.
    \end{aligned}
    \end{equation}
  • \( m = 2 \).\begin{equation}\label{eqn:tschebyscheff:320}
    \begin{aligned}
    T_2(x)
    &= \cos( 2 \cos^{-1} x ) \\
    &= 2 \cos^2 \cos^{-1}(x) – 1 \\
    &= 2 x^2 – 1.
    \end{aligned}
    \end{equation}

To examine the general case

\begin{equation}\label{eqn:tschebyscheff:340}
\begin{aligned}
T_m(x)
&= \cos( m \cos^{-1} x ) \\
&= \textrm{Re} e^{ j m \cos^{-1} x } \\
&= \textrm{Re} \lr{ e^{ j\cos^{-1} x } }^m \\
&= \textrm{Re} \lr{ \cos\cos^{-1} x + j \sin\cos^{-1} x }^m \\
&= \textrm{Re} \lr{ x + j \sqrt{1 – x^2} }^m \\
&=
\textrm{Re} \lr{
x^m
+ \binom{ m}{1} j x^{m-1} \lr{1 – x^2}^{1/2}
– \binom{ m}{2} x^{m-2} \lr{1 – x^2}^{2/2}
– \binom{ m}{3} j x^{m-3} \lr{1 – x^2}^{3/2}
+ \binom{ m}{4} x^{m-4} \lr{1 – x^2}^{4/2}
+ \cdots
} \\
&=
x^m
– \binom{ m}{2} x^{m-2} \lr{1 – x^2}
+ \binom{ m}{4} x^{m-4} \lr{1 – x^2}^2
– \cdots
\end{aligned}
\end{equation}

This expansion was a bit cavaliar with the signs of the \( \sin\cos^{-1} x = \sqrt{1 – x^2} \) terms, since the negative sign should be picked for the root when \( x \in [-1,0] \). However, that doesn’t matter in the end since the real part operation selects only powers of two of this root.

The final result of the expansion above can be written

\begin{equation}\label{eqn:tschebyscheff:360}
\boxed{
T_m(x) = \sum_{k = 0}^{\lfloor m/2 \rfloor} \binom{m}{2 k} (-1)^k x^{m – 2 k} \lr{1 – x^2}^k.
}
\end{equation}

This clearly shows the polynomial nature of these functions, and is also perfectly well defined for any value of \( x \). The even and odd alternation with \( m \) is also clear in this explicit expansion.

Plots

ChebychevFig1pn

Properties

In [1] a few properties can be found for these polynomials

\begin{equation}\label{eqn:tschebyscheff:100}
T_m(x) = 2 x T_{m-1} – T_{m-2}
\end{equation}
\begin{equation}\label{eqn:tschebyscheff:420}
0 = \lr{ 1 – x^2 } \frac{d T_m(x)}{dx} + m x T_m(x) – m T_{m-1}(x)
\end{equation}
\begin{equation}\label{eqn:tschebyscheff:400}
0 = \lr{ 1 – x^2 } \frac{d^2 T_m(x)}{dx^2} – x \frac{dT_m(x)}{dx} + m^2 T_{m}(x)
\end{equation}
\begin{equation}\label{eqn:tschebyscheff:440}
\int_{-1}^1 \inv{ \sqrt{1 – x^2} } T_m(x) T_n(x) dx =
\left\{
\begin{array}{l l}
0 & \quad \mbox{if \( m \ne n \) } \\
\pi & \quad \mbox{if \( m = n = 0 \) } \\
\pi/2 & \quad \mbox{if \( m = n, m \ne 0 \) }
\end{array}
\right.
\end{equation}

Recurrance relation.

Prove \ref{eqn:tschebyscheff:100}.

Answer.

To show this, let

\begin{equation}\label{eqn:tschebyscheff:460}
x = \cos\theta.
\end{equation}

\begin{equation}\label{eqn:tschebyscheff:580}
2 x T_{m-1} – T_{m-2}
=
2 \cos\theta \cos((m-1) \theta) – \cos((m-2)\theta).
\end{equation}

Recall the cosine addition formulas

\begin{equation}\label{eqn:tschebyscheff:540}
\begin{aligned}
\cos( a + b )
&=
\textrm{Re} e^{j(a + b)} \\
&=
\textrm{Re} e^{ja} e^{jb} \\
&=
\textrm{Re}
\lr{ \cos a + j \sin a }
\lr{ \cos b + j \sin b } \\
&=
\cos a \cos b – \sin a \sin b.
\end{aligned}
\end{equation}

Applying this gives

\begin{equation}\label{eqn:tschebyscheff:600}
\begin{aligned}
2 x T_{m-1} – T_{m-2}
&=
2 \cos\theta \Biglr{ \cos(m\theta)\cos\theta +\sin(m\theta) \sin\theta }
– \Biglr{
\cos(m\theta)\cos(2\theta) + \sin(m\theta) \sin(2\theta)
} \\
&=
2 \cos\theta \Biglr{ \cos(m\theta)\cos\theta +\sin(m\theta)\sin\theta) }
– \Biglr{
\cos(m\theta)(\cos^2 \theta – \sin^2 \theta) + 2 \sin(m\theta) \sin\theta \cos\theta
} \\
&=
\cos(m\theta) \lr{ \cos^2\theta + \sin^2\theta } \\
&= T_m(x).
\end{aligned}
\end{equation}

First order LDE relation.

Prove \ref{eqn:tschebyscheff:420}.

Answer.

To show this, again, let

\begin{equation}\label{eqn:tschebyscheff:470}
x = \cos\theta.
\end{equation}

Observe that

\begin{equation}\label{eqn:tschebyscheff:480}
1 = -\sin\theta \frac{d\theta}{dx},
\end{equation}

so

\begin{equation}\label{eqn:tschebyscheff:500}
\begin{aligned}
\frac{d}{dx}
&= \frac{d\theta}{dx} \frac{d}{d\theta} \\
&= -\frac{1}{\sin\theta} \frac{d}{d\theta}.
\end{aligned}
\end{equation}

Plugging this in gives

\begin{equation}\label{eqn:tschebyscheff:520}
\begin{aligned}
\lr{ 1 – x^2} &\frac{d}{dx} T_m(x) + m x T_m(x) – m T_{m-1}(x) \\
&=
\sin^2\theta
\lr{
-\frac{1}{\sin\theta} \frac{d}{d\theta}}
\cos( m \theta ) + m \cos\theta \cos( m \theta ) – m \cos( (m-1)\theta ) \\
&=
-\sin\theta (-m \sin(m \theta)) + m \cos\theta \cos( m \theta ) – m \cos( (m-1)\theta ).
\end{aligned}
\end{equation}

Applying the cosine addition formula \ref{eqn:tschebyscheff:540} gives

\begin{equation}\label{eqn:tschebyscheff:560}
m \lr{ \sin\theta \sin(m \theta) + \cos\theta \cos( m \theta ) } – m
\lr{
\cos( m \theta) \cos\theta + \sin( m \theta ) \sin\theta
}
=0.
\end{equation}

} % answer

Second order LDE relation.

Prove \ref{eqn:tschebyscheff:400}.

Answer.

This follows the same way. The first derivative was

\begin{equation}\label{eqn:tschebyscheff:640}
\begin{aligned}
\frac{d T_m(x)}{dx}
&=
-\inv{\sin\theta}
\frac{d}{d\theta} \cos(m\theta) \\
&=
-\inv{\sin\theta} (-m) \sin(m\theta) \\
&=
m \inv{\sin\theta} \sin(m\theta),
\end{aligned}
\end{equation}

so the second derivative is

\begin{equation}\label{eqn:tschebyscheff:620}
\begin{aligned}
\frac{d^2 T_m(x)}{dx^2}
&=
-m \inv{\sin\theta} \frac{d}{d\theta} \inv{\sin\theta} \sin(m\theta) \\
&=
-m \inv{\sin\theta}
\lr{
-\frac{\cos\theta}{\sin^2\theta} \sin(m\theta) + \inv{\sin\theta} m \cos(m\theta)
}.
\end{aligned}
\end{equation}

Putting all the pieces together gives

\begin{equation}\label{eqn:tschebyscheff:660}
\begin{aligned}
\lr{ 1 – x^2 } &\frac{d^2 T_m(x)}{dx^2} – x \frac{dT_m(x)}{dx} + m^2 T_{m}(x) \\
&=
m
\lr{
\frac{\cos\theta}{\sin\theta} \sin(m\theta) – m \cos(m\theta)
}
– \cos\theta m \inv{\sin\theta} \sin(m\theta)
+ m^2 \cos(m \theta) \\
&=
0.
\end{aligned}
\end{equation}

Orthogonality relation

Prove \ref{eqn:tschebyscheff:440}.

Answer.

First consider the 0,0 inner product, making an \( x = \cos\theta \), so that \( dx = -\sin\theta d\theta \)

\begin{equation}\label{eqn:tschebyscheff:680}
\begin{aligned}
\innerprod{T_0}{T_0}
&=
\int_{-1}^1 \inv{\lr{1-x^2}^{1/2}} dx \\
&=
\int_{-\pi}^0 \lr{-\inv{\sin\theta}} -\sin\theta d\theta \\
&=
0 – (-\pi) \\
&= \pi.
\end{aligned}
\end{equation}

Note that since the \( [-\pi, 0] \) interval was chosen, the negative root of \( \sin^2\theta = 1 – x^2 \) was chosen, since \( \sin\theta \) is negative in that interval.

The m,m inner product with \( m \ne 0 \) is

\begin{equation}\label{eqn:tschebyscheff:700}
\begin{aligned}
\innerprod{T_m}{T_m}
&=
\int_{-1}^1 \inv{\lr{1-x^2}^{1/2}} \lr{ T_m(x)}^2 dx \\
&=
\int_{-\pi}^0 \lr{-\inv{\sin\theta}} \cos^2(m\theta) -\sin\theta d\theta \\
&=
\int_{-\pi}^0 \cos^2(m\theta) d\theta \\
&=
\inv{2} \int_{-\pi}^0 \lr{ \cos(2 m\theta) + 1 } d\theta \\
&= \frac{\pi}{2}.
\end{aligned}
\end{equation}

So far so good. For \( m \ne n \) the inner product is

\begin{equation}\label{eqn:tschebyscheff:720}
\begin{aligned}
\innerprod{T_m}{T_m}
&=
\int_{-\pi}^0 \cos(m\theta) \cos(n\theta) d\theta \\
&=
\inv{4} \int_{-\pi}^0
\lr{
e^{j m \theta}
+ e^{-j m \theta}
}
\lr{
e^{j n \theta}
+ e^{-j n \theta}
}
d\theta \\
&=
\inv{4} \int_{-\pi}^0
\lr{
e^{j (m + n) \theta}
+e^{-j (m + n) \theta}
+e^{j (m – n) \theta}
+e^{j (-m + n) \theta}
}
d\theta \\
&=
\inv{2} \int_{-\pi}^0
\lr{
\cos( (m + n)\theta )
+\cos( (m – n)\theta )
}
d\theta \\
&=
\inv{2}
\evalrange{
\lr{
\frac{\sin( (m + n)\theta )}{ m + n }
+\frac{\sin( (m – n)\theta )}{ m – n}
}
}{-\pi}{0} \\
&= 0.
\end{aligned}
\end{equation}

References

[1] M. Abramowitz and I.A. Stegun. Handbook of mathematical functions with formulas, graphs, and mathematical tables, volume 55. Dover publications, 1964.

parallelized xargs

March 12, 2015 perl and general scripting hackery

I’ve used xargs before to execute commands long enough that attempting them with backquotes fails. For example, if the list of files ‘c’ is too long, a checkin attempt like:

    cleartool checkin -c 'blah blah blah' `cat c`

could generate an “environment too long” error in the shell. Something like:

    cat c | xargs cleartool checkin -c 'blah blah blah'

is equivalent. This also checks in one file at a time, using all the filenames in the file ‘c’, but allows xargs to farm out the commands one at a time without building one giant execv argument. What I didn’t know was xargs has a parallelization option:

    cat c | xargs -P 8 -n 1 cleartool checkin -c 'blah blah blah'

This does the same job, with -n 1 restricting xargs to passing one file at a time (which may not be necessary in this case), but starting 8 different processes for the work!

Circumference of an ellipse

March 9, 2015 math and physics play , , , ,

[Click here for a PDF of this post with nicer formatting]

Motivation

Lance told me they’ve been covering the circumference of a circle in school this week. This made me think of the generalization of a circle, the ellipse, but I couldn’t recall what the circumference of an ellipse was. Sofia guessed \( \pi ( a + b ) \). Her reasoning was that this goes to \( 2 \pi r \) when the ellipse is circular, just like the area of an ellipse \( \pi a b \), goes to \( \pi a^2 \) in the circular limit. That seemed reasonable to me, but also strange since I didn’t recall any \( \pi ( a + b ) \) formula.

It turns out that there’s no closed form expression for the circumference of an ellipse, unless you count infinite series or special functions. Here I’ll calculate one expression for this circumference.

Geometry recap

There’s two ways that I think of ellipses. One is the shape that you get when you put a couple tacks in a paper, and use a string and pencil to trace it out, as sketched in fig. 1.
The other is the basic vector parameterization of that same path

\begin{equation}\label{eqn:elipticCircumference:20}
\Br = ( a \cos\theta, b \sin\theta ).
\end{equation}

ellipseFig1

fig. 1. Ellipse, showing tracing curve from the foci.

 

It’s been a long time since grade 11 when I would have taken it for granted that these two representations are identical. To do so, we’d have to know where the foci of the ellipse sit. Cheating a bit I find in [1] that the foci are located at

\begin{equation}\label{eqn:elipticCircumference:40}
\Bf_{\pm} = \pm \sqrt{ a^2 – b^2 } (1, 0).
\end{equation}

This and the equivalence of the pencil and tack representation of the ellipse can be verified by checking that the “length of the string” equals \( 2 a \) as expected.

That string length is

\begin{equation}\label{eqn:elipticCircumference:60}
\begin{aligned}
\Abs{ \Br – \Bf_{+} } + \Abs{ \Br – \Bf_{-} }
&=
\sqrt{ (a \cos\theta – f)^2 + b^2 \sin^2\theta }
+
\sqrt{ (a \cos\theta + f)^2 + b^2 \sin^2\theta } \\
&=
\sqrt{ a^2 \cos^2 \theta + f^2 – 2 a f \cos\theta + b^2 \lr{ 1 – \cos^2\theta } } \\
&\quad +
\sqrt{ a^2 \cos^2 \theta + f^2 + 2 a f \cos\theta + b^2 \lr{ 1 – \cos^2\theta } }.
\end{aligned}
\end{equation}

These square roots simplify nicely

\begin{equation}\label{eqn:elipticCircumference:80}
\begin{aligned}
\sqrt{ a^2 \cos^2 \theta + f^2 \pm 2 a f \cos\theta + b^2 \lr{ 1 – \cos^2\theta } }
&=
\sqrt{ (a^2 – b^2) \cos^2 \theta + a^2 – b^2 \pm 2 a f \cos\theta + b^2 } \\
&=
\sqrt{ f^2 \cos^2 \theta + a^2 \pm 2 a f \cos\theta } \\
&=
\sqrt{ (a \pm f \cos\theta)^2 } \\
&=
a \pm f \cos\theta.
\end{aligned}
\end{equation}

So the total length from one focus to a point on the ellipse, back to the other focus, is

\begin{equation}\label{eqn:elipticCircumference:100}
\Abs{ \Br – \Bf_{+} } + \Abs{ \Br – \Bf_{-} }
=
a + f \cos\theta + a – f \cos\theta = 2 a,
\end{equation}

as expected. That verifies that the trigonometric parameterization matches with the pencil and tacks representation of an ellipse (provided the foci are placed at the points \ref{eqn:elipticCircumference:40}).

Calculating the circumference

The circumference expression can almost be written by inspection. An element of the tangent vector along the curve is

\begin{equation}\label{eqn:elipticCircumference:340}
\frac{d\Br}{d\theta} = ( -a \sin\theta, b \cos\theta ),
\end{equation}

so the circumference is just a one liner

\begin{equation}\label{eqn:elipticCircumference:280}
C = 4 \int_0^{\pi/2} \sqrt{ a^2 \sin^2\theta + b^2 \cos^2 \theta} d\theta.
\end{equation}

The problem is that this one liner isn’t easy to evaluate. The square root can be put in a slightly simpler form in terms of the eccentricity, which is defined by

\begin{equation}\label{eqn:elipticCircumference:300}
e = \frac{f}{a} = \frac{\sqrt{a^2 – b^2}}{a} = \sqrt{ 1 – \frac{b^2}{a^2} }.
\end{equation}

Factoring out \( a \) and writing the sine as a cosine gives

\begin{equation}\label{eqn:elipticCircumference:320}
\begin{aligned}
C
&=
4 a \int_0^{\pi/2} \sqrt{ 1 – \cos^2\theta + \frac{b^2}{a^2} \cos^2 \theta} d\theta \\
&=
4 a \int_0^{\pi/2} \sqrt{ 1 + \lr{ \frac{b^2}{a^2} -1} \cos^2 \theta} d\theta \\
&=
4 a \int_0^{\pi/2} \sqrt{ 1 – e^2 \cos^2 \theta} d\theta.
\end{aligned}
\end{equation}

For the square root, it’s not hard to show that the fractional binomial expansion is

\begin{equation}\label{eqn:elipticCircumference:360}
\sqrt{1 + a}
=
1 – \sum_{k=1}^\infty \frac{(-a)^k}{2k – 1}\frac{ (2k – 1)!!}{(2k)!!},
\end{equation}

so the circumference is

\begin{equation}\label{eqn:elipticCircumference:380}
C
=
4 a \int_0^{\pi/2} d\theta
\lr{ 1 – \sum_{k=1}^\infty \frac{(e \cos\theta)^{2k}}{2k – 1}\frac{ (2k – 1)!!}{(2k)!!}}.
\end{equation}

Using \ref{eqn:elipticCircumference:260}, this is

\begin{equation}\label{eqn:elipticCircumference:400}
C
=
2 \pi a

4 a
\sum_{k=1}^\infty \frac{e^{2k}}{2k – 1}\frac{ (2k – 1)!!}{(2k)!!}
\frac{(2k – 1)!!}{(2k)!!} \frac{\pi}{2}
\end{equation}

\begin{equation}\label{eqn:elipticCircumference:420}
\boxed{
C
=
2 \pi a \lr{ 1 –
\sum_{k=1}^\infty \frac{e^{2k}}{2k – 1} \lr{ \frac{ (2k – 1)!!}{(2k)!!} }^2
}.
}
\end{equation}

Observe that this does reduce to \( 2 \pi r \) for the circle (where \( e = 0 \)), and certainly isn’t as nice as \( \pi (a + b) \).

Appendix. Integral of even cosine powers.

The integral

\begin{equation}\label{eqn:elipticCircumference:120}
\int_0^{\pi/2} \cos^{2k} \theta d\theta
\end{equation}

can be evaluated using integration by parts.

\begin{equation}\label{eqn:elipticCircumference:140}
\begin{aligned}
\int_0^{\pi/2} \cos^{2k} \theta d\theta
&=
\int_0^{\pi/2} \cos^{2k-1} \theta \frac{d \sin\theta}{d\theta} d\theta \\
&=
\evalrange{
\cos^{2k-1} \theta \sin\theta
}{0}{\pi/2}

(2 k -1)
\int_0^{\pi/2} \cos^{2k-2} \theta (-\sin\theta) \sin\theta d\theta \\
&=
(2 k -1)
\int_0^{\pi/2} \cos^{2k-2} \theta (1 – \cos^2\theta) d\theta \\
&=
(2 k -1)
\int_0^{\pi/2} \cos^{2k-2} \theta d\theta

(2 k -1)
\int_0^{\pi/2} \cos^{2k} \theta d\theta.
\end{aligned}
\end{equation}

Bringing the \( 2k \) power integral to the other side and solving for the original integral gives a recurrence relation

\begin{equation}\label{eqn:elipticCircumference:160}
\begin{aligned}
\int_0^{\pi/2} \cos^{2k} \theta d\theta
&= \frac{2 k – 1}{2 k}
\int_0^{\pi/2} \cos^{2k -2} \theta d\theta \\
&=
\frac{2 k – 1}{2 k}
\frac{2 k – 3}{2 k – 2}
\int_0^{\pi/2} \cos^{2k -4} \theta d\theta \\
&=
\frac{2 k – 1}{2 k}
\frac{2 k – 3}{2 k – 2}
\cdots
\frac{3}{4}
\int_0^{\pi/2} \cos^{2} \theta d\theta.
\end{aligned}
\end{equation}

This last can also be solved using integration by parts

\begin{equation}\label{eqn:elipticCircumference:180}
\begin{aligned}
\int_0^{\pi/2} \cos^{2} \theta d\theta
&=
\int_0^{\pi/2} \cos \theta \frac{d \sin\theta}{d\theta} d\theta \\
&=

\int_0^{\pi/2} (-\sin \theta) \sin\theta d\theta \\
&=
\int_0^{\pi/2} \lr{ 1 – \cos^2 \theta } d\theta,
\end{aligned}
\end{equation}

or

\begin{equation}\label{eqn:elipticCircumference:200}
\begin{aligned}
\Abs{ \Br – \Bf_{+} } + \Abs{ \Br – \Bf_{-} }
&=
\int_0^{\pi/2} \cos^{2} \theta d\theta \\
&=
\inv{2} \frac{\pi}{2}.
\end{aligned}
\end{equation}

This gives

\begin{equation}\label{eqn:elipticCircumference:220}
\int_0^{\pi/2} \cos^{2k} \theta d\theta
=
\frac{2 k – 1}{2 k}
\frac{2 k – 3}{2 k – 2}
\cdots
\frac{3}{4}
\frac{1}{2}
\frac{\pi}{2}.
\end{equation}

Using the double factorial notation (factorial that skips every other value), this is

\begin{equation}\label{eqn:elipticCircumference:260}
\boxed{
\int_0^{\pi/2} \cos^{2k} \theta d\theta
=
\frac{(2k – 1)!!}{(2k)!!} \frac{\pi}{2}
}
\end{equation}

References

[1] Wikipedia. Ellipse — wikipedia, the free encyclopedia, 2015. URL https://en.wikipedia.org/w/index.php?title=Ellipse&oldid=650116160. [Online; accessed 9-March-2015].

Parallel projection of electromagnetic fields with Geometric Algebra

March 8, 2015 ece1229 , , , ,

[Click here for a PDF of this post with nicer formatting]

When computing the components of a polarized reflecting ray that were parallel or not-parallel to the reflecting surface, it was found that the electric and magnetic fields could be written as

\begin{equation}\label{eqn:gaFieldProjection:280}
\BE = \lr{ \BE \cdot \pcap } \pcap + \lr{ \BE \cdot \qcap } \qcap = E_\parallel \pcap + E_\perp \qcap
\end{equation}
\begin{equation}\label{eqn:gaFieldProjection:300}
\BH = \lr{ \BH \cdot \pcap } \pcap + \lr{ \BH \cdot \qcap } \qcap = H_\parallel \pcap + H_\perp \qcap.
\end{equation}

where a unit vector \( \pcap \) that lies both in the reflecting plane and in the electromagnetic plane (tangential to the wave vector direction) was

\begin{equation}\label{eqn:gaFieldProjection:340}
\pcap = \frac{\kcap \cross \ncap}{\Abs{\kcap \cross \ncap}}
\end{equation}
\begin{equation}\label{eqn:gaFieldProjection:360}
\qcap = \kcap \cross \pcap.
\end{equation}

Here \( \qcap \) is perpendicular to \( \pcap \) but lies in the electromagnetic plane. This logically subdivides the fields into two pairs, one with the electric field parallel to the reflection plane

\begin{equation}\label{eqn:gaFieldProjection:240}
\begin{aligned}
\BE_1 &= \lr{ \BE \cdot \pcap } \pcap = E_\parallel \pcap \\
\BH_1 &= \lr{ \BH \cdot \qcap } \qcap = H_\perp \qcap,
\end{aligned}
\end{equation}

and one with the magnetic field parallel to the reflection plane

\begin{equation}\label{eqn:gaFieldProjection:380}
\begin{aligned}
\BH_2 &= \lr{ \BH \cdot \pcap } \pcap = H_\parallel \pcap \\
\BE_2 &= \lr{ \BE \cdot \qcap } \qcap = E_\perp \qcap.
\end{aligned}
\end{equation}

Expressed in Geometric Algebra form, each of these pairs of fields should be thought of as components of a single multivector field. That is

\begin{equation}\label{eqn:gaFieldProjection:400}
F_1 = \BE_1 + c \mu_0 \BH_1 I
\end{equation}
\begin{equation}\label{eqn:gaFieldProjection:460}
F_2 = \BE_2 + c \mu_0 \BH_2 I
\end{equation}

where the original total field is

\begin{equation}\label{eqn:gaFieldProjection:420}
F = \BE + c \mu_0 \BH I.
\end{equation}

In \ref{eqn:gaFieldProjection:400} we have a composite projection operation, finding the portion of the electric field that lies in the reflection plane, and simultaneously finding the component of the magnetic field that lies perpendicular to that (while still lying in the tangential plane of the electromagnetic field). In \ref{eqn:gaFieldProjection:460} the magnetic field is projected onto the reflection plane and a component of the electric field that lies in the tangential (to the wave vector direction) plane is computed.

If we operate only on the complete multivector field, can we find these composite projection field components in a single operation, instead of working with the individual electric and magnetic fields?

Working towards this goal, it is worthwhile to point out consequences of the assumption that the fields are plane wave (or equivalently far field spherical waves). For such a wave we have

\begin{equation}\label{eqn:gaFieldProjection:480}
\begin{aligned}
\BH
&= \inv{\mu_0} \kcap \cross \BE \\
&= \inv{\mu_0} (-I)\lr{ \kcap \wedge \BE } \\
&= \inv{\mu_0} (-I)\lr{ \kcap \BE – \kcap \cdot \BE} \\
&= -\frac{I}{\mu_0} \kcap \BE,
\end{aligned}
\end{equation}

or

\begin{equation}\label{eqn:gaFieldProjection:520}
\mu_0 \BH I = \kcap \BE.
\end{equation}

This made use of the identity \( \Ba \wedge \Bb = I \lr{\Ba \cross \Bb} \), and the fact that the electric field is perpendicular to the wave vector direction. The total multivector field is

\begin{equation}\label{eqn:gaFieldProjection:500}
\begin{aligned}
F
&= \BE + c \mu_0 \BH I \\
&= \lr{ 1 + c \kcap } \BE.
\end{aligned}
\end{equation}

Expansion of magnetic field component that is perpendicular to the reflection plane gives

\begin{equation}\label{eqn:gaFieldProjection:540}
\begin{aligned}
\mu_0 H_\perp
&= \mu_0 \BH \cdot \qcap \\
&= \gpgradezero{ \lr{-\kcap \BE I} \qcap } \\
&= -\gpgradezero{ \kcap \BE I \lr{ \kcap \cross \pcap} } \\
&= \gpgradezero{ \kcap \BE I I \lr{ \kcap \wedge \pcap} } \\
&= -\gpgradezero{ \kcap \BE \kcap \pcap } \\
&= \gpgradezero{ \kcap \kcap \BE \pcap } \\
&= \BE \cdot \pcap,
\end{aligned}
\end{equation}

so

\begin{equation}\label{eqn:gaFieldProjection:560}
F_1
= (\pcap + c I \qcap ) \BE \cdot \pcap.
\end{equation}

Since \( \qcap \kcap \pcap = I \), the component of the complete multivector field in the \( \pcap \) direction is

\begin{equation}\label{eqn:gaFieldProjection:580}
\begin{aligned}
F_1
&= (\pcap – c \pcap \kcap ) \BE \cdot \pcap \\
&= \pcap (1 – c \kcap ) \BE \cdot \pcap \\
&= (1 + c \kcap ) \pcap \BE \cdot \pcap.
\end{aligned}
\end{equation}

It is reasonable to expect that \( F_2 \) has a similar form, but with \( \pcap \rightarrow \qcap \). This is verified by expansion

\begin{equation}\label{eqn:gaFieldProjection:600}
\begin{aligned}
F_2
&= E_\perp \qcap + c \lr{ \mu_0 H_\parallel } \pcap I \\
&= \lr{\BE \cdot \qcap} \qcap + c \gpgradezero{ – \kcap \BE I \kcap \qcap I } \lr{\kcap \qcap I} I \\
&= \lr{\BE \cdot \qcap} \qcap + c \gpgradezero{ \kcap \BE \kcap \qcap } \kcap \qcap (-1) \\
&= \lr{\BE \cdot \qcap} \qcap + c \gpgradezero{ \kcap \BE (-\qcap \kcap) } \kcap \qcap (-1) \\
&= \lr{\BE \cdot \qcap} \qcap + c \gpgradezero{ \kcap \kcap \BE \qcap } \kcap \qcap \\
&= \lr{ 1 + c \kcap } \qcap \lr{ \BE \cdot \qcap }
\end{aligned}
\end{equation}

This and \ref{eqn:gaFieldProjection:580} before that makes a lot of sense. The original field can be written

\begin{equation}\label{eqn:gaFieldProjection:620}
F = \lr{ \Ecap + c \lr{ \kcap \cross \Ecap } I } \BE \cdot \Ecap,
\end{equation}

where the leading multivector term contains all the directional dependence of the electric and magnetic field components, and the trailing scalar has the magnitude of the field with respect to the reference direction \( \Ecap \).

We have the same structure after projecting \( \BE \) onto either the \( \pcap \), or \( \qcap \) directions respectively

\begin{equation}\label{eqn:gaFieldProjection:660}
F_1 = \lr{ \pcap + c \lr{ \kcap \cross \pcap } I} \BE \cdot \pcap
\end{equation}
\begin{equation}\label{eqn:gaFieldProjection:680}
F_2 = \lr{ \qcap + c \lr{ \kcap \cross \qcap } I} \BE \cdot \qcap.
\end{equation}

The next question is how to achieve this projection operation directly in terms of \( F \) and \( \pcap, \qcap \), without resorting to expression of \( F \) in terms of \( \BE \), and \( \BB \). I’ve not yet been able to determine the structure of that operation.

Resolving fields into components parallel to the reflecting plane

March 6, 2015 ece1229 , , , , ,

[Click here for a PDF of this post with nicer formatting]

In order to apply the Fresnel equations, the field components have to be resolved into components where either the electric field or the magnetic field is parallel to the plane of reflection. The geometry of this, with the wave vector direction \( \kcap \) and the electric and magnetic field phasors perpendicular to that direction is sketched in fig. 1.

resolvingFieldsIncidentOnObliquePlaneFig1

fig. 1. Field components relative to reflecting plane

 

If the incident wave is a plane wave, or equivalently a far field spherical wave, it will have the form

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:20}
\BH = \inv{\mu_0} \kcap \cross \BE,
\end{equation}

with the field directions and wave vector directions satisfying

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:60}
\Ecap \cross \Hcap = \kcap
\end{equation}
\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:80}
\Ecap \cdot \kcap = 0
\end{equation}
\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:100}
\Hcap \cdot \kcap = 0.
\end{equation}

The key to resolving the fields into components parallel to the plane of reflection lies in the observation that the cross product of the plane normal \( \ncap \) and the incident wave vector direction \( \kcap \) lies in that plane. With

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:140}
\pcap = \frac{\kcap \cross \ncap}{\Abs{\kcap \cross \ncap}}
\end{equation}
\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:160}
\qcap = \kcap \cross \pcap,
\end{equation}

the field directions can be resolved into components

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:200}
\BE = \lr{ \BE \cdot \pcap } \pcap + \lr{ \BE \cdot \qcap } \qcap = E_\parallel \pcap + E_\perp \qcap
\end{equation}
\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:220}
\BH = \lr{ \BH \cdot \pcap } \pcap + \lr{ \BH \cdot \qcap } \qcap = H_\parallel \pcap + H_\perp \qcap.
\end{equation}

This subdivides the fields into two pairs, one with the electric field parallel to the reflection plane

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:240}
\begin{aligned}
\BE_1 &= \lr{ \BE \cdot \pcap } \pcap = E_\parallel \pcap \\
\BH_1 &= \lr{ \BH \cdot \qcap } \qcap = H_\perp \qcap,
\end{aligned}
\end{equation}

and one with the magnetic field parallel to the reflection plane

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:260}
\begin{aligned}
\BH_2 &= \lr{ \BH \cdot \pcap } \pcap = H_\parallel \pcap \\
\BE_2 &= \lr{ \BE \cdot \qcap } \qcap = E_\perp \qcap.
\end{aligned}
\end{equation}

This is most of what we need to proceed with the reflection and transmission analysis. The only task remaining is to determine the reflection angle.

Using a pencil with the tip on the table I was able to convince myself by observation that there is always a normal plane of incidence regardless of any oblique angle that the ray hits the reflecting surface. This was, for some reason, not intuitively obvious to me. Having done that, the geometry must be reduced to what is sketched in fig. 2.

resolvingAngleOfIncidenceFig1

fig. 2. Angle of incidence determination

 

Once \( \pcap \) has been determined, regardless of it’s orientation in the reflection plane, the component of \( \kcap \) that is normal, directed towards, the plane of reflection is

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:280}
\kcap – \lr{ \kcap \cdot \pcap } \pcap,
\end{equation}

with (squared) length

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:300}
\begin{aligned}
\lr{ \kcap – \lr{ \kcap \cdot \pcap } \pcap }^2
&=
1 + \lr{ \kcap \cdot \pcap }^2 – 2 \lr{ \kcap \cdot \pcap }^2 \\
&=
1 – \lr{ \kcap \cdot \pcap }^2.
\end{aligned}
\end{equation}

The angle of incidence, relative to the normal to the reflection plane, follows from

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:320}
\begin{aligned}
\cos\theta
&= \kcap \cdot \frac{
\kcap – \lr{ \kcap \cdot \pcap } \pcap }{
\sqrt{
1 – \lr{ \kcap \cdot \pcap }^2
}
} \\
&=
\sqrt{
1 – \lr{ \kcap \cdot \pcap }^2
},
\end{aligned}
\end{equation}

Expanding the dot product above gives

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:360}
\begin{aligned}
\kcap \cdot \pcap’
&=
\kcap \cdot \lr{ \pcap \cross \ncap } \\
&=
\frac{1}{\Abs{\kcap \cross \ncap} } \kcap \cdot \lr{ \lr{\kcap \cross \ncap} \cross \ncap },
\end{aligned}
\end{equation}

where

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:380}
\begin{aligned}
\kcap \cdot \lr{ \lr{\kcap \cross \ncap} \cross \ncap }
&=
k_r \epsilon_{r s t} \lr{\kcap \cross \ncap}_s n_t \\
&=
k_r \epsilon_{r s t} \epsilon_{s a b} k_a n_b n_t \\
&=
-k_r \delta_{r t}^{[a b]} k_a n_b n_t \\
&=
-k_r n_t \lr{ k_r n_t – k_t n_r } \\
&=
-1 + \lr{ \kcap \cdot \ncap}^2.
\end{aligned}
\end{equation}

That gives

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:400}
\begin{aligned}
\kcap \cdot \pcap’
&=
\frac{-1 + \lr{ \kcap \cdot \ncap}^2}{\sqrt{1 – \lr{ \kcap \cdot \ncap}^2} } \\
&=
-\sqrt{1 – \lr{ \kcap \cdot \ncap}^2},
\end{aligned}
\end{equation}

or

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:420}
\begin{aligned}
\cos\theta
&= \sqrt{ 1 – \lr{-\sqrt{1 – \lr{ \kcap \cdot \ncap}^2}}^2 } \\
&= \sqrt{ \lr{ \kcap \cdot \ncap}^2 } \\
&= \kcap \cdot \ncap.
\end{aligned}
\end{equation}

This surprisingly simple result makes so much sense, it is an awful admission of stupidity that I went through all the vector algebra to get it instead of just writing it down directly.

The end result is the reflection angle is given by

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:340}
\boxed{
\theta = \cos^{-1} \kcap \cdot \ncap,
}
\end{equation}

where the reflection plane normal should off the back surface to get the sign right. The only detail left is the vector direction of the reflected ray (as well as the direction for the transmitted ray if that is of interest). The reflected ray direction flips the sign of the normal component of the ray

\begin{equation}\label{eqn:resolvingFieldsIncidentOnPlane:440}
\begin{aligned}
\kcap’
&= -\lr{\kcap \cdot \ncap} \ncap + \lr{ \kcap \wedge \ncap} \ncap \\
&= -\lr{\kcap \cdot \ncap} \ncap + \kcap – \lr{ \ncap \kcap} \cdot \ncap \\
&= \kcap -2 \lr{\kcap \cdot \ncap} \ncap.
\end{aligned}
\end{equation}

Here the sign of the normal doesn’t matter since it only occurs quadratically.

This now supplies everything needed for the application of the Fresnel equations to determine the reflected ray characteristics of an arbitrarily polarized incident field.