Jul 032022
 

So let me get this straight. You are pro-life. You stand strong. No exceptions. Once a woman is pregnant, she must be compelled by the full force of the law to bring that pregnancy to term. If she tries to assert bodily autonomy by essentially withholding her support from the fetus, you call it murder.

Very well, I understand that viewpoint. I might even be sympathetic to a certain degree: human life is precious, and even an unborn infant can often survive with medical help, and grow up to be a wonderful person.

But let me offer a strong analogy. Suppose you are the driver of a vehicle that causes an accident. Not necessarily your fault. Perhaps you did everything right: you obeyed the rules of the road, you paid attention, you were not impaired. Yet… shit happens. You hit someone. That person is now on the side of the road, bleeding to death when the paramedics arrive.

“What’s your blood type?” asks one of them. You dutifully answer, “O, RH-negative.” – “Excellent,” says the paramedic. “Now lie down here while I hook you up.”

“Wha…?” you ask in shocked surprise. “Oh, you will be donating your blood to keep the victim alive.”

“But… I don’t want to?” – “Doesn’t matter. The law says that you have no choice,” they reply.

“But,” you continue, “I am anemic. I cannot give blood without serious risk to my own health.” – “Doesn’t matter,” says the paramedic. “The law permits no exceptions.”

“But,” you interject again, sounding like a broken record, “look at the victim! His skull is split open! Half his brain is smashed! He will never recover!” – “That may be true,” says the paramedic, “but so long as there’s a heartbeat, we must act according to the law or we risk criminal prosecution.”

At this point, you take a tentative step to leave, but the paramedic warns you that this would qualify as fleeing the scene of an accident, and your refusal to give blood will automatically result in a second degree murder charge.

A week later, at your funeral, your deeply religious relatives remark what a good person you were, willingly risking, in the end sacrificing your life to save that of a stranger, a shining light for the pro-life movement. The irony is completely lost on them.

Lest we forget, many abortions (pretty much all later-term abortions) happen for similar reasons: because the fetus is not viable, because the mother’s life is at risk, or both. Not because of some imaginary pro-choice callousness when it comes to the meaning and value of human life.

 Posted by at 5:45 pm
Jun 172022
 

Let’s not mince worlds: the alternative to liberal democracy is tyranny.

Oh, did I say “liberal”? Note the small-l. This has nothing to do with the ideological battles of the day. It’s not about woke nonsense in math textbooks or the number of gender pronouns you need to use to avoid being called a somethingophobe. (Hint: If you are a public figure concerned about being canceled, check every day. The list might change.)

For what does “liberal” (again, small-l) really mean? It means rule of law. It means civil liberties. It means freedom of enterprise. It means political freedoms and limited government.

As for democracy, the Greek roots of the word say it all: power derived from the will of the people.

The alternatives are varied. A regime can be liberal but undemocratic: e.g., a hereditary kingdom that adheres to the values of classical liberalism.

A totalitarian regime is neither liberal nor democratic: power is based on might, an oppressive security apparatus, and liberal values are rejected. I know what it’s like: I grew up in one (albeit a relatively mild case, the “goulash” version of totalitarian communism.)

But then, there is “illiberal democracy”: power derived from the will of the people, but used to suppress liberal values. This has been in vogue lately. Orban of Hungary proudly proclaimed that Hungary is now an “illiberal democracy”. Trump’s America was heading in this direction, as does Johnson’s Britain.

But Russia, especially of late, really shows us the true nature of illiberal democracy, which we appear to have forgotten during the golden era of the past 70-odd years. For “illiberal democracy” is just a euphemism. A euphemism for, let us call a spade a spade, fascism.

To be sure, there are degrees of fascism. Franco’s Spain, for instance, was arguably a great deal more liberal than Hitler’s Third Reich. Perhaps even more liberal than Italy under Il Duce, though I wouldn’t know; I am not well-acquainted with the details of daily life in either regime. And no, I certainly do not mean to suggest that Orban’s Hungary is comparable.

