Problem with construction (1-x)^(1-y) (PR#2103)

ligges@statistik.uni-dortmund.de ligges@statistik.uni-dortmund.de
Fri, 4 Oct 2002 08:20:21 +0200 (MET DST)


rss@rss.phtd.tpu.edu.ru wrote:
> 
> Hello!
> 
> I have any problem with construction (1-x)^(1-y) if y<1
> 
> > x=5
> > y=.5
> > (1-x)^(1-y)
> [1] NaN

Well, that's not a bug! Also for y>=1 (hopefully!):
 (1-x)^1.1 # NaN

You are calculating with real numbers and expecting complex ones! So
just try:
 as.complex(1-x)^(1-y)

Uwe Ligges

> > (1-y)
> [1] 0.5
> > (1-x)^0.5
> [1] NaN
> > (1-x)
> [1] -4
> > -4^.5
> [1] -2
> 
> Roma V. Kalaida
> E-mail rss@rss.phtd.tpu.edu.ru

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._