The stupid question is the question not asked | |
PerlMonks |
Re: 0**0by antirice (Priest) |
on Jan 16, 2003 at 21:32 UTC ( [id://227513]=note: print w/replies, xml ) | Need Help?? |
Well, the logarithm seems to agree. 0**0 = 1 log(1) / log(0) = 0 For those of you who don't remember logs, they allow you to figure out the exponent needed to get y from x. i.e. log(y) / log(x) = z for x != 1 (since log(1) = 0, avoid div by zero) x**z = y Yeah, my point doesn't seem very valuable, but that's how I cope with 0**0 = 1. Update: I know that log(0) = -infinity. I understand that I used the limit of log(1) / log(0) as log(0) approaches -infinity (travelling from right) to get my answer that 0**0 = 1. Approaching from the left results in undef since log(-x) does not exist (this is because en = -x means that i is a factor of e, in which case n is even...in the integer sense, let's not cloud the issue with reals) and anything divided by nothing (not nothing in the zero sense but nothing in the undefined sense) doesn't exist. In short, depends upon which side you're coming from. I like both answers, but you 0**0 = undef guys were giving the 0**0 = 1 people a hard time. Another interesting note: 0**x = ? as x approaches 0 from the right would result in ? being 0. From the left again is undefined since 0**-x = 1 / 0**x. Since 0**x = 0 for x > 0, you'd be dividing by 0 to give you the undefined value. So let's see, the score stands: 0**0 = 1 => 1 point 0**0 = 0 => 1 point 0**0 = undef => 2 points Hmmm...maybe somebody from my 0**0 = 1 team can boost our score again. wait... Let's see the scores now: 0**0 = 0 => 1 point 0**0 = undef => 2 points 0**0 = 1 => since perl says so, infinite points ;-) Sorry this is so long.
In Section
Seekers of Perl Wisdom
|
|