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
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
'^' 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
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
4 matches
Mail list logo