Re: [R] weird behavior with the 3rd root....

2008-10-27 Thread Robin Hankin
This comes up from time to time. The problem is that one needs complex numbers to address taking the third root: there are three cube roots for any nonzero number (real or complex). To wit: > (-0.084121928394+0i)^(1/3) [1] 0.2190818+0.3794609i > (-0.084121928394-0i)^(1/3) [1] 0.21908

Re: [R] weird behavior with the 3rd root....

2008-10-26 Thread Duncan Murdoch
On 26/10/2008 4:05 PM, Juan Manuel Barreneche wrote: Well, this is what i got... -0.084121928394^(1/3) [1] -0.438163696867656 (-0.084121928394)^(1/3) [1] NaN and i don't have a clue of why this happens or how to avoid it, any suggestions? R won't raise negative numbers to fraction

Re: [R] weird behavior with the 3rd root....

2008-10-26 Thread Gábor Csárdi
'^' has higher precedence than '-', i.e. your first line is equivalent to - ( 0.08xyz. ^(1/3) ) Gabor On Sun, Oct 26, 2008 at 9:05 PM, Juan Manuel Barreneche <[EMAIL PROTECTED]> wrote: > Well, this is what i got... > >> -0.084121928394^(1/3) > [1] -0.438163696867656 >> (-0.0841219283

[R] weird behavior with the 3rd root....

2008-10-26 Thread Juan Manuel Barreneche
Well, this is what i got... > -0.084121928394^(1/3) [1] -0.438163696867656 > (-0.084121928394)^(1/3) [1] NaN and i don't have a clue of why this happens or how to avoid it, any suggestions? thank you, Juan __ R-help@r-project.org mailing list