Why you should support Canada’s bill C-51 terrorism bill.

April 15, 2015 Incoherent ramblings , , , , , ,

To my great surprise, the Canadian government’s attempt to enact a terrorize-Canadians bill is actually getting noticed.  There’s even been protests.

For those who find this objectionable, the stopc51 website makes it easy for people to write a form letter to their representative, but what about all those people who want to support this bill? There’s no startc51 website for people to use!

For all those people, I’ve drafted a form letter that they can use, based on the stopc51 form letter. I’m paper mailing my copy of this letter, with the hopes that a paper letter requires slightly more work to throw out. The civil servant who’s job is to press the delete key can file a union grievance against me.

EDIT: I ended up with a response to my original C-51 letter.

Form letter for support of bill C-51.

[your name and address, including postal code]

[date]

cc: [who else should get a copy of your letter?]

The Honourable [representative name here],

I’m writing to call on you to take a firm stand in support of the government’s carefully thought out, harmless, and effective Bill C-51. I’m asking you to side with Canadians and vote for this legislation.

I applaud the Canadian government initiative to exploit the fear-porn potential of the recent parliamentary shooting to its advantage.

The bill is prudent because it turns CSIS into a ‘secret police’ force with little oversight or accountability. Oversight and accountability are both highly overrated. History has proven that secret police forces have been important forces in many effective governments. Without a secret police force Stalin would not have been able to cull so many millions of the excess citizens of his country. Without a secret police force Hitler would not have been able to implement his death camps. In this day of omnipresent globalism Canada clearly needs its own secret police force to remain competitive.

The bill is useful because it opens the door for violations of our Charter Rights including censorship of free expression online. If people are able to express themselves openly, how can they be controlled?

The bill is effective because it will lead to dragnet surveillance and information sharing on innocent Canadians. Stephen Harper, Justin Trudeau or any other current or future politician would love to have such powers available for blackmail and manipulation purposes.

I applaud the government for trying to push this law through parliament in record time without a proper debate. No Canadian wants to see meaningful discussion in government. Reruns of Jerry Springer is clearly sufficient debate for most people. Inhibiting discussion is prudent since questioning authority and the power elite just feeds uncertainty in these difficult times.

If this bill doesn’t pass, it would limit opportunities for the Canadian government to spy on anyone, at any time. No Canadian wants to know when such spying has occurred. We want to create a shadowy and unaccountable secret police force that will have such a critical role in removing the freedoms of a nation that cannot be allowed to question government and authority.

Please, side with the majority of Canadians who are clueless and have never heard of this bill. Please don’t talk about or vote against this important legislation. Assuming you decide to vote for this bill, I hope you also won’t have any part in educate Canadians about this bill. Nobody needs to know what government allows itself to do “in our names.”

I’m one of the millions of Canadians who are perfectly happy with the status quo, which includes politicians who will not represent us in any meaningful way. I am assuming that you will be towing the party line and will vote for this bill. I already know that free expression is not tolerated in government, so when I see an affirmative vote for this bill, I’ll know that the world as I know it is stable and cannot be changed by individual action.

Please don’t respond to this letter. I do not want a response outlining the reasons that you will not be voting for this bill. Such a response would serve to destroy my worldview that assumes no politicians act for nor truly care for their constituents or Canadians in general. I want to continue to view politicians as pawns placed in positions of powerlessness and ineptitude, incapable of altering or even accurately observing the world around them.

Sincerely,

[your name here]

Posting your letter.

Note that mail may be sent postage-free to any Member of parliament at the following address:

Name of Member of Parliament
House of Commons
Ottawa, Ontario
Canada
K1A 0A6

Yes, we still pay for that “free” mail service through taxation, but I’m going to justify my exploitation of that service as a fair exchange for all the time that I have to spend weeding through the huge stacks of junk mail that Canada Post delivers to my mailbox daily.

My last letter to my “representative” (John McCallum) in parliament about bill C-51 went unanswered. I don’t really believe that I am represented by virtue of having voted or not. Will the actions of the Honourable John McCallum of Markham-Unionville surprise me, or make me doubt this position?

EDIT: as noted above, I did get an answer to my original C-51 letter.  It was neutral in tone, and matter of fact, giving no hint of whether or not the bill will be supported.  What sort of response will this letter produce if any?

Some notes on copying and moving text in vim

April 13, 2015 perl and general scripting hackery , ,

Emad just asked me a vim question (how to use a search expression instead of a line number), and I ended up learning a new vim commmand from him as a side effect.

I’d done stuff like the following before to move text to a new file

:,/Done/-1 !cat > /tmp/newfile.txt

This assumes you’d like to delete everything from the current position to the line just before the /Done/ search expression, and write it into /tmp/newfile.txt.

The mechanism here, is that the selection is filtered through a script, where the output of the script is empty, so the lines are deleted. This particular script has the side effect of creating a file with the selected range of lines. The end effect is that the text is moved.

If you’d like to keep it and copy it to the new file, you can tee instead of cat it:

:,/Done/-1 !tee /tmp/newfile.txt

This is faster than selecting a range, switching buffers copying into the buffer, saving, and switching buffers back.

Emad taught me that this can also be done with the w command, like so:

:,/Done/-1 w /tmp/newfile.txt

It doesn’t surprise me that there’s a faster way to copy text from one file to another than using tee, but since I knew one way, I never went looking for it.

Updated notes for ece1229 antenna theory

April 10, 2015 ece1229 , , ,

I’ve now posted a second update of my notes for the antenna theory course that I am taking this term at UofT.

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 which go by faster than I can easily take notes for (and some of which match the textbook closely). In class I have annotated my copy of textbook with little details instead. This set of notes contains 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), as well as some notes Geometric Algebra formalism for Maxwell’s equations with magnetic sources (something I’ve encountered for the first time in any real detail in this class).

This new update includes the following new content:

March 29, 2015 Antenna array design (problem)

March 23, 2015 Antenna array design with Chebychev polynomials (problem)

March 22, 2015 Chebychev antenna design (problem)

Antenna array design with Chebychev polynomials

March 23, 2015 ece1229 , , , ,

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

Prof. Eleftheriades desribed a Chebychev antenna array design method that looks different than the one of the text [1].

Portions of that procedure are like that of the text. For example, if a side lobe level of \( 20 \log_{10} R \) is desired, a scaling factor

\begin{equation}\label{eqn:chebychevSecondMethod:20}
x_0 = \cosh\lr{ \inv{m} \cosh^{-1} R },
\end{equation}

is used. Given \( N \) elements in the array, a Chebychev polynomial of degree \( m = N – 1 \) is used. That is

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

Observe that the roots \( x_n’ \) of this polynomial lie where

\begin{equation}\label{eqn:chebychevSecondMethod:60}
m \cos^{-1} x_n’ = \frac{\pi}{2} \pm \pi n,
\end{equation}

or

\begin{equation}\label{eqn:chebychevSecondMethod:80}
x_n’ = \cos\lr{ \frac{\pi}{2 m} \lr{ 2 n \pm 1 } },
\end{equation}

The class notes use the negative sign, and number \( n = 1,2, \cdots, m \). It is noted that the roots are symmetric with \( x_1′ = – x_m’ \), which can be seen by direct expansion

\begin{equation}\label{eqn:chebychevSecondMethod:100}
\begin{aligned}
x_{m-r}’
&= \cos\lr{ \frac{\pi}{2 m} \lr{ 2 (m – r) – 1 } } \\
&= \cos\lr{ \pi – \frac{\pi}{2 m} \lr{ 2 r + 1 } } \\
&= -\cos\lr{ \frac{\pi}{2 m} \lr{ 2 r + 1 } } \\
&= -\cos\lr{ \frac{\pi}{2 m} \lr{ 2 ( r + 1 ) – 1 } } \\
&= -x_{r+1}’.
\end{aligned}
\end{equation}

The next step in the procedure is the identification

\begin{equation}\label{eqn:chebychevSecondMethod:120}
\begin{aligned}
u_n’ &= 2 \cos^{-1} \lr{ \frac{x_n’}{x_0} } \\
z_n &= e^{j u_n’}.
\end{aligned}
\end{equation}

This has a factor of two that does not appear in the Balanis design method. It seems plausible that this factor of two was introduced so that the roots of the array factor \( z_n \) are conjugate pairs. Since \( \cos^{-1} (-z) = \pi – \cos^{-1} z \), this choice leads to such conjugate pairs

\begin{equation}\label{eqn:chebychevSecondMethod:140}
\begin{aligned}
\exp\lr{j u_{m-r}’}
&=
\exp\lr{j 2 \cos^{-1} \lr{ \frac{x_{m-r}’}{x_0} } } \\
&=
\exp\lr{j 2 \cos^{-1} \lr{ -\frac{x_{r+1}’}{x_0} } } \\
&=
\exp\lr{j 2 \lr{ \pi – \cos^{-1} \lr{ \frac{x_{r+1}’}{x_0} } } } \\
&=
\exp\lr{-j u_{r+1}}.
\end{aligned}
\end{equation}

Because of this, the array factor can be written

