Someone reminded me that 40 years ago, when we developed games for the Commodore-64, there were no GPUs. That 8-bit CPUs did not even have a machine instruction for multiplication. And they were dreadfully slow.

Therefore, it was essential to use fast and efficient algorithms for graphics primitives.

One such primitive is Bresenham’s algorithm although back then, I didn’t know it had a name beyond being called a forward differences algorithm. It’s a wonderful, powerful example of an algorithm that produces a circle relying only on integer addition and bitwise shifts; never mind floating point, it doesn’t even need multiplication!

Here’s a C-language implementation for an R=20 circle (implemented in this case as a character map just for demonstration purposes):

#include <stdio.h>
#include <string.h>

#define R 20

void main(void)
{
int x, y, d, dA, dB;
int i;
char B[2*R+1][2*R+2];

memset(B, ' ', sizeof(B));
for (i = 0; i < 2*R+1; i++) B[i][2*R+1] = 0;

x = 0;
y = R;
d = 5 - (R<<2);
dA = 12;
dB = 20 - (R<<3);
while (x<=y)
{
B[R+x][R+y] = B[R+x][R-y] = B[R-x][R+y] = B[R-x][R-y] =
B[R+y][R+x] = B[R+y][R-x] = B[R-y][R+x] = B[R-y][R-x] = 'X';
if (d<0)
{
d += dA;
dB += 8;
}
else
{
y--;
d += dB;
dB += 16;
}
x++;
dA += 8;
}

for (i = 0; i < 2*R+1; i++) printf("%s\n", B[i]);
}

And the output it produces:

                XXXXXXXXX
XXX         XXX
XX               XX
XX                   XX
X                       X
X                         X
X                           X
X                             X
X                               X
X                                 X
X                                 X
X                                   X
X                                   X
X                                     X
X                                     X
X                                     X
X                                       X
X                                       X
X                                       X
X                                       X
X                                       X
X                                       X
X                                       X
X                                       X
X                                       X
X                                     X
X                                     X
X                                     X
X                                   X
X                                   X
X                                 X
X                                 X
X                               X
X                             X
X                           X
X                         X
X                       X
XX                   XX
XX               XX
XXX         XXX
XXXXXXXXX


Don’t tell me it’s not beautiful. And even in machine language, it’s just a few dozen instructions.

I am reading an article in The Globe and Mail, with an attention-grabbing headline: Unvaccinated disproportionately risk safety of those vaccinated against COVID-19, study shows.

Except that the actual study shows no such thing. Nor does it involve actual vaccines or actual people.

What the study shows is that the simple (dare I say, naive) epidemiological model known as the SIR (Susceptible-Infected-Removed) model, when applied to a combination of two (vaccinated vs. unvaccinated) populations, indicates that the presence of the unvaccinated significantly increases the chances of infection among the vaccinated as well.

D’oh. Tell us something we didn’t know.

But the point is, this is a purely theoretical study. The math is elementary. The results are known (in fact, it makes me wonder why this paper was published in the first place; it’s not that it is wrong per se, but it really doesn’t tell us anything we didn’t know simply by looking at the differential equations that characterize the SIR model.) Moreover, the actual nuances of COVID-19 (mutations, limited and waning vaccine efficacy, differences between preventing infection vs. preventing hospitalization, death, or “long COVID” — in other words, all those factors that make CODID-19 tricky, baffling, unpredictable) are omitted.

So what will such a study accomplish? The authors’ point is that the model’s simplicity is a strength, as it also offers transparence and flexibility. I think in actuality, it will just muddy the waters. Those who are opposed to vaccination, especially mandatory vaccination, will call this study bogus and naive, an example of ivory tower theorizing with no solid foundations in reality. Conversely, some of those who are in favor of vaccination will present this paper as “proof” that the unvaccinated are selfish, irresponsible extremists who should be marginalized, ostracized by civilized society.

