Re: [R] NaN not expected

2010-12-17 Thread Duncan Murdoch
On 17/12/2010 11:40 AM, Thiem Alrik wrote: Dear mailing list, Why does the following code produce numerical results for x.pos.l, but NaNs for x.neg.l? x.pos<- function(tau.e, tau.c){ tau.e + ((-tau.e^3 + 3*tau.e^2*tau.c - 3*tau.e*tau.c^2 + tau.c^3)^(1/3))/(2*2^(1/3)) } (x.pos.l<- x.pos(1

[R] NaN not expected

2010-12-17 Thread Thiem Alrik
Dear mailing list, Why does the following code produce numerical results for x.pos.l, but NaNs for x.neg.l? x.pos <- function(tau.e, tau.c){ tau.e + ((-tau.e^3 + 3*tau.e^2*tau.c - 3*tau.e*tau.c^2 + tau.c^3)^(1/3))/(2*2^(1/3)) } (x.pos.l <- x.pos(1, 2)) x.neg <- function(tau.c, tau.i){ ta