Sunday, November 21, 2010

Is -x^2 positive or negative?

So, is -x2 a positive, negative, or undefined quantity for real-valued x?  Ask any physicist or mathematician and they will say that it is a negative number for real valued x making things like: exp(-x2) between 0 and 1.  That is why it came as a BIG surprise to me that computer scientists don't think that, and a program like Excel will interpret:


as positive 25!  After taking quite a while debugging a student problem calculating the normal distribution in Excel, it got me on a quest (and an argument with a colleague) to figure out who else thought this way.  I checked Matlab, Mathematica, Python, and Google as well as a calculator on the computer.  All interpreted -5^2 (properly) as -25.  To do otherwise, I believe, is perverse for any application that is doing mathematical applications.  I was directed to this page, which outlines many languages.  Pretty much just Excel, COBOL, Chipmunk BASIC and a few small scripting languages take the "unary minus" approach, which makes "unary minus" have precedence over exponentiation.

I am not sure why anyone would consider this a good idea, for working with actual math equations.  Of course one could add parentheses, but which is clearer:




The second is obviously not ambiguous, but less clear.  Anyway, that is the entire reason why we have order of operations, so we don't have to do:


So, Excel, come into at least the 20th century and figure out that exponentiation trumps "minus", whatever you want to call it.


Glenn Beck on Science

The following audio from a Glenn Beck show is illustrative of many things. Although he demonstrates incredible ignonance of evolution in this clip, he makes some good points...they just aren't the points he thinks he's making.

His main points are the following:

  1. "I don't know why it is unreasonable to say this...I'm not God, so I don't know how God creates...I don't think we came from monkeys...I think that's ridiculous...I haven't seen a half-monkey-half-person yet...did evolution just stop?"
  2. "They have to force [the idea of evolution] down your throat...when anybody has to force it, it's a didn't have to force that the world is round...[...] don't have to force the just keep adding evidence and evidence until it becomes self-evident."

Now, point (1) demonstrates a profound ignorance, willful or otherwise, of the claims of evolution.  First, no biologist says we came from monkeys...monkeys and people are just as "evolved" as each other, and that they share a common ancestor which would have both features of monkey and human.  We have many of these transitional fossils (for a very nice summary see the Transitional Fossil FAQ).  It's really such an elementary error, that he should be thrown off the air just for spreading such ignorance.

However, I would like to focus on point (2) which perhaps seems reasonable: that truth should be self evident, and not have to be forced.  In a way, one might think that science works this way because everything should be repeatable, and we don't take arguments from authority.  However, there is a problem.  Although it is true that the fact that the world is round did not have to be forced (in contrast to the bogus propaganda story about Columbus demonstrating it), one does need to actually look at the facts in order to be able to judge...truth can be self evident but it requires one to actually look at the evidence.  Take evolution, for example.  If you look at the genetic data showing the differences in base-pair counts between animals, this single number mapped out for all animals demonstrates a tree structure ( and  Now recall that Darwin did not know anything about genetics, so this is a prediction made 50+ years before the measurements.  When you actually look at the evidence for evolution it is absolutely self evident.  The problem is several-fold:

  1. people refuse to even look at the evidence, choosing instead to willfully remain ignorant thinking they understand it.
  2. There is a certain amount of technical information necessary to understand any science, and that takes work.  If you don't want to do that work then you'll remain ignorant of it.  As an extreme example, quantum mechanics is definitely true, but it neither self evident nor intuitive (and I don't see conservative talking heads railing against it)

What's the solution?  I'm not sure, but challenging people to learn is a start.