MathGroup Archive 1999

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

Search the Archive

Plotting cube root (was: Why is this so?)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15324] Plotting cube root (was: Why is this so?)
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Fri, 8 Jan 1999 04:15:14 -0500
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <76pq9g$e0n@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Your problem has nothing whatsoever to do with your Macintosh platform
nor with the Student Version (which has exactly the same functionality
as the full version!!).

What you are seeing is not at all strange -- but rather a necessary
consequence, it would seem, of a computer algebra system such as
Mathematica needing to deal with complex numbers as well as real
numbers.

In "The Mathematica Book" (or the Help Browser version of it), consult
Section 3.2.7, "Functions That Do Not Have Unique Values".  And
consider the following:

In[1]:= (-125)^(1/3)
Out[1]= 5 (-1)^(1/3)

There's the crux: there are THREE complex roots of -1:

In[2]:= Solve[z^3 == -1, z]/.(a_->b_):>(a->ComplexExpand[b]) Out[2] =
{{z -> -1}, {z -> 1/2 + I Sqrt[3]/2}, {z -> 1/2 - I Sqrt[3]/2}}

[The slightly complicated delayed replacement rule 

     (a_->b_):>(a->ComplexExpand[b])

in the preceding expression takes care of replacing each of the three
replacement rules for the cube roots of -1 with their "x + I y"
Cartesian forms.]
  
Which of these three complex roots of -1 should be used?  Mathematica
simply refuses to make the decision for you.  

You can force the decision in a particular computation, e.g.:

In[3]:= (-125)^(1/3) /. (-1)^(1/3) -> -1 Out[3] = -5

But that sort of thing won't, so far as I can see, help with your
plotting problem.  Here's one thing that will help -- use the Standard
AddOn package Miscellaneous`RealOnly` as follows:

In[4]:= Needs["Miscellaneous`RealOnly`"]

In[5]:= (-125)^(1/3)
Out[5]= -5

And now the Plot expression 

In[6]:= Plot[x^(1/3), {x, -125, 125}]

will give you the real-numbers-only plot that you "naively" expected.

Of course using the package Miscellaneous`RealOnly` could be dangerous
if you were doing further computatations at the same session where you
need to see the non-real, complex possibilities.

Problems such as you raise are interesting:  not only do they show how
frustrating it can sometimes be to do with a CAS like Mathematica what
is easy with paper-and-pencil; they also can lead one deeper into
mathematics.

P.S. A certain specialist in complex analysis, speaking about "spaces"
(topological spaces, I believe it was), once was reported to have said:
"There are only two topological spaces in which I actually believe --
the real numbers and the complex numbers.  And sometimes I'm not too
sure about the real numbers."

 
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

-- 
  Murray Eisenberg                  Internet:  murray at math.umass.edu
  Mathematics & Statistics Dept.    Voice:  413-545-2859 (W)
  University of Massachusetts               413-549-1020 (H)
  Amherst, MA 01003                 Fax:    413-545-1801


  • Prev by Date: Re: MultipleListPlot Problem
  • Next by Date: Re: Contour Plotting on a sphere
  • Previous by thread: Re: MultipleListPlot Problem
  • Next by thread: Re: Contour Plotting on a sphere