[Haskell-cafe] How odd...
Dan Piponi
dpiponi at gmail.com
Sat Aug 4 15:47:14 EDT 2007
On 8/4/07, Albert Y. C. Lai <trebla at vex.net> wrote:
> There is no reason to expect complex ** to agree with real **.
There's every reason. It is standard mathematical practice to embed
the integers in the rationals in the reals in the complex numbers and
it is nice to have as many functions as possible respect that
embedding. In particular, it's nice to get a kind of commutativity
when we start casting between different numeric types. There's an old
paper on this subject by Reynolds
(http://lambda-the-ultimate.org/node/2078) though I'm more familiar
with the treatment in Pierce's "Basic Category for Computer
Scientists".
If you look through a variety of complex analysis books you'll find a
number of different approaches to handling 0^x for complex x. Many
agree that this is defined for Re(x)>0. Some say it is defined for
integer x>0. Some say it's not defined at all, and then in the
following paragraphs talk about x^2 where x takes values in the entire
complex plane.
So it seems to me that it is entirely reasonable to hope that (0:+0)**2=0:+0.
> Complex x**y involves picking a phase angle of x. "Phase angle" is an
> ill notion for 0. Complex 0**y is better left undefined.
There is no right answer here, it's a matter of taste. Among
mathematicians there doesn't seem to be a uniform consensus. But I
think that in computing a commutativity principle is nice to have, so
I think we should have x**fromInteger y = x^y, where defined, so that,
in some sense, (^) is embedded in (**).
--
Dan
More information about the Haskell-Cafe
mailing list