[Haskell-cafe] How odd...

Dan Piponi dpiponi at gmail.com
Sat Aug 4 17:06:53 EDT 2007

On 8/4/07, Stephen Forrest <stephen.forrest at gmail.com> wrote:
> 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).)

This is one approach but not the one used by some languages. Another
way of looking at it is this: a function like log is multivalued as
you pass around the origin. So what you can do is 'cut' the complex
plane so that you're not allowed to cross the cuts. Now you have a
region on which a single-valued function can be unambiguously defined.
It's fairly standard practice, when documenting functions of a complex
variable, to specify precisely which 'branch cuts' are being used.
Here's a quote from the Mathematica documentation describing their Log
function: "Log[z] has a branch cut discontinuity in the complex z
plane running from  -infinity to 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.

You can guarantee this by making sure you make the right 'cuts'.

More information about the Haskell-Cafe mailing list