s-news
[Top] [All Lists]

SUMMARY: roots of negative numbers

To: s-news@wubios.wustl.edu
Subject: SUMMARY: roots of negative numbers
From: P.J.Wells@open.ac.uk
Date: Thu, 20 Sep 2001 11:07:46 +0100
Many thanks to those who provided such helpful replies:

Brian Ripley has already replied via the list, but I 'm taking the liberty
of posting this off-list postscript from him:

++++++++++++

I realized there is one other piece I did not say.  Once one has one
complex nth root, you can get all the others by multiplying by the known
complex roots of unity:

The 5th roots of -9 are

test <- -9
(test+0i)^(1/5) * exp((2*pi)*1i*(1:5)/5)
[1] -0.4795467+1.475893e+00i -1.5518456+2.139673e-16i
-0.4795467-1.475893e+00i
[4]  1.2554694-9.121519e-01i  1.2554694+9.121519e-01i

++++++++++++


And the following suggestion came from the wide-awake Rolf Turner:

++++++++++++

I haven't checked it thoroughly, but the following works
for -27:

 > cube.root <- function(x){sign(x)*abs(x)^(1/3)}
 > cube.root(-27)
[1] -3
 > cube.root(27) 
[1] 3

++++++++++++


I expect lots of list-members share John Sorkin's interest in the rounding
issues.

Julian Wells
OU Business School
The Open University
Walton Hall
Milton Keynes
MK7 6AA
United Kingdom
+44 1908 654658


<Prev in Thread] Current Thread [Next in Thread>
  • SUMMARY: roots of negative numbers, P . J . Wells <=