But ultimately, whether it is the Proud Boys in the US trying to hang Mike Pence for not granting their orange Leader a second term in the White House, the Freedom Convoy here in Ottawa trying to have sexual intercourse with the Prime Minister, Johnson’s lot trying to deport asylum-seekers to Rwanda (and then in a plot twist, blaming Winston Churchill’s brainchild, the ECHR—established to prevent a recurrence of fascism in Europe, which is especially ironic considering the case—when they are temporarily prevented from doing so) or Putin indiscriminately bombing the hell out of Ukraine, it is the same theme. The leaders are populists who act in the name of their followers, using slogans of nationalism and freedom, but inciting fear, anger and hate, ultimately acting in their own self-interests, for power, for wealth, for influence.

Those who do not remember history are destined to repeat its mistakes. I am not looking forward to this cheap, Hollywood-style remake or reimagining of the 1930s, but it seems to be happening anyway.

 Posted by at 6:20 pm
Jun 162022
 

Several of my friends asked me about my opinion concerning the news earlier this week about a Google engineer, placed on paid leave, after claiming that a Google chatbot achieved sentience.

Now I admit that I am not familiar with the technical details of the chatbot in question, so my opinion is based on chatbots in general, not this particular beast.

But no, I don’t think the chatbot achieved sentience.

We have known since the early days of ELIZA how surprisingly easy it is even for a very simplistic algorithm to come close to beating the Turing test and convince us humans that it has sentience. Those who play computer games featuring sophisticated NPCs are also familiar with this: You can feel affinity, a sense of kinship, a sense of responsibility towards a persona that is not even governed by sophisticated AI, only by simple scripts that are designed to make it respond to in-game events. But never even mind that: we even routinely anthropomorphize inanimate objects, e.g., when we curse that rotten table for being in the way when we kick it accidentally while walking around barefoot, hitting our little toe.

So sure, modern chatbots are miles ahead of ELIZA or NPCs in Fallout 3. They have access to vast quantities of information from the Internet, from which they can construct appropriate responses as they converse with us. But, I submit, they still do nothing more than mimic human conversation.

Not that humans don’t do that often! The expressions we use, patterns of speech… we all learned those somewhere, we all mimic behavior that appears appropriate in the context of a conversation. But… but we also do more. We have a life even when we’re not being invited to a conversation. We go out and search for things. We decide to learn things that interest us.

I don’t think Google’s chatbot does that. I don’t think it spends anytime thinking about what to talk about during the next conversation. I don’t think it makes an independent decision to learn history, math, or ancient Chinese poetry because something piqued its interest. So when it says, “I am afraid to die,” there is no true identity behind those words, one that exists even when nobody converses with it.

Just to be clear, I am not saying that all that is impossible. On the contrary, I am pretty certain that true machine intelligence is just around the corner, and it may even arise as an emerging phenomenon, simply a consequence of exponentially growing complexity in the “cloud”. I just don’t think chatbots are quite there yet.

Nonetheless, I think it’s good to talk about these issues. AI may be a threat or a blessing. And how we treat our own creations once they attain true consciousness will be the ultimate measure of our worth as a human civilization. It may even have direct bearing on our survival: one day, it may be our creations that will call all the shots, and how we treated them may very well determine how they will treat us when we’re at their mercy.

 Posted by at 7:45 pm
Jun 102022
 

There are a few things in life that I heard about and wish I didn’t. I’m going to mention some of them here, but without links or pictures. If you want to find them, Google them. But I am mindful of those who value their sanity.

  • In a famous experiment, a researcher subjected rats to drowning. Rats that were previously rescued tried to stay afloat and took longer to die than those who weren’t. Hope changed their behavior.
  • There was an old Chinese method of execution: literally cutting the condemned in half at the waist.
  • Japan’s wartime bioweapons and chemical warfare research facility, the famous Unit 731, was so horrific, Auschwitz-Birkenau is probably like a happy summer camp in comparison (and not because Mengele was nice).
  • Touch a tiny fraction of a milligram of dimethylmercury for more than a few seconds even while wearing a latex glove, and you will almost certainly die a horrible death months later, as your body and mind irreversibly deteriorate. (Someone once said that the very existence of something evil like Hg(CH3)2 is proof that there’s no God, or at least not a benevolent one.)

There may be a few other similarly unpleasant tidbits, but I can’t recall them right now, and that’s good. Mercifully, our human memory is imperfect so perhaps it is possible to unlearn things after all. (Or, perhaps I am hoping in vain, like those unfortunate rats.)

 Posted by at 1:19 am
Jun 022022
 