\begin{equation}\label{eqn:chebychevSecondMethod:180}
\begin{aligned}
\textrm{AF}
&= ( z – z_1 )( z – z_2 ) \cdots ( z – z_{m-1} ) ( z – z_m ) \\
&=
( z – z_1 )( z – z_1^\conj )
( z – z_2 )( z – z_2^\conj )
\cdots \\
&=
\lr{ z^2 – z ( z_1 + z_1^\conj ) + 1 }
\lr{ z^2 – z ( z_2 + z_2^\conj ) + 1 }
\cdots \\
&=
\lr{ z^2 – 2 z \cos\lr{ 2 \cos^{-1} \lr{ \frac{x_1′}{x_0} } } + 1 }
\lr{ z^2 – 2 z \cos\lr{ 2 \cos^{-1} \lr{ \frac{x_2′}{x_0} } } + 1 }
\cdots \\
&=
\lr{ z^2 – 2 z \lr{ 2 \lr{ \frac{x_1′}{x_0} }^2 – 1 } + 1 }
\lr{ z^2 – 2 z \lr{ 2 \lr{ \frac{x_2′}{x_0} }^2 – 1 } + 1 }
\cdots
\end{aligned}
\end{equation}

When \( m \) is even, there will only be such conjugate pairs of roots. When \( m \) is odd, the remainding factor will be

\begin{equation}\label{eqn:chebychevSecondMethod:160}
\begin{aligned}
z – e^{2 j \cos^{-1} \lr{ 0/x_0 } }
&=
z – e^{2 j \pi/2} \\
&=
z – e^{j \pi} \\
&=
z + 1.
\end{aligned}
\end{equation}

However, with this factor of two included, the connection between the final array factor polynomial \ref{eqn:chebychevSecondMethod:180}, and the Chebychev polynomial \( T_m \) is not clear to me. How does this scaling impact the roots?

Example: Expand \( \textrm{AF} \) for \( N = 4 \).

The roots of \( T_3(x) \) are

\begin{equation}\label{eqn:chebychevSecondMethod:200}
x_n’ \in \setlr{0, \pm \frac{\sqrt{3}}{2} },
\end{equation}

so the array factor is

\begin{equation}\label{eqn:chebychevSecondMethod:220}
\begin{aligned}
\textrm{AF}
&=
\lr{ z^2 + z \lr{ 2 – \frac{3}{x_0^2} } + 1 }\lr{ z + 1 } \\
&=
z^3
+ 3 z^2 \lr{ 1 – \frac{1}{x_0^2} }
+ 3 z \lr{ 1 – \frac{1}{x_0^2} }
+ 1.
\end{aligned}
\end{equation}

With \( 20 \log_{10} R = 30 \textrm{dB} \), \( x_0 = 2.1 \), so this is

\begin{equation}\label{eqn:chebychevSecondMethod:240}
\textrm{AF} = z^3 + 2.33089 z^2 + 2.33089 z + 1.
\end{equation}

With

\begin{equation}\label{eqn:chebychevSecondMethod:260}
z = e^{j (u + u_0) } = e^{j k d \cos\theta + j k u_0 },
\end{equation}

the array factor takes the form

\begin{equation}\label{eqn:chebychevSecondMethod:280}
\textrm{AF}
=
e^{j 3 k d \cos\theta + j 3 k u_0 }
+ 2.33089
e^{j 2 k d \cos\theta + j 2 k u_0 }
+ 2.33089
e^{j k d \cos\theta + j k u_0 }
+ 1.
\end{equation}

This array function is highly phase dependent, plotted for \( u_0 = 0 \) in fig. 1, and fig. 2.

ChebychevSecondMethodPolarFig3pn

fig 1. Plot with u_0 = 0, d = lambda/4

ChebychevSecondMethodSPolarFig4pn

fig 2. Spherical plot with u_0 = 0, d = lambda/4

This can be directed along a single direction (z-axis) with higher phase choices as illustrated in fig. 3, and fig. 4.

 

ChebychevSecondMethodPolarFig1pn

fig 3. Plot with u_0 = 3.5, d = 0.4 lambda

ChebychevSecondMethodSPolarFig2pn

fig 4. Spherical plot with u_0 = 3.5, d = 0.4 lambda

 

These can be explored interactively in this Mathematica Manipulate panel.

References

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

Chebychev antenna array design

March 22, 2015 ece1229 , , , ,

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

In our text [1] is a design procedure that applies Chebychev polynomials to the selection of current magnitudes for an evenly spaced array of identical antennas placed along the z-axis.

For an even number \( 2 M \) of identical antennas placed at positions \( \Br_m = (d/2) \lr{2 m -1} \Be_3 \), the array factor is

\begin{equation}\label{eqn:chebychevDesign:20}
\textrm{AF}
=
\sum_{m=-N}^N I_m e^{-j k \rcap \cdot \Br_m }.
\end{equation}

Assuming the currents are symmetric \( I_{-m} = I_m \), with \( \rcap = (\sin\theta \cos\phi, \sin\theta \sin\phi, \cos\theta ) \), and \( u = \frac{\pi d}{\lambda} \cos\theta \), this is