The Globe and Mail article is already evidence of this viewpoint. A quote from one of the study’s authors serves as a representative example: “In particular, when you have a lot of mixing between vaccinated and unvaccinated people, the unvaccinated people actually get protected by the vaccinated people, who act as a buffer – but that comes at a cost to the vaccinated.”

Does anyone think that pronouncements like these will help convince those who are ideologically opposed to vaccination or bought into the various nonsensical conspiracy theories about the nature, dangers, or efficacy of COVID-19 vaccines, especially mRNA vaccines?

Came across a question tonight: How do you construct the matrix

$$\begin{pmatrix}1&2&…&n\\n&1&…&n-1\\…\\2&3&…&1\end{pmatrix}?$$

Here’s a bit of Maxima code to make it happen:

(%i1) M(n):=apply(matrix,makelist(makelist(mod(x-k+n,n)+1,x,0,n-1),k,0,n-1))\$
(%i2) M(5);
[ 1  2  3  4  5 ]
[               ]
[ 5  1  2  3  4 ]
[               ]
(%o2)                          [ 4  5  1  2  3 ]
[               ]
[ 3  4  5  1  2 ]
[               ]
[ 2  3  4  5  1 ]


I also ended up wondering about the determinants of these matrices:

(%i3) makelist(determinant(M(i)),i,1,10);
(%o3) [1, - 3, 18, - 160, 1875, - 27216, 470596, - 9437184, 215233605, - 5500000000]


I became curious if this sequence of numbers was known, and indeed that is the case. It is sequence number A052182 in the Encyclopedia of Integer Sequences: “Determinant of n X n matrix whose rows are cyclic permutations of 1..n.” D’oh.

As it turns out, this sequence also has another name: it’s the Smarandache cyclic determinant sequence. In closed form, it is given by

$${\rm SCDNS}(n)=(-1)^{n+1}\frac{n+1}{2}n^{n-1}.$$

(%i4) SCDNS(n):=(-1)^(n+1)*(n+1)/2*n^(n-1);
n + 1
(- 1)      (n + 1)   n - 1
(%o4)               SCDNS(n) := (------------------) n
2
(%i5) makelist(determinant(SCDNS(i)),i,1,10);
(%o5) [1, - 3, 18, - 160, 1875, - 27216, 470596, - 9437184, 215233605, - 5500000000]


Surprisingly, apart from the alternating sign it shares the first several values with another sequence, A212599. But then they deviate.

Don’t let anyone tell you that math is not fun.

Move over, general relativity. Solar gravitational lens? Meh. Particle physics and the standard model? Child’s play.

Today, I had to replace the wax ring of a leaky toilet.

Thanks to this YouTube video for some useful advice, helping me avoid some trivial mistakes.

I’ve been finding parallels between the events in Ukraine and 1914 (when Austria-Hungary attacked Serbia), 1938 (when the Western world acquiesced to Hitler’s annexation of the Sudetenland in the hope that it would bring “peace for our times”, to use Chamberlain’s words), 1939 (Hitler’s attack on Poland) and 1943 (Hitler’s historic defeat at Stalingrad.)

But perhaps it’s 1904-1905, when the Russian Empire waged a naval war against the Japanese Empire.

The specifics are different (for starters, the Russo-Japanese war was started by Japan), but the similarities abound: The general expectation was that a major European power, Russia, will easily prevail over the perceived inferiority of an “Asiatic” empire. Instead, Russia was humiliated, and the political backlash directly led to the 1905 revolution, itself a precursor to the 1917 Bolshevik revolution.

And here we are, in 2022, with Russia humiliated again by an enemy that was widely perceived as inferior. Beyond the tactical defeats, the strategic, political blunders are palpable: threats of Russian aggression have not only breathed fresh life into the NATO alliance, but also prompted traditionally (and fiercely) neutral Sweden and Finland to take concrete steps towards NATO membership.