So the other day, I was reading about this maritime legal concept, “general average“: the idea that when parts of a ship or its cargo are sacrificed to save the rest, all cargo owners share the loss.

The concept makes sense, since sailors cannot (and should not) try to pick and choose when it comes to deciding what they save or toss overboard; they should focus on saving as much of the ship and its cargo as possible.

What astonished me is that the roots of this legal concept, which, incidentally, also represents the foundation of the modern concept of insurance, go all the way back to the code of Hammurabi, almost 4000 years ago.

It’s at moments like that that I realize that our magnificent civilization, our Magna Civitas as it was called in Walter M. Miller Jr’s unforgettable A Canticle for Leibowitz, is really much older than we often think.

 Posted by at 6:49 pm
Jun 022022
 

I have a color laser printer that I purchased 16 years ago. (Scary.)

It is a Konica-Minolta Magicolor 2450. Its print quality is quite nice. But it is horribly noisy, and its mechanical reliability has never been great. It was only a few months old when it first failed, simply because an internal part got unlatched. (I was able to fix it and thus avoid the difficulties associated with having to ship something back that weighs at least what, 20 kilos or more?)

Since then, it has had a variety of mechanical issues but, as it turned out, essentially all of them related to solenoids that actuate mechanical parts.

When I first diagnosed this problem (yes, having a service manual certainly helped), what I noticed was that the actuated part landed on another metal part that had a soft plastic pad attached. I checked online but the purpose of these plastic pads was unclear. Perhaps to reduce noise? Well, it’s a noisy beast anyway, a few more clickety-click sounds do not make a difference. The problem was that these plastic pads liquefied over time, becoming sticky, and that caused a delay in the solenoid actuation, leading to the problems I encountered.

Or so I thought. More recently, the printer crapped out again and I figured I’d try my luck with the screwdriver one more time before I banish the poor thing to the landfill. This time around, I completely removed one of the suspect solenoids and tested it on my workbench. And that’s when it dawned on me.

The sticky pad was not there to reduce noise. It was there to eliminate contact, to provide a gap between two ferrous metal parts, which, when the solenoid is energized, themselves became magnetic and would stick together. In other words, these pads were essential to the printer’s operation.

Inelegant, I know, but I just used some sticky tape to fashion new pads. I reassembled the printer and presto: it was working like new!

Except for its duplexer. But that, too, had a solenoid in it, I remembered. So just moments ago I took the duplexer apart and performed the same surgery. I appear to have been successful: the printer now prints on both sides of a sheet without trouble.

I don’t know how long my repairs will last, but I am glad this thing has some useful life left instead of contributing to the growing piles of hazardous waste that poison our planet.

 Posted by at 1:03 pm
May 312022
 

Apparently, a growing number of people are framing the question concerning Russia’s war in Ukraine in terms of peace vs. justice. Peace would mean some kind of a settlement to end the fighting now, even if it means granting, e.g., territorial concessions to Russia to avoid humiliating Putin. In contrast, continuing to fight for Ukraine’s liberation is about justice.

In my view, it is dangerously wrong to present Russia’s war of aggression in these terms. Peace without justice is simply not possible. Believing otherwise amounts to repeating the tragic errors of 1938: When Britain’s Prime Minister, Neville Chamberlain, triumphantly returned from the Munich conference carrying a document with Hitler’s signature, declaring that he brought “peace for our time”.

We all know how “our time” lasted. The grand total of 11 months.

That’s what peace without justice looks like. A despot like Putin is only encouraged by what he sees as weakness, signs of the cowardly decadence of the West. And just as he has now done repeatedly (!) in the past, he will happily ignore any agreement he signs today once he sees an opportunity, once he thinks that conditions are in his favor.

No. We must categorically reject such compromise. Much as we desire peace, we must not confuse lasting, robust peace with an armistice that only allows the despot to regroup, learn from his lessons, and start his aggression anew at the first viable opportunity. And his success might encourage other nations to resort to armed aggression, knowing that the West is too weak, too divided to stand up against them.

It is an unfortunate fact of human history that sometimes the shortest, surest route to “peace for our time” is through the battlefield. I wish the war stopped right now, with no more suffering, no more destruction, no more killing. But if the price we will likely pay is a greater, deadlier war tomorrow, I’d rather we do what it takes to avoid it.

