Apr 022016

Sometime last year, I foolishly volunteered to manage new releases of the Maxima computer algebra system (CAS).

For the past several weeks, I’ve been promising to do my first release, but I kept putting it off as I had other, more pressing work obligations.

Well, not anymore… today, I finally found the time, after brushing up on the Git version management system, and managed to put together a release, 5.38.0.


Maxima is beautiful and incredibly powerful. I have been working on its tensor algebra packages for the past 15 years or so. As far as I know, Maxima is the only general purpose CAS that can derive the field equations of a Lagrangian field theory; for instance, it can derive Einstein’s field equations from the Einstein-Hilbert Lagrangian.

I use Maxima a lot for tensor algebra, though I admit that when it comes to integration, differential equations or plotting, I prefer Maple. Maple’s ODE/PDE solvers are unbeatable. But when it comes to tensor algebra, or just as a generic on-screen symbolic calculator, Maxima wins hands down. I prefer to use its command-line version: Nothing fancy, just ASCII art, but very snappy, very responsive, and does exactly what I want it to do.

So then, Maxima 5.38.0: Say hi to the world. World, this is the latest version of the oldest (nearly half a century old) continuously maintained CAS in existence.

 Posted by at 9:31 pm
Jun 182015

Having just finished work on a major project milestone, I took it easy for a few days, allowing myself to spend time thinking about other things. That’s when I encountered an absolutely neat problem on Quora.


Someone asked a seemingly innocuous number theory question: are there two positive integers such that one is exactly the π-th power of the other?

Now wait a minute, you ask… We know that π is a transcendental number. How can an integer raised to a transcendental power be another integer?

But then you think about \(\alpha=\log_2 3\) and realize that although \(\alpha\) is a transcendental number, \(2^\alpha=3\). So why can’t we have \(n^\pi=m\), then?

As it turns out, we (probably) cannot, but the reason is subtle and it relies on a very important, but unproven conjecture from transcendental number theory.

But first, let us rewrite the equation by taking its logarithm:

$$\pi\log n = \log m.$$

We can also divide both sides by \(\log n\), which leads to

$$\pi = \frac{\log m}{\log n}=\log_n m,$$

but it turns out to be not very helpful. However, squaring the equation will help, as we shall shortly see:

$$\pi^2\log^2 n=\log^2 m.$$

Can this equation ever by true for positive integers \(n\) and \(m\), other than the trivial solution \(n=m=1\), that is?

To see why it cannot be the case, let us consider the following triplet of numbers:

$$(i\pi,\log n,\log m),$$

and their exponents,

$$(e^{i\pi}=-1, e^{\log n}=n, e^{\log m}=m).$$

The three numbers \((i\pi,\log n,\log m)\) are linearly independent over \({\mathbb Q}\) (that is, the rational numbers). What this means is that there are no rational numbers \(A, B, C, D\) such that \(Ai\pi+B\log n+C\log m + D=0\). This is easy to see as the ratio of \(\log n\) and \(\log m\) is supposed to be transcendental but both numbers are real, whereas \(i\pi\) is imaginary.

On the other hand, their exponents are all rational numbers (\(-1, n, m\)). And this is where the unproven conjecture, Schanuel’s conjecture, comes into the picture. Schanuel’s conjecture says that given \(n\) complex numbers \((\alpha_1,\alpha_2,…,\alpha_n)\) that are linearly independent over the rationals, out of the \(2n\) numbers \((\alpha_1,…,\alpha_n,e^{\alpha_1},…,e^{\alpha_n})\), at least \(n\) will be transcendental numbers that are algebraically independent over \({\mathbb Q}\). That is, there is no algebraic expression involving roots and powers of the \(\alpha_i\), \(e^{\alpha_i}\), and rational numbers that will yield 0.

The equation \(\pi^2\log^2 n=\log^2 m\), which we can rewrite as

$$(i\pi)^2\log^2 n + \log^2 m=0,$$

is just such an equation, and it can never be true.

I wish I could say that I came up with this solution but I didn’t. I was this close: I was trying to apply Schanuel’s conjecture, and I was of course using the fact that \(\pi=-i\log -1\). But I did not fully appreciate the implications and meaning of Schanuel’s conjecture, so I was applying it improperly. Fortunately, another Quora user saved the day.

Still I haven’t had this much fun with pure math (and I haven’t learned this much pure math all at once) in years.

 Posted by at 8:25 pm
May 242015

John Forbes Nash Jr. is dead, along with his wife Alicia. They were killed on the New Jersey Turnpike when the taxi, taking them home from the airport, crashed into a guardrail and another vehicle after the driver lost control while trying to pass.

