Skip to content

extraction of roots in R

3 messages · Gary Dong, Don McKenzie

#
If you just want the nth root of X, use X^(1/n)

 > x <- 256
 > x^(1/8)
[1] 2

 > x <- -256
 > x^(1/8)
[1] NaN

It appears that you get the positive real root.

Is this all you wanted?
On 1-Nov-13, at 11:11 AM, Gary Dong wrote:

            
Don McKenzie
Pacific Wildland Fire Sciences Lab
US Forest Service

Affiliate Professor
School of Environmental and Forest Sciences
University of Washington

dmck at uw.edu
#
If you want complex roots, there is a post by Ravi Varadhan from  
2010, a reprint of which I found quickly by a google search at

http://r.789695.n4.nabble.com/finding-complex-roots-in-R-td2541514.html
On 1-Nov-13, at 11:20 AM, Don McKenzie wrote:

            
Don McKenzie
Pacific Wildland Fire Sciences Lab
US Forest Service

Affiliate Professor
School of Environmental and Forest Sciences
University of Washington

dmck at uw.edu