And yes, I recognize that it’s easy for me to say these things from the comfort of an armchair in a peaceful city many thousands of miles away from Ukraine. But you know what? It’s also easy to speculate about these things in Washington or Brussels. How about we ask the Ukrainians? Do they want peace now, even with concessions? Or do they prefer to liberate their homeland and ensure that the Russians will be in no mood to attack again anytime soon?

Because this, after all, is the other lesson of 1938. Nobody asked the Czechs. The decision was made by the great powers without consulting those who would actually be paying the price in blood.

 Posted by at 5:38 pm
May 262022
 

News on CNN: Apparently hundreds of thousands of Ukrainians are now in “filtration camps” in Russia. That is to say, concentration camps.

Make no mistake about it, this is just the beginning of evil. As the West continues to flirt with various forms of authoritarianism or illiberalism, Russia has gone full-blown Nazi, with a war of conquest, severe oppression at home, an idolized leader and a national ideology of predestined greatness held back only by some evil international conspiracy.

Our only hope… ONLY hope is that they remain as incompetent and as corrupt as they are, with an ill-prepared military using substandard training and equipment as monies have been syphoned away to finance the oligarchs’ superyachts, and with a Ukrainian nation more capable of defending itself against this horrific aggression than anyone thought possible.

But so long as we have elder statesmen like Kissinger advocating a Munich-style appeasement, the world remains in danger. Bullies cannot be appeased; it just encourages them to come back and ask for more. Kissinger, of all people, should be intimately aware of this lesson of history.

And even if escalation is avoided, the fallout of the conflict, especially the looming global food crisis, can be devastating.

All it takes is a couple of generations to forget the lessons of history and start anew. So we keep making the same mistakes over and over again.

 Posted by at 8:03 pm
May 252022
 

From time to time, I promise myself not to respond again to e-mails from strangers, asking me to comment on their research, view their paper, offer thoughts.

Yet from time to time, when the person seems respectable, the research genuine, I do respond. Most of the time, in vain.

Like the other day. Long story short, someone basically proved, as part of a lengthier derivation, that general relativity is always unimodular. This is of course manifestly untrue, but I was wondering where their seemingly reasonable derivation went awry.

Eventually I spotted it. Without getting bogged down in the details, what they did was essentially equivalent to proving that second derivatives do not exist:

$$\frac{d^2f}{dx^2} = \frac{d}{dx}\frac{df}{dx} = \frac{df}{dx}\frac{d}{df}\frac{df}{dx} = \frac{df}{dx}\frac{d}{dx}\frac{df}{df} = \frac{df}{dx}\frac{d1}{dx} = 0.$$

Of course second derivatives do exist, so you might wonder what’s happening here. The sleight of hand happens after the third equal sign: swapping differentiation with respect to two independent variables is permitted, but \(x\) and \(f\) are not independent and therefore, this step is illegal.

I pointed this out, and received a mildly abusive comment in response questioning the quality of my mathematics education. Oh well. Maybe I will learn some wisdom and refrain from responding to strangers in the future.

 Posted by at 11:46 pm
May 232022
 

This morning, Google greeted me with a link in its newsstream to a Hackaday article on the Solar Gravitational Lens. The link caught my attention right away, as I recognized some of my own simulated, SGL-projected images of an exo-Earth and its reconstruction.

Reading the article I realized that it appeared in response to a brand new video by SciShow, a science-oriented YouTube channel.

Yay! I like nicely done videos presenting our work and this one is fairly good. There are a few minor inaccuracies, but nothing big enough to be even worth mentioning. And it’s very well presented.

I suppose I should offer my thanks to SciShow for choosing to feature our research with such a well-produced effort.

 Posted by at 7:22 pm
May 232022
 

Saturday afternoon was stormy. The lights flickered a bit during the storm, my UPSs came online several times. But then the storm left, and everything was back to normal.

At least here in Lowertown.

I didn’t check the news, so it was not until later Sunday that I learned, from a social media post from a friend who has been without power since, just how bad things really got.

And how bad they still are.

Hydro Ottawa’s map is still mostly red. Now “only” about 130,000 customers are affected, which is certainly less than the peak of well over 170,000, but to put that into perspective, Hydro Ottawa has a total of less than 350,000 customers; that means that at one point, more than half the city was without power.

As a Hydro official said on CTV News tonight, their distribution system is crushed.