Nash and his wife were returning from Norway, where Nash was one of the recipients of the 2015 Abel prize.

News of this accident made me shudder for another reason. Less than two weeks ago, when I was returning from Dubai, my taxi driver not only answered a call on his cell phone, he even responded to a text while driving. I was too tired to say anything at first and then thankfully he came to his senses… but his behavior made me feel decidedly uncomfortable in his vehicle. Next time, I will not hesitate to tell the taxi driver to stop immediately or call another taxi for me.

 Posted by at 1:38 pm
Oct 132014

Science fiction has a subgenre: mathematical fiction. Stories of this nature are rare; good stories are even rarer. One memorable story that I recall from ages ago was A Subway Named Moebius, written by A. J. Deutsch in 1950. There was another story more recently: Luminous by Greg Egan, which I read in Asimov’s SF magazine shortly before I stopped reading (and eventually, stopped subscribing to) said magazine. (Nothing wrong with the magazine; it’s just that I found many of the stories unsatisfying, and I found I had less and less time to read them. The genre is just not the same as it was back in the Golden Age of Science Fiction.)

So recently, I found out that Egan wrote a sequel: Dark Integers, published in the same magazine in 2007. I now had a chance to read it and I was not disappointed.

Both stories are very good. Both stories are based on the notion that as yet unproven mathematical theorems can go either way; that the Platonic book of all math has not only not yet been written, but that there is no unique book, and multiple versions of mathematics may coexist, with an uneasy boundary.

Now imagine that you perform innocent mathematical experiments on your computer, using, say, computer algebra to probe ever more exotic theorems in a subfield few non-mathematicians ever heard about. And imagine how you would feel if you realized that by doing so, you are undermining the very foundations of another universe’s existence, literally threatening to wipe them out.

OK, if you start poking holes in that idea, there are many, but the basic notion is not completely stupid, and the questions that the stories raise are worth contemplating. And Egan writes well… the stories are fun, too!

Incidentally, this was the first decent (published) science fiction story I ever came across that contained a few lines of C++ code.

 Posted by at 4:00 pm
Dec 312013

So the other day, I solved this curious mathematics puzzle using repeated applications of Pythagoras’s theorem and a little bit of algebra.

Now I realize that there is a much simpler form of the proof.

The exercise was to prove that, given two semicircles drawn into a bigger circle as shown below, the sum of the areas of the semicircles is exactly half that of the larger circle.

Again, I’m inserting a few blank lines before presenting my proof.















Once again I am labeling some vertices in the diagram for easy reference.

Our goal is to prove that the area of a circle with radius AO is twice the sum of the areas of two semicircles, with radii AC and BD. But that is the same as proving that the area of a circle with radius AO is equal to the sum of the areas of two circles, with radii AC and BD.

The ACO< angle is a right angle. Therefore, the area of a circle with radius AO is the sum of the areas of circles with radii AC and CO. (To see this, just multiply the theorem of Pythagoras by π.) So if only we could prove that CO = BD, our proof would be complete.

Since AO = BO, they are the sides of the isosceles triangle ABO. Now if we were to pick a point O on the line CD such that CO‘ = BD, the ACO and ODB triangles will be identical (CD being the sum of AC and BD by construction). Therefore, AO‘ = BO, and the ABO triangle would be another isosceles triangle with its third vertex on the CD line. Clearly that is not possible, so O = O, and therefore, CO = BD. This concludes the proof.

 Posted by at 8:16 am
Dec 292013

The other day, I ran across a cute geometry puzzle on John Baez’s Google+ page. I was able to solve it in a few minutes, before I read the full post that suggested that this was, after all, a harder-than-usual area puzzle. Glad to see that, even though the last high school mathematics competition in which I participated was something like 35 years ago, I have not yet lost the skill.

Anyhow, the puzzle is this: prove that the area of the two semicircles below is exactly half the area of the full circle.

I am going to insert a few blank lines here before providing my solution.















I start with labeling some vertices on the diagram and also drawing a few radii and other lines to help.

Next, let’s call the radii of the two semicircles as \(a\) and \(b\). Then, we have
(AC)&= a,\\
(BD)&= b.
\end{align}Now observe that
(OA) = (OB) = r,
\end{align}and also
(CD)&= a + b,\\
(OD)&= a + b~- (OC).
\end{align}The rest is just repeated application of the theorem of Pythagoras:
(OC)^2&= r^2 – a^2,\\
(OD)^2&= r^2 – b^2,
\end{align}followed by a bit of trivial algebra:
(OC)^2 + a^2&= [a + b – (OC)]^2 + b^2,\\
0&= 2(a + b)[b – (OC)],\\
(OC)&= b.
\end{align}which means that the area of the full circle is twice the sum of the areas of the two semicircles, which is what we set out to prove.

