MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why is this so?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15314] Re: [mg15304] Why is this so?
  • From: BobHanlon at aol.com
  • Date: Fri, 8 Jan 1999 04:15:05 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 1/4/99 4:31:19 AM, chester at nicco.sscnet.ucla.edu
writes:

>The following in/out does not make sense to me:
>
>Clear[f, x]
>f[x_] := x^(1/3)
>Plot[f[x], {x, -125, 125}]
>
>Plot::plnr : f[x] is not a machine-size real number at x = -125..
>Plot::plnr : f[x] is not a machine-size real number at x = -114.858.
>Plot::plnr : f[x] is not a machine-size real number at x = -103.798.
>General::stop :
> Further output of Plot::plnr will be suppressed during this
>calculation.
>
>Isn't it true that (-125)^(1/3) == -5?
>
>Why do I get this strange result?
>
>I am using Mathematica 3.01 for Students on Macintosh.
>

Chester,

There are three roots, two of which are complex

Solve[x^3 == -125, x]

{{x -> -5}, {x -> 5*(-1)^(1/3)}, {x -> -5*(-1)^(2/3)}}

% // N

{{x -> -5.}, {x -> 2.5 + 4.330127018922194*I}, 
  {x -> 2.5 - 4.330127018922195*I}}

The root with the smallest angle is the one to which Mathematica
defaults

N[(-125)^(1/3)]

2.5 + 4.330127018922194*I

(-125.)^(1/3)

2.5 + 4.330127018922193*I

Since you know which of the roots that you intend, define your function
accordingly

Clear[f, x];
f[x_] := Sign[x] * Abs[x]^(1/3);
Plot[f[x], {x, -125, 125}];


Bob Hanlon


  • Prev by Date: Saving only input cells
  • Next by Date: summation optimization
  • Previous by thread: Re: Saving only input cells
  • Next by thread: Re: Why is this so?