Jan Ingvoldstad wrote: > On Thu, Oct 1, 2009 at 10:15 PM, Moritz Lenz <mor...@faui2k3.org> wrote: >> >> >> What's the 0th root of a number, then? >> It would be a number $y for which $y ** 0 == $x, which can only be >> fulfilled for $x == 1. So in the general cases the answer to the >> question root($x, 0) is nonsense, which is best mapped to NaN. >> > > That doesn't make sense. The answer is 1, not NaN. > > Think about it for a while: mathematically speaking, we would expect the 0th > root of a number to be 1.
Excuse me? given a number $x, roots($x, $n) returns a List (mathematically speaking a Set) of numbers $y, for which $y**$n == $x holds true. If roots(3, 0) returned 1, then 1**0 == 1, which is not 3. It's bettter to return NaN to indicate an impossible operation, rather than to return an ordinary number which is a wrong result. It is not obvious to me why 1 or in fact any defined number at all would be a mathematically sensible result - care to elaborate? Cheers, Moritz