I guess I have not yet lost my passion for pointless, self-serving mathematics.

 Posted by at 8:45 pm
Oct 112013

Reader’s Digest recently conducted an interesting experiment: they “lost” 12 wallets, filled with about $50 worth of cash and sufficient documentation to locate the owner, in 16 cities around the world. The result: Finns in Helsinki are the most honest with 11 of the 12 wallets returned, whereas in Lisbon, Portugal, the sole wallet that was returned was, in fact, found by a visiting Dutch couple. Finns needless to say, are rejoicing: “we don’t even run red lights,” boasted a Helsinki resident.

So what can we conclude from this interesting experiment? Perhaps shockingly, almost nothing.

This becomes evident if I plot a histogram with the number of wallets returned, and overlay on it a binomial distribution for a probability of 46.875% (which corresponds to the total number of wallets returned, 90 out of 192), I get a curve that is matched very closely by the histogram. Unsurprisingly, there will be a certain probability that in a given city, 1, 2, 3, etc. wallets are returned; and the results of Reader’s Digest match this prediction closely.

So there is no reason for Finns to rejoice or for the Portuguese to feel shame. It’s all just blind luck, after all. And the only valid conclusion we can draw from this experiment is that people are just as likely to be decent folks in Lisbon as in Helsinki.

But how do you explain this to a lay audience? More importantly, how do you prevent a political demagogue from drawing false or unwarranted conclusions from the data?

 Posted by at 9:40 pm
Sep 272013

It is now formally official: global surface temperatures did not increase significantly in the past 15 years or so.

But if skeptics conclude that this is it, the smoking gun that proves that all climate science is hogwash, they better think again. When we look closely, the plots reveal something a lot more interesting.

For starters… this is not the first time global temperatures stagnated or even decreased somewhat since the start of recordkeeping. There is a roughly 20-year period centered around 1950 or so, and another, even longer period centered roughly around 1890. This looks in fact like evidence that there may be something to the idea of a 60-year climate cycle. However, the alarming bit is this: every time the cycle peaks, temperatures are higher than in the previous cycle.

The just released IPCC Summary for Policymakers makes no mention of this cycle but it does offer an explanation for the observed stagnating temperatures. These are probably a result of volcanic activity, they tell us, the solar cycle, and perhaps mismodeling the effects of greenhouse gases and aerosols, but they are not exactly sure.

And certainty is characterized with words like “high confidence,” “medium confidence” and such, with no definitions given. These will be supplied, supposedly, in the technical report that will be released on Monday. Nonetheless, the statement that “Probabilistic estimates […] are based on statistical analysis of observations or model results, or both, and expert judgment” [emphasis mine] does not fill me with confidence, if you will pardon the pun.

In fact, I feel compelled to compare this to the various reports and releases issued by the LHC in recent years about the Higgs boson. There was no “expert judgment”. There were objective statistical analysis methods and procedures that were thoroughly documented (even though they were often difficult to comprehend, due to their sheer complexity.) There were objective standards for claiming a discovery.

Given the extreme political sensitivity of the topic, I think the IPCC should adopt similar or even more stringent standards of analysis as the LHC. Do away with “expert judgment” and use instead proper statistical tools to establish the likelihood of specific climate models in the light of the gathered data. And if the models do not work, e.g., if they failed to predict stagnating temperatures, the right thing to do is say that this is so; there is no need for “expert judgment”. Just state the facts.

 Posted by at 10:45 pm
Sep 272013

I’ve been hesitant to write about this, as skeptics will already have plenty to gripe about, I don’t need to pile on. And I swear I am not looking for excuses to bash the IPCC, not to mention that I have little sympathy or patience for skeptics who believe that an entire body of science is just one huge scam to make Al Gore and his buddies rich.

But… I was very disappointed to see plots in the latest IPCC “Summary for Policymakers” report that appear unnecessarily manipulative.

Wikipedia describes these as truncated or “gee-whiz” graphs: graphs in which the vertical axis does not start at zero. This can dramatically change the appearance of a plot, making small variations appear much larger than they really are.

To be clear, the use of truncated plots is often legitimate. Perhaps the plot compares two quantities that are of a similar magnitude. Perhaps the plot shows a quantity the absolute magnitude of which is irrelevant. Perhaps the quantity is such that “0” has no special meaning or it is not a natural start of the range (e.g., pH, temperature in Centigrade).