\begin{equation}\label{eqn:chebychevDesign:40}
\begin{aligned}
\textrm{AF}
&=
\sum_{m=-N}^N I_m e^{-j k (d/2) ( 2 m -1 )\cos\theta } \\
&=
2 \sum_{m=1}^N I_m \cos\lr{ k (d/2) ( 2 m -1)\cos\theta } \\
&=
2 \sum_{m=1}^N I_m \cos\lr{ (2 m -1) u }.
\end{aligned}
\end{equation}

This is a sum of only odd cosines, and can be expanded as a sum that includes all the odd powers of \( \cos u \). Suppose for example that this is a four element array with \( N = 2 \). In this case the array factor has the form

\begin{equation}\label{eqn:chebychevDesign:60}
\begin{aligned}
\textrm{AF}
&=
2 \lr{ I_1 \cos u + I_2 \lr{ 4 \cos^3 u – 3 \cos u } } \\
&=
2 \lr{ \lr{ I_1 – 3 I_2 } \cos u + 4 I_2 \cos^3 u }.
\end{aligned}
\end{equation}

The design procedure in the text sets \( \cos u = z/z_0 \), and then equates this to \( T_3(z) = 4 z^3 – 3 z \) to determine the current amplitudes \( I_m \). That is

\begin{equation}\label{eqn:chebychevDesign:80}
\frac{ 2 I_1 – 6 I_2 }{z_0} z + \frac{8 I_2}{z_0^3} z^3 = -3 z + 4 z^3,
\end{equation}

or

\begin{equation}\label{eqn:chebychevDesign:100}
\begin{aligned}
\begin{bmatrix}
I_1 \\
I_2
\end{bmatrix}
&=
{\begin{bmatrix}
2/z_0 & -6/z_0 \\
0 & 8/z_0^3
\end{bmatrix}}^{-1}
\begin{bmatrix}
-3 \\
4
\end{bmatrix} \\
&=
\frac{z_0}{2}
\begin{bmatrix}
3 (z_0^2 -1) \\
z_0^2
\end{bmatrix}.
\end{aligned}
\end{equation}

The currents in the array factor are fully determined up to a scale factor, reducing the array factor to

\begin{equation}\label{eqn:chebychevDesign:140}
\textrm{AF} = 4 z_0^3 \cos^3 u – 3 z_0 \cos u.
\end{equation}

The zeros of this array factor are located at the zeros of

\begin{equation}\label{eqn:chebychevDesign:120}
T_3( z_0 \cos u ) = \cos( 3 \cos^{-1} \lr{ z_0 \cos u } ),
\end{equation}

which are at \( 3 \cos^{-1} \lr{ z_0 \cos u } = \pi/2 + m \pi = \pi \lr{ m + \inv{2} } \)

\begin{equation}\label{eqn:chebychevDesign:160}
\cos u = \inv{z_0} \cos\lr{ \frac{\pi}{3} \lr{ m + \inv{2} } } = \setlr{ 0, \pm \frac{\sqrt{3}}{2 z_0} }.
\end{equation}

showing that the scaling factor \( z_0 \) effects the locations of the zeros. It also allows the values at the extremes \( \cos u = \pm 1 \), to increase past the \( \pm 1 \) non-scaled limit values. These effects can be explored in this Mathematica notebook, but can also be seen in fig. 1.

ChebyChevThreeScaledFig2pn

fig 1. T_3( z_0 x) for a few different scale factors z_0.

 

The scale factor can be fixed for a desired maximum power gain. For \( R
\textrm{dB} \), that will be when

\begin{equation}\label{eqn:chebychevDesign:180}
20 \log_{10} \cosh( 3 \cosh^{-1} z_0 ) = R \textrm{dB},
\end{equation}

or

\begin{equation}\label{eqn:chebychevDesign:200}
z_0 = \cosh \lr{ \inv{3} \cosh^{-1} \lr{ 10^{\frac{R}{20}} } }.
\end{equation}

For \( R = 30 \) dB (say), we have \( z_0 = 2.1 \), and

\begin{equation}\label{eqn:chebychevDesign:220}
\textrm{AF}
= 40 \cos^3 \lr{ \frac{\pi d}{\lambda} \cos\theta } – 6.4 \cos \lr{ \frac{\pi d}{\lambda} \cos\theta }.
\end{equation}

These are plotted in fig. 2 (linear scale), and fig. 3 (dB scale) for a couple values of \( d/\lambda \).

ChebychevT3FittingFig3pn

fig 2. T_3 fitting of 4 element array (linear scale).

ChebychevT3FittingDbFig4pn

fig 3. T_3 fitting of 4 element array (dB scale).

To explore the \( d/\lambda \) dependence try this Mathematica notebook.

References

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