And now, the Moskva. I am not sure but I am beginning to think that this 12,500 ton guided missile cruiser is the largest warship sank by enemy action since WW2. I mean, if this does not reek criminal recklessness and incompetence on behalf of the Russian leadership, both political and military, I don’t know what does.

Does this mean that a revolution is in the works? Are Putin’s days numbered? Perhaps, but I wouldn’t bet on it. And the nuclear wildcard is… there. Perhaps Putin will resort to nukes if all other options fail. Or perhaps a palace revolution widens into civil war, and the world may yet witness the consequences of the first ever nuclear civil war. Whatever happens, I doubt it will be pretty.

Acting as “release manager” for Maxima, the open-source computer algebra system, I am happy to announce that just minutes ago, I released version 5.46.

I am an avid Maxima user myself; I’ve used Maxima’s tensor algebra packages, in particular, extensively in the context of general relativity and modified gravity. I believe Maxima’s tensor algebra capabilities remain top notch, perhaps even unsurpassed. (What other CAS can derive Einstein’s field equations from the Einstein-Hilbert Lagrangian?)

The Maxima system has more than half a century of history: its roots go back to the 1960s, when I was still in kindergarten. I have been contributing to the project for nearly 20 years myself.

Anyhow, Maxima 5.46, here we go! I hope I made no blunders while preparing this release, but if I did, I’m sure I’ll hear about it shortly.

Last week, Hungary’s Orban won a resounding victory in Hungary’s elections.

I was not happy about it, to be honest, and many of my liberal-minded friends were bitterly disappointed.

But a few of them began to look more deeply into the reasons behind this outcome. A recent article* by my friend László Mérő, a Hungarian mathematician and publicist, was illuminating. László decided to volunteer in the elections process as a scrutineer. He ended up in a rural electoral district, where he had a chance to talk to many of the voters who cast their ballots, including both the roughly 30% who voted for the united opposition, but also the majority who chose Orban’s government instead.

His conclusion? There was no fraud. The process was conducted professionally, transparently, and cleanly. The government may dominate traditional media (indeed, this is one of the cardinal sins of Orban’s autocratic government) but the voters were not uninformed. They were aware of the opposition, its message, and its goals. They didn’t favor the government because they were brainwashed. They favored the ruling party because those candidates did a much better job on the ground. They were known to the voters, unlike the fly-by-night opposition.

And anyone who thinks Orban represents some fringe must think again. Just days after his resounding victory (he not only retained, he even increased his two thirds parliamentary supermajority) we were reminded by press releases that CPAC, the Conservative Political Action Conference, was already set to hold its next meeting in Budapest. Orban will be the keynote speaker.

Wait, CPAC? The conference series held by one of the most respectable American conservative organizations, the American Conservative Union, dedicated to the foundations of conservatism, including personal liberty, freedom, and responsible governance?

That’s no fringe.

And, I strongly suspect, at least one of the reasons why Trump, Orban and other “illiberal” leaders and opinion-makers managed to hijack conservatism is that liberalism, in turn, was hijacked by the “woke” culture: a culture that is ready to “cancel” anyone who disagrees with whatever the canonical view of the day happens to be on race, gender, and related issues. I mean, J. K. Rowling? For real?

The fact that it all happens in a geopolitical context, allowing the likes of Putin to use his propaganda machine to try and divide the West even as his murderous horde of ill-equipped, badly led soldiers is rampaging in Ukraine, behaving like the worst of the Nazis (and prodded by Kremlin propaganda outlets to erase Ukrainian national identity) while pretending to “denazify” a country led by a Jewish president, is just the icing on this proverbial cake.

Elections are under way in France today. A possible Le Pen victory might have dramatic consequences.

The news we get from liberated areas of Ukraine are getting grimmer every day.

Army general Mark Milley, the Chairman of the Joint Chiefs of Staff of the United States, America’s highest-ranking military officer, told us in his Congressional testimony today that “we are witness to the greatest threat to the peace and security of Europe and perhaps the world in my 42 years of service in uniform”.