But in other cases, this practice can be viewed as misleading, intellectually dishonest (for instance, it is common for financial companies to manipulate plots this way to make their market performance appear more impressive than it really is) or outright fraudulent.

So here we are, the 2013 IPCC report’s summary for policymakers has been released in draft form, and what do I see in it? Several key plots that have been presented in truncated “gee-whiz” form, despite the fact that the quantities they represent are such that their absolute magnitudes are relevant, that their variability must be measured against their absolute magnitudes, and where zero is a natural start of the range.

I am presenting the original plots on the left and my crudely “untruncated” versions on the right:

This is not kosher, especially in a document that is intended for consumption by a lay audience who may not have the scientific education to spot such subtleties.

The document is still labeled a draft, with copy editing in particular yet to take place. Here’s to hoping that these plots (and any similar plots that may appear in the main report) are corrected before publication, to avoid the impression of trying to exaggerate the case for climate change. Scientists should be presenting the science objectively and leave the manipulation, even inadvertent manipulation, to politicians.

 Posted by at 10:22 pm
Apr 242012

I was having a discussion with a lawyer friend of mine. I was trying to illustrate the difference between the advocating done by lawyers and the scientist’s unbiased (or at least, not intentionally biased) search for the truth. One is about cherry-picking facts and arguments to prove a preconceived notion; the other about trying to understand the world around us.

I told him that anything and the opposite of anything can be proven by cherry-picking facts. Then it occurred to me that it is true even in math. For instance, by cherry-picking facts, I can easily prove that \(2\times 2=5\). Let’s start with three variables, \(a\), \(b\) and \(c\), for which it is true that \(a=b+c\). Then, multiplying by 5 gives


Multiplying by 4 and switching the two sides gives


Adding these two equations together, we get


Subtracting \(9a\) from both sides, we obtain




Dividing both sides by \(b+c-a\) gives the final result:


And no, I did not make some simple mistake in my derivation. In fact, I can use computer algebra to obtain the same result, and computers surely don’t lie. Here it is, with Maxima:

(%i1) eq1:5*a=5*b+5*c$
(%i2) eq2:4*b+4*c=4*a$
(%i3) eq3:eq1+eq2$
(%i4) eq4:eq3-9*a$
(%i5) eq5:factor(eq4)$
(%i6) eq6:eq5/(b+c-a);
(%o6)                                4 = 5

All I had to do to make this happen was to ignore an inconvenient little fact, which is precisely what lawyers (not to mention politicians) do all the time. Surely, if I can prove that \(2\times 2=5\), I can prove anything. So can lawyers and they know it.

 Posted by at 9:22 am
Mar 012012

Maxima is an open-source computer algebra system (CAS) and a damn good one at that if I may say so myself, being one of Maxima’s developers.

Among other things, Maxima has top-notch tensor algebra capabilities, which can be used, among other things, to work with Lagrangian field theories.

This week, I am pleased to report, SourgeForge chose Maxima as one of the featured open-source projects on their front page. No, it won’t make us rich and famous (not even rich or famous) but it is nice to be recognized.

 Posted by at 9:35 am
Jul 022011

Yesterday, Intel lost the bid for the patent assets of defunct Canadian company Nortel, despite joining forces with Google.

Google bid some odd amounts; for instance, at one point they bid $1,902,160,540.

The digits happen to be those of Brun’s constant: B2 = 1.90216058…

Brun’s constant is the sum of the reciprocals of twin primes. B2 = (1/3 + 1/5) + (1/5 + 1/7) + (1/11 + 1/13) + … According to Brun’s theorem, this sum converges. The limit of the sum is Brun’s constant.

A professor of mathematics named Thomas Nicely once used a group of computers to calculate twin primesup to 1e14, computing Brun’s constant among other things.

At one point, Nicely’s computations failed. After eliminating other sources of error, Nicely concluded that the problem was a fault in the new Pentium processors present in some recently acquired computers in the group.

Nicely notified Intel, but it wasn’t until after a public relations disaster that Intel finally responded the way they should have in the first place, offering to replace all affected processors. This cost Intel $475 million.

Who knows, if they still had that extra $475 million cash in their pockets, they could have bid more and won yesterday.

 Posted by at 10:21 pm
Jul 012011

Canada is 144 years old today. That is 12², or a dozen dozen. I am four dozen years old, and spent the last two dozen of these years here in Canada. Wonder what else is divisible by 12 this year.

 Posted by at 9:57 pm
