Sunday, May 8, 2011

Properties of zero

In mathematics zero is considered to be unsigned and therefore neither positive or negative. However, some floating point representations have signed zero.

(= (pos? 0) false)
(= (neg? 0) false)

Zero is also the first counting number, a concept introduced in Lisp. Earlier programming languages used one as the first counting number.

(= (nth ["a" "b" "c"] 0) "a")

Perhaps the most interesting property of zero is zero to the power of zero. My hyper-operator implementation in my last blog post leads me to the empty product:

(= (hyper-operation 3 0 0)
   (apply (partial hyper-operation 2) (repeat 0 0))
   (hyper-operation 2)

The JVM seems to agree with me on this:

(= (Math/pow 0 0) 1)

However, some people considered zero to the power of zero to be an indefinite form, however, I think it is better to define it as zero rather then raising a disruptive error. It also just so happens that the value of one is necessary for various formulas to work, most notably, the series expansion for Math/exp.

No comments:

Post a Comment