I made up my mind. If we want to preserve at least a tiny chance of keeping this world both peaceful and decent, we must take the Churchillian step of openly and boldly confronting evil.

If I were in charge… I would make Ukraine unconditionally a full-fledged member of NATO, effective immediately, with all the protections of NATO’s Article 5 implied. I would at the same time announce that a large contingent of NATO troops are entering the country, in cooperation with Ukraine’s legitimate, elected government, to guarantee the country’s original (!) borders, yes, including Crimea and Donbass.

And let’s do this while the Russian military is led by the same nincompoops who thought that the most important item for an invading army to carry is dress uniforms, or that digging in the Red Forest, in the world’s most contaminated soil with radioactive fallout, is a smart idea.

Mr. Putin, then, it’s your move. You push your button, we push ours, and the world as we know it ends. But I am betting that you are, in the end, just a worthless coward. Waste of skin.

His followers probably dismiss these as “fake news”, in the wonderful tradition of Joseph Göbbels, Donald Trump and the rest of their heroes.

But we know that these are not fake news. Like this image of a dog not leaving the body of his dead master.

Or how about distressed parents writing their names and contact information on their children’s backs, in case they get separated or killed? When I saw this image, I must admit I felt like I was viciously kicked in the gut.

Putin must answer for these crimes. His followers, his enablers, his supporters must bear responsibility.

Whatever it takes.

Until and unless that happens, this world will not be whole again.

Hungary’s elections are coming to a close. All indications are that not only did Viktor Orban win, he won big: it appears he will retain his two -thirds constitutional supermajority in Hungary’s parliament. Yey-ho, illiberal democracy!

And they had the audacity to campaign as the party of peace: by confronting Putin, they argued, the opposition wants war and it is the government’s cowardly attitude that will somehow save the country from getting bogged down in conflict. (Because, you know, this attitude worked so well in the last major war in Europe, which witnessed Hungary as Hitler’s last ally, deporting over 600,000 of its own citizens to Nazi death camps, and having much of the country destroyed when the frontlines finally reached it in 1944-45.)

Meanwhile, Putin’s popularity in Russia is through the roof: The “Nazis” of Ukraine must be crushed, say people on the streets, and perhaps then Poland is next!

In America, Trump’s followers are regrouping, hoping to take back the House, the Senate, and eventually the White House, lining up behind their authoritarian leader to whom the rule of law means nothing unless it serves his personal interests.

Even here in Canada, all in the name of democracy of course, hundreds of unruly truckers blocked my city for nearly a month, and what is worse, their effort was (and remains) supported by millions. Perhaps still a small minority but still: It is a minority that is supporting a movement that is openly unconstitutional and insurrectionist.

And the sad thing is, we’ve all seen this before. The world went through something eerily similar a century ago. The Bolsheviks were popular in Soviet Russia. Mussolini was popular in Italy. Franco was popular in Spain. Hitler was popular in Germany. Even in places like the US and the UK, the likes of Charles Lindbergh or Oswald Mosley had considerable following.

I could ask the pointless question, why? Social scientists and historians probably offer sensible answers. But that doesn’t help. So long as people, even well-educated people, are willing to believe pseudoscience, ridiculous conspiracy theories, half truths, insinuations, and above all messages of hate: the compulsion to hate (or at least fear or distrust) someone, anyone, be it Ukrainians (or Russians), hate “migrants”, hate liberals, hate homosexuals, hate “others” however their other-ness is defined…

Screw you, world. I’m going back to physics. Just leave me alone, please.

With apologies to the late Dr. Seuss (indeed I have no delusions about my talents as a cartoonist), I felt compelled to make a few, ahem, creative adjustments to one of his classic caricatures, as the message appears just as relevant today as it was more than eight decades ago, when some overly “patriotic” Americans were trying to be BFFs with another murderous tyrant.

The original was published on June 2, 1941. The lessons of history should not be forgotten.