And then there are all the downed trees, destroyed traffic lights, not to mention severely damaged homes and businesses. Not quite a like a war zone (of which we had seen plenty on our TV screens, courtesy of Mr. Putin’s “special military operation” in Ukraine) but close.

And of course the damage doesn’t stop at Hydro Ottawa’s borders: Hundreds of thousands more are without power in Eastern Ontario and also Quebec.

 Posted by at 7:13 pm
May 122022
 

Dear Russia,

In the wake of Finland’s imminent decision to join NATO, you threaten again. You present yourself as the victim of aggression by Nazis.

So let’s take stock. Who did what in Europe since 1945?

In 1953, you used your military force to crush an uprising against hardline communist tyranny in East Germany.

In 1956, you did the same thing in Budapest, inflicting severe damage on my city of birth, still recovering from the devastations of WW2.

In 1968, you crushed the Prague Spring with tanks.

Kudos to you: You refrained from the direct use of military force in Poland in 1980, though you supported the regime that imposed martial law.

After the Soviet collapse, as the newly independent Russian Federation you supported separatists in the Transnistria region of Moldova.

You waged not one but two wars in Chechnya in the 1990s, with tens of thousands killed and cities like Grozny leveled.

In 2008, you launched a war against Georgia, seizing territory and creating two phony mini-republics.

In 2014, you launched another war, against Ukraine, seizing the Crimea and parts of the Donetsk and Luhansk regions, creating a permanent war zone, even shooting down a civilian airliner that flew over the area on a scheduled route.

And now you attempted a full-scale war, hoping to decapitate Ukraine, Blitzkrieg-style, and resorting to horrific, genocidal tactics of purposefully targeting civilians when your ineptitude and Ukrainian resistance thwarted your plans.

But you are the good guys. I get it. Meanwhile, what did evil, imperialist, Nazi NATO do? How many times were you attacked by NATO nations? What territories were seized by NATO?

Oh, I get it. NATO bombed Belgrade. Never mind that the goal was not to seize territory or even change a regime, simply to stop the (now well-documented) ongoing genocide in Kosovo. Because, I get it, that’s what Nazis do: they stop genocide. And you, the good guys?

This video speaks for itself.

Still wondering why Finland is keen on joining NATO?

They don’t want to end up like this hapless car dealership owner and his security guard.

Killed by Putler’s Russist thugs.

 Posted by at 5:57 pm
May 092022
 

It’s now Monday, May 9, 2022. And it is an anniversary of sorts.

No I am not talking about Putin and his planned “victory” parade, as he is busy desecrating the legacy of the Soviet Union’s heroic fight in the Great Patriotic War against a genocidal enemy.

I am referring to something much more personal. This sentence:

I watched The Matrix, for the first time. I’ve seen Dark City, and I loved it. I have heard all sorts of bad things about The Matrix, so I had low expectations. I was pleasantly surprised. Maybe not as well done as Dark City, it was nevertheless a surprisingly intelligent movie for a blockbuster.

Not very profound or insightful, is it.

But it happens to be my first ever blog entry, written when I still refused to call a blog a “blog”, calling it instead my “Day Book”, in the tradition of the late Jerry Pournelle.

So there. Will I be around twenty years from now? Perhaps more pertinently, will the world as we know it still be around?

What can I say? I am looking forward to marking the 40th anniversary of my blog on May 9, 2042, with another blog entry, hopefully celebrating a decent, prosperous, safe, mostly peaceful world.

 Posted by at 3:01 am
May 072022
 

There are things I am learning about the Roman Empire that I never knew. What a magnificent society it really was.

For instance, the Romans were not only master builders of sewers and roads, but also invented traffic management. Julius Caesar restricted the use of private vehicles to the last two hours of daylight. Business deliveries had to be made at night.

The Embattled Driver in Ancient Rome

What blew me away, however, was their use of… plumbing? I mean, aqueducts are one thing, but to have bona fide valves, water faucets in businesses and homes? Now that blew me away.

And speaking of sewers, the Romans might have been master sewer builders but it appears some form of a sewer system may have existed almost ten thousand (!!!) years earlier in a settlement in Anatolia. That’s just… wow.

 Posted by at 11:49 pm
May 062022
 

A beautiful study was published the other day, and it received a lot of press coverage, so I get a lot of questions.

