[Haskell-cafe] How odd...

Stephen Forrest stephen.forrest at gmail.com
Sat Aug 4 16:35:54 EDT 2007


On 8/4/07, Dan Piponi <dpiponi at gmail.com> wrote:
>
> 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.


A example I have seen before that illustrates some the difficulties with
preserving such behaviour is (-1)^(1/3).

Of course, taking the nth root is multi-valued, so if you're to return a
single value, you must choose a convention.  Many implementations I have
seen choose the solution with lowest argument (i.e. the first solution
encounted by a counterclockwise sweep through the plane starting at (1,0).)

With this interpretation, (-1)^(1/3) = 0.5 + sqrt(3)/2 * i.  If you go with
the real solution (-1) you might need to do so carefully in order to
preserve other useful properties of ^, like continuity.

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070804/f7eadf87/attachment.htm


More information about the Haskell-Cafe mailing list