Try : -0.5^(1/5) [1] -0.8705506
David -----Original Message----- From: R-sig-teaching [mailto:[email protected]] On Behalf Of Steven Stoline Sent: 17 May 2016 14:07 To: jim holtman <[email protected]> Cc: R-sig-teaching <[email protected]> Subject: Re: [R-sig-teaching] Plot f(x) = x^(1/5) Dear All: in my TI-Calculator (-0.5)^(1/5) = -0.8705, but in R (-0.5)^(1/5) = NaN. with thanks steve On Tue, May 17, 2016 at 8:52 AM, jim holtman <[email protected]> wrote: > System is working correctly. A negative number cannot be raised to a > fractional power: > > > (-2)^(1/5) > [1] NaN > > > > > Jim Holtman > Data Munger Guru > > What is the problem that you are trying to solve? > Tell me what you want to do, not how you want to do it. > > On Tue, May 17, 2016 at 8:44 AM, Steven Stoline <[email protected]> > wrote: > >> Dear All: >> >> >> I am trying to plot the function f(x) = x^(1/5) for x=seq(-2,2,0.01). >> It give me only the plot of f(x) for the positive part of x. I >> checked the values of f(x), it is NaN for all negative values of x. >> >> *this is my code:* >> >> >> x<-seq(-2,2,0.01) >> y<- (x)^(1/5) >> plot(x,y, type="l", lwd=3, xlab = " ", ylab = " ", col="blue") >> abline(v=0, col="gray", lty=2, lwd=3) abline(h=0, col="gray", lty=2, >> lwd=3) >> >> >> >> any help will be appreciated. >> >> >> with many thanks >> steve >> -- >> Steven M. Stoline >> 1123 Forest Avenue >> Portland, ME 04112 >> [email protected] >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> [email protected] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching >> > > -- Steven M. Stoline 1123 Forest Avenue Portland, ME 04112 [email protected] [[alternative HTML version deleted]] _______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-teaching ________________________________ This email may have a protective marking please see http://www.mrc.ac.uk/about/information-standards/document-marking-policy/ <http://www.mrc.ac.uk/about/information-standards/document-marking-policy/> This email and any attachments are intended for the name...{{dropped:21}} _______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