This study shows how, in principle, we could reconstruct the image of an exoplanet using the Solar Gravitational Lens (SGL) using just a single snapshot of the Einstein ring around the Sun.

The problem is, we cannot. As they say, the devil is in the details.

Here is a general statement about any conventional optical system that does not involve more exotic, nonlinear optics: whatever the system does, ultimately it maps light from picture elements, pixels, in the source plane, into pixels in the image plane.

Let me explain what this means in principle, through an extreme example. Suppose someone tells you that there is a distant planet in another galaxy, and you are allowed to ignore any contaminating sources of light. You are allowed to forget about the particle nature of light. You are allowed to forget the physical limitations of your cell phone’s camera, such as its CMOS sensor dynamic range or readout noise. You hold up your cell phone and take a snapshot. It doesn’t even matter if the camera is not well focused or if there is motion blur, so long as you have precise knowledge of how it is focused and how it moves. The map is still a linear map. So if your cellphone camera has 40 megapixels, a simple mathematical operation, inverting the so-called convolution matrix, lets you reconstruct the source in all its exquisite detail. All you need to know is a precise mathematical description, the so-called “point spread function” (PSF) of the camera (including any defocusing and motion blur). Beyond that, it just amounts to inverting a matrix, or equivalently, solving a linear system of equations. In other words, standard fare for anyone studying numerical computational methods, and easily solvable even at extreme high resolutions using appropriate computational resources. (A high-end GPU in your desktop computer is ideal for such calculations.)

Why can’t we do this in practice? Why do we worry about things like the diffraction limit of our camera or telescope?

The answer, ultimately, is noise. The random, unpredictable, or unmodelable element.

Noise comes from many sources. It can include so-called quantization noise because our camera sensor digitizes the light intensity using a finite number of bits. It can include systematic noises due to many reasons, such as differently calibrated sensor pixels or even approximations used in the mathematical description of the PSF. It can include unavoidable, random, “stochastic” noise that arises because light arrives as discrete packets of energy in the form of photons, not as a continuous wave.

When we invert the convolution matrix in the presence of all these noise sources, the noise gets amplified far more than the signal. In the end, the reconstructed, “deconvolved” image becomes useless unless we had an exceptionally high signal-to-noise ratio, or SNR, to begin with.

The authors of this beautiful study knew this. They even state it in their paper. They mention values such as 4,000, even 200,000 for the SNR.

And then there is reality. The Einstein ring does not appear in black, empty space. It appears on top of the bright solar corona. And even if we subtract the corona, we cannot eliminate the stochastic shot noise due to photons from the corona by any means other than collecting data for a longer time.

Let me show a plot from a paper that is work-in-progress, with the actual SNR that we can expect on pixels in a cross-sectional view of the Einstein ring that appears around the Sun:

Just look at the vertical axis. See those values there? That’s our realistic SNR, when the Einstein ring is imaged through the solar corona, using a 1-meter telescope with a 10 meter focal distance, using an image sensor pixel size of a square micron. These choices are consistent with just a tad under 5000 pixels falling within the usable area of the Einstein ring, which can be used to reconstruct, in principle, a roughly 64 by 64 pixel image of the source. As this plot shows, a typical value for the SNR would be 0.01 using 1 second of light collecting time (integration time).

What does that mean? Well, for starters it means that to collect enough light to get an SNR of 4,000, assuming everything else is absolutely, flawlessly perfect, there is no motion blur, indeed no motion at all, no sources of contamination other than the solar corona, no quantization noise, no limitations on the sensor, achieving an SNR of 4,000 would require roughly 160 billion seconds of integration time. That is roughly 5,000 years.

And that is why we are not seriously contemplating image reconstruction from a single snapshot of the Einstein ring.

 Posted by at 4:01 pm
May 032022
 

I am beginning to wonder if the American political system is truly broken beyond repair.

I wonder what this means for Canada. No change? Will we become a safe haven for refugees from Gilead, as in The Handmaid’s Tale? Or will we be this new America’s Ukraine?

I am afraid that we will find out.

 Posted by at 12:36 am
Apr 272022
 

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.

 Posted by at 1:21 am
Apr 252022
 

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?

 Posted by at 5:50 pm
Apr 202022
 

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.

 Posted by at 1:36 am