Skip to content

Plot f(x) = x^(1/5)

4 messages · Bob, Richard M. Heiberger, Albyn Jones +1 more

Bob
#
Forwarded message:
Well, maybe we should say that _R_ can't raise a negative number to a
fractional power.  Neither I nor the TI calculators have any trouble
doing it;-) I'd say R is funtioning as designed, but it was designed
to respond INcorrectly;-)

This R exchange
[1] -32

shows that -2 is a fifth root of -32 while this exchange
[1] NaN

shows that R cannot find that root.  The various suggestions for
dealing with this amount to asking R a different question which we
know has the same answer as the intended question (which R won't
answer).

On one level you could view this as a coding/implementation issue.  I
have not looked at R's code, but the usual computer way to handle
exponents involves taking the log of the argument.  This does not
return the correct answer when the argument is negative.  That's
annoying.  The TI graphing calculators were developed with an
incredible amount of input from secondary math. teachers.  They
complained loudly about calculators returning wrong answers or
non-answers to problems to which students knew the right answers.  TI
did a LOT of work on this.  I wish R (and lots of scientific software)
would do likewise.

On another level, involving exponentiation is not entirely avoidable.
For rational numbers like 1/5 we can (and usually do) interpret
(-32)^(1/5) as a name for a real number that when raised to the fifth
power gives -32.  Another name for one such number is -2.  But if we want
to use an irrational exponent, say (-32)^pi we can't interpret it that
way.  (How do we multiply pi numbers together?)  So eventually we have
to either exponentiate or have a funciton that is undefined at many
points.  At lesat in theory.  As far as computers and calculators are
concerned, they cannot represent irrational numbers anyway --
eveything is a rational approximation.  

So I think the defect is in R, not in the original posted question. 

------->  First-time AP Stats. teacher?  Help is on the way! See
http://courses.ncssm.edu/math/Stat_Inst/Stats2007/Bob%20Hayden/Relief.html
      _
     | |          Robert W. Hayden
     | |          614 Nashua Street #119
    /  |          Milford, New Hampshire 03055  USA
   |   |          
   |   |          email: bob@ the site below
  /  x |          website: http://statland.org
 |     /          
 ''''''
#
This problem is an example of FAQ 7.31.  Floating point numbers
inside the computer can not represent odd fractions exactly.
[1]  1  3  5  7  9 11 13 15
[1] 1.00000000 0.33333333 0.20000000 0.14285714 0.11111111 0.09090909 0.07692308
[8] 0.06666667
[1] 1.0000000000000000000 0.3333333333333333148 0.2000000000000000111
[4] 0.1428571428571428492 0.1111111111111111049 0.0909090909090909116
[7] 0.0769230769230769273 0.0666666666666666657
[1]  -2 NaN NaN NaN NaN NaN NaN NaN
Rich
On Tue, May 17, 2016 at 10:23 AM, bob at statland.org <bob at statland.org> wrote:
#
I think R is doing just what it should do, and the TI has been hacked to
make HS teachers happy :-)
[1] 0.1386294+0.6283185i
[1] -2-0i
[1] 0.9293165+0.675188i
[1] 0.9293165+0.675188i
[1] 0.9293165
[1] 0.675188

albyn


On Tue, May 17, 2016 at 8:10 AM, Richard M. Heiberger <rmh at temple.edu>
wrote:

  
  
#
Hi,

The powerplus package does raise a negative number to a fractional 
power. Try:

library(powerplus)
explus(-.5, 1/5)

Klaus.
On 17/05/2016 17:55, Albyn Jones wrote: