[Python-Dev] PEP239 (Rational Numbers) Reference Implementation and new issues

Chad Netzer cnetzer at mail.arc.nasa.gov
Fri Oct 4 06:31:11 EDT 2002


On Friday 04 October 2002 02:16, Michael Hudson wrote:
> Chad Netzer <cnetzer at mail.arc.nasa.gov> writes:
> > BTW.  The expression/definition that always makes me shake MY head
> > is (0**0 == 1).  Limits are amazing things...
>
> Even here you have to be careful!  I presume you meant
>
>               x
>       lim    x   = 1
>      x -> 0

Well, I meant that despite the discontinuity of the limits, there is an 
informal (perhaps even a formal) definition for 0**0 (ie. 0 to the 
zeroth power) to equal the limit above (ie. 1).

Python 2.2.1 (#2, Sep 13 2002, 23:25:07) 
>>> 0**0
1

The same in Octave or Matlab.  Mathematica flags it as indeterminate, 
however.  However, for some kinds of mathematics, 0**0 needs to equal 
1, for consistency:

    http://db.uwaterloo.ca/~alopez-o/math-faq/node40.html

Knuth, et al. even go so far as to say (in _Concrete Mathematics_):

"""
Some textbooks leave the quantity 0**0 undefined, because the functions 
x**0 and 0**x have different limiting values when x  decreases to 0.  
But this is a mistake. We must define (x**0  == 1) for all x, if the 
binomial theorem is to be valid when x=0, y=0, and/or x=-y. The theorem 
is too important to be arbitrarily restricted! By contrast, the 
function 0**x is quite unimportant.
"""

There is a bit of levity in that passage, but nontheless, I do find the 
argument compelling (even though (0**0 == 1) just *looks* wrong :) )

-- 

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list