Re: Unexpected Output When Plotting...
- To: mathgroup at smc.vnet.net
- Subject: [mg125499] Re: Unexpected Output When Plotting...
- From: Ray Koopman <koopman at sfu.ca>
- Date: Thu, 15 Mar 2012 00:36:54 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jjpb6t$p8g$1@smc.vnet.net>
On Mar 13, 10:43 pm, James Kochanski <jwkochan... at mymail.vcu.edu>
wrote:
> Can anyone explain to me why Graphs #5 and #6 (please see below) do not include any output for x < 0 and x < -1, respectively?
>
> Thanks!
>
> Jim Kochanski
>
> Following graphs are plotted from x = -10 to x = 10
> Graph #1 : Plot[Cos[x], {x, -10, 10}]
> Graph #2 : Plot[Cos[x + 1], {x, -10, 10}]
> Graph #3 : Plot[Cos[x^3], {x, -10, 10}]
> Graph #4 : Plot[Cos[x^3 + 1], {x, -10, 10}]
>
> Following graph is only plotted from x = 0 to x = 10
> Graph #5 : Plot[Cos[(x^3)^(1/3)], {x, -10, 10}]
>
> Following graph is only plotted from x = -1 to x = 10
> Graph #6 : Plot[Cos[(x^3 + 1)^(1/3)], {x, -10, 10}]
The problem is that you're asking for cube roots of negative values,
which give complex values where you want negative reals.
To get negative reals, define
qbrt = Piecewise[{{-(-#)^(1/3),#<0}},#^(1/3)]& ,
then change #^(1/3) in your code to qbrt[#] .