MathGroup Archive 1999

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

Search the Archive

Re: Why is this so?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15339] Re: Why is this so?
  • From: "Donald E. Niman" <donald.e.niman at safetran.com>
  • Date: Fri, 8 Jan 1999 04:15:26 -0500
  • Organization: Safetran Systems Corporation
  • References: <76pq9g$e0n@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

A cube root of x has three possible results.  For a Real x, there is 
one real cube root and two imaginary cube roots.  For x>0 Mathematica 
chooses the Real cube root.  For x<0, it chooses an imaginary cube 
root. (I am not sure why but I have a suspicion that does this 
deliberately.)  See the Mathematica Book, 3.2.7.  The Plot[] function 
obviously chokes on the complex number.    

In order to get the plot that I think you are expecting, try this:

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

Maybe there is a more elegant way to do this...?

Also, for (-125)^(1/3), you can see the cube roots by doing a

        Solve[x^3 == -125, x]  (* to find the three solutions  *)
        N[%]                   (* to see the numerical results *)

	{{x->-5.},{x->2.5 + 4.33013 I},{x->2.5 -4.33013 I}}

In case something works differently for you, I am using Mathematica Pro
3.0.1 on Windows NT 4.0.

I hope this helps...


Chester Lin wrote:
> 
> 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.
> 
> Thanks for any info.
> 
> Chester Lin
> chester at nicco.sscnet.ucla.edu

--
Donald E. Niman                 Software Engineer Research and
Development        Vital Systems Safetran Systems Corporation    Rancho
Cucamonga, CA


  • Prev by Date: Re: Why is this so?
  • Next by Date: Re: quadratic programs - Markowitz-type portfolio optimization
  • Previous by thread: Re: Why is this so?
  • Next by thread: Re: Why is this so?