Re: Plot results not right
- To: mathgroup at smc.vnet.net
- Subject: [mg89968] Re: Plot results not right
- From: Helen Read <hpr at together.net>
- Date: Wed, 25 Jun 2008 06:28:53 -0400 (EDT)
- References: <g3nhbc$g6$1@smc.vnet.net> <g3q7od$am7$1@smc.vnet.net>
- Reply-to: HPR <read at math.uvm.edu>
Jean-Marc Gulliet wrote: > BrenB wrote: > >> I'm studying Calculus, and I'm trying to reproduce, in Mathematica, >> the graph results of an equation in my book. >> >> Plot[2 x - 3 x^(2/3) + 4, {x, -1, 6}] >> >> The output graph is correct, except there should be graphing in the >> 2nd and 3rd quadrant, and there is none. >> >> Is there another way to enter this equation into Mathematica to get >> the correct graph results? > > Are you sure that the function you want to plot is this one? I might > have missed something, but, since you mentioned you are taking a class > in Calculus, I think you are studying real functions of a real variable > (i.e. functions from R to R). > > The function f[x_] := 2 x - 3 x^(2/3) + 4 is defined on R+ only (i.e. > for x positive or null) and is positive on this interval. Thus the > function is always above the x-axis and can be drawn (or make sense) > only for x >= 0. This isn't true. x^(2/3) is defined for all reals, provided you take the real cube root of x as we do in calculus class. Mathematica, however, by default takes the principal root, which is complex for x<0, which is why it doesn't plot anything for x<0. Unfortunately, there isn't an option one can set that would force Mathematica to take the real root, but as I and several others pointed out, you can get around it in this example by plotting 2x - 3(x^2)^(1/3) + 4. As another example, where the power is rational with numerator and denominator both odd, say x^(5/3), you can get the desired result for x<0 by plotting Sign[x] Abs[x]^(5/3) -- Helen Read University of Vermont