Re: [R] nth root of matrix

2013-07-03 Thread arun
 sign(a)*abs(a)^(1/3) #  [,1] #[1,] -1.00 #[2,] -1.259921 #[3,] -1.442250 A.K. - Original Message - From: Sachinthaka Abeywardana To: "r-help@r-project.org" Cc: Sent: Tuesday, July 2, 2013 11:11 PM Subject: [R] nth root of matrix Hi all, I want to do the fol

Re: [R] nth root of matrix

2013-07-02 Thread Spencer Graves
On 7/2/2013 9:24 PM, David Winsemius wrote: On Jul 2, 2013, at 8:11 PM, Sachinthaka Abeywardana wrote: Hi all, I want to do the following: a=matrix(c(-1,-2,-3)) a^(1/3) #get 3rd root of numbers[,1] [1,] NaN [2,] NaN [3,] NaN All I get is NaNs, what is the proper way of doing this? Wou

Re: [R] nth root of matrix

2013-07-02 Thread David Winsemius
On Jul 2, 2013, at 8:11 PM, Sachinthaka Abeywardana wrote: > Hi all, > > I want to do the following: > > a=matrix(c(-1,-2,-3)) > a^(1/3) #get 3rd root of numbers[,1] > > [1,] NaN > [2,] NaN > [3,] NaN > > > All I get is NaNs, what is the proper way of doing this? Would like to > retain th

[R] nth root of matrix

2013-07-02 Thread Sachinthaka Abeywardana
Hi all, I want to do the following: a=matrix(c(-1,-2,-3)) a^(1/3) #get 3rd root of numbers[,1] [1,] NaN [2,] NaN [3,] NaN All I get is NaNs, what is the proper way of doing this? Would like to retain the fact that it is a matrix if possible (not a requirement though). Thanks, Sachin