Jan 252011

The other day, I saw a report on the CBC about increasingly sophisticated methods thieves use to steal credit and bank card numbers. They showed, for instance, how a thief can easily grab a store card reader when the clerk is not looking, replacing it with a modified reader that steals card numbers and PIN codes.

That such thefts can happen in the first place, however, I attribute to the criminal negligence of the financial institutions involved. There is no question about it, when it’s important to a corporation, they certainly find ways to implement cryptographically secure methods to deny access by unauthorized equipment. Such technology has been in use by cable companies for many years already, making it very difficult to use unauthorized equipment to view cable TV. So how hard can it be to incorporate strong cryptographic authentication into bank card reader terminals, and why do banks not do it?

The other topic of the report was the use of insecure (they didn’t call it insecure but that’s what it is) RFID technology on some newer credit cards, the information from which can be stolen in a split second by a thief that just stands or sits next to you in a crowded mall. The use of such technology on supposedly “secure” new electronic credit cards is both incomprehensible and inexcusable. But, I am sure the technical consultant who recommended this technology to the banks in some bloated report full of flowery prose and multisyllable jargon received a nice paycheck.

 Posted by at 1:39 pm
May 282010

This Homer Simpson is one smart fellow. While he was trying to compete with Edison as an inventor, he accidentally managed to discover the mass of the Higgs boson, disprove Fermat’s theorem, discover that we live in a closed universe, and he was doing a bit of topology, too.

His Higgs mass estimate is a tad off, though. Whether or not the Higgs exists, the jury is still out, but its mass is definitely not around 775 GeV.

 Posted by at 4:36 am
May 142010

I was watching the noontime local CTV news today. At around 12:39 (!), in three consecutive reports, the number 39 popped up. First, a report about a youth who is charged with vandalizing 39 tombstones. This report mentioned the number 39 several times, which is probably why I noticed that in the next report, one about the recent terrorism-related arrests in the US, footage shown in the background included the front door of a house bearing the number 39. At this time, I began paying attention. The next report was about Ottawa tourism advertisements in American newspapers; it didn’t seem likely that the number 39 would pop up there until the official being interviewed answered a question about funding and mentioned their 39 member hotels. That’s when I told my wife that this is getting a tad creepy.

The other day, I was watching a Stargate Universe episode in which one of the protagonists was reliving a part of his life while his brain was connected to an alien computer, and a particular number kept popping up as a clue. That number was 46, the number of chromosomes in a human cell. So that’s what makes 46 special. But what about 39?

Or perhaps all this was just a clever form of subliminal advertising for a Web site called The 39 Clues, which happens to be the first hit on Google when one searches for “39”?

 Posted by at 5:19 pm
Mar 222010

Imagine solving one of the most profound outstanding problems in mathematics. Imagine living in poverty, in a cockroach-infested apartment in St. Petersburg, Russia. Imagine being awarded one of the world’s most prestigious prizes in science, the Millennium Prize of the Clay Mathematics Institute, which, incidentally, also comes with a cool $1,000,000.

And imagine turning it down. Which is precisely what reclusive Russian mathematician Grigory Perelman apparently did.

I don’t know what to think. Was it a matter of principle for him? Perhaps. But then, he could have indicated in advance that he wouldn’t accept the award, just as he refused to accept the Fields Medal a few years earlier. Why did he keep the world in suspense? Was it posturing? Or is he, hmmm, how can I put this politely, one fry short of a happy meal, to use a favorite phrase of mine from the television series Stargate SG-1?

 Posted by at 10:13 pm
Mar 162010

An interesting anniversary today: 25 years ago, on March 15, 1985, the first ever .com domain name was registered, symbolics.com. The company, in addition to building their own brand of “Lisp Machine” computers, also happened to be selling the commercial version of the MACSYMA computer algebra software. The same software that, in the form of its open-source version, Maxima, continues to evolve thanks to a devoted team of developers… of which I happen to be one.

Alas, Symbolics is no longer, at least not the original company. A privately held company by the same name which obtained much of Symbolics’ assets still sells licenses of the old MACSYMA code.

 Posted by at 3:18 am
Dec 292009

There is a fascinating book published by the RAND Corporation, available at Amazon for a mere 81 US dollars. I am tempted to buy it. It must be a fascinating read. Readers’ comments at Amazon are certainly encouraging; while the book has some minor flaws, despite the lack of serious proofreading it is guaranteed not to contain any errors, and it helped at least one reader get to meet the woman who eventually became his wife.

 Posted by at 3:42 pm