Monday, December 11, 2006

The Midas Number (or why divide by zero?)

A recent BBC news article has lead to a storm of commentary on sites like Digg, Reddit and Slashdot about a Reading University lecturer's claim to have 'solved the problem of dividing by zero'.

He makes this claim in a pair of papers: Perspex Machine VIII: Axioms of Transreal Arithmetic and Perspex Machine IX: Transreal Analysis on his personal web site. The papers were or will be published by the Proceedings of the Society of Photo-Optical Engineers, which, I must admit, was not one of the mathemetical journals with which I am familiar.

The first paper introduces a formal system which is vaguely related to the standard axioms of arithmetic with which everyone is familiar. However, it would need to be studied as a totally separate system since it has a number of significant differences which I think make its usefulness a little doubtful. For an excellent overview of the major problems read: Open Letter to James Anderson.

There are some major problems IMHO without delving deeply into the mathematical structures which Dr Anderson's formal system is not.

The most striking first problem is that the 'what you do to one side you do to the other' rule taught to school children does not work. This is caused by a special non-number that Dr Anderson introduces called nullity and written Φ.

For example, it is not the case that if a + b = a + c then b = c. Any school child will be familiar with the idea that you could subtract a from both side of that equation to reveal that b = c.

Unfortunately, the introduced of Φ means that if a = Φ, b and c can be absolutely anything at all. This occurs because on of the axioms of Dr Anderson system is that Φ + a = Φ (and addition is commutative).

So if you are going to subtract something from both side of an equation you need to make sure that it's not Φ. That's a little like the following case in regular arithmetic where you have to ensure that a is not 0: if b / a = c / a then b = c. Under Dr Anderson's system things are even more complex: a must not be 0 or Φ or positive or negative infinity (also non-numbers that Dr Anderson introduces in the first paper with related axioms).

So just regular work with equations gets a little tricky.

The "problem" that Dr Anderson wishes to "solve" it appears is that nobody (but he seems particularly worried about computers) can divide by 0. This is a well known fact, or you might think of it as an axiom, you can't divide by 0, or, put another way, the result of dividing by 0 is undefined.

People "solve" this problem when they see a divide by zero by saying "That doesn't work then"; computers "solve" this problem with an exception, or error, and by assigning the result of a divide by zero the special name NaN (which stands for Not a Number). The computer program has to be designed to either never divide by zero (many programs specifically check to see if they are about to and signal an error), or deal with the exception, or sometimes they'll crash.

Dr Anderson's solution is that a computer should be allowed to divide by zero and instead of having an exception, or crashing, etc. you'll get the result Φ. In the BBC article he says:

"Imagine you're landing on an aeroplane and the automatic pilot's working," he suggests. "If it divides by zero and the computer stops working - you're in big trouble. If your heart pacemaker divides by zero, you're dead."

OK, Dr A. so how does Φ solve this?

I can give you the answer right here: it doesn't. And that's because Dr. A's Φ is cancerous. As soon as variable becomes Φ everything it touches becomes Φ. It's the number equivalent of King Midas: everything it touches turns to Φ.

That's because of two axioms in the first paper: Φ + a = Φ and Φ × a = Φ.

So, basically instead of getting an exception, or error, Dr. Anderson's arithmetic gets rid of the problem and replaces it with Φ. From a programming perspective it's irrelevant, if your auto-pilot suddenly computes that required speed is Φ or your pacemaker wants Φ beats per minute it's useless.

The answer is simple: don't divide by zero. It's undefined!

Thursday, December 07, 2006

Bug fix: 12 Tasty Make Recipes Part II

Back in May, 2006 I gave a talk called 12 Tasty Make Recipes Part II in which I talked about a user-defined GNU Make function to recursively search from a directory for a file or set of files.

The function was written like this:

search = $(foreach d,$(wildcard $1/*),$(call search,$d)$(filter $(subst *,%,$2),$d))

Unfortunately, there was a small mistake in the code that appeared in the presentation. However, two bugs collided to cause the mistake to have no effect. In the above function I wrote $(call search,$d) when I should have written $(call search,$d,$2). But since GNU Make had a bug that caused it to not reset $2 (or any other arguments in the form $n) on a nested $(call) and since I was reusing $2 as the second argument, my function worked.

That is, until GNU Make 3.81 was released and fixed bug 1744.

The correct version of search which will work with all versions of GNU Make is:

search = $(foreach d,$(wildcard $1/*),$(call search,$d,$2)$(filter $(subst *,%,$2),$d))

Thanks for Lou Iacoponi for writing in and pointing out my error.

Sunday, December 03, 2006

Two weeks of image spam innovation

Since I last blogged about image spam I've received numerous image spams myself, and reports from Nick FitzGerald, Sorin Mustaca and Nicholas Johnston about interesting image spams that I've just got to see.

On November 14, I received a report of image spams where the background noise had been updated from dots or small lines to polygons. Here's a sample:

A day later it was clear that the same spammer was randomizing the image size, the background noise and the color palette used:

Then on November 17 I was shown this interesting pump'n'dump technique:

83622874400056543 047183602660 41478311028418 100278 84807407350 05087016712772
78810870435635016 71651855827222 4725576405300038 84252840 12157351038885 630188325737443
23414 23133 41104 4312 7131 6341874402 48244 02522 1428 3224
55263 16021 42114 6654 7782 6583 2673 53280 03201 8323 6565
65882 58041 62412 6086607534050781 3826 0641 83176 85045 35427866406418
18506 15283 12474 33388136436533 643542 80456 87628 13156 506577110786230
31645 55602 81036 816525232877 301217585451283 01540 76265 0748 3312
06035 63450 43040 5224 1553 5786434504117661 52402 78534 8836 414
58510 75013 38325 3877 04146 76870 2788 34488 42803 77840 2737 5470
11372 62751178216028 2715 7266 17812 3668 10033 28833425366310 360215874450816
31403 486020746152 7723 4552 46471 6721 77207 683820875035 23460162005106

Nice, but that didn't last very long, but on November 22 the innovaters were at it again with smaller images containing polygons, lines, random colors, jagged text:

A day later the noise element changed to pixels:

Two days later spammers were trying a little 'old school' image spam with some fonts that they hoped would be hard to OCR.

Strangely the following image spam appeared on November 27 with a perfectly filterable URL. Oops:

And right before the month ended the noise around the border had turned into something like little fireworks: