MathGroup Archive 2012

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

Search the Archive

Re: Unexpected Output When Plotting...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125500] Re: Unexpected Output When Plotting...
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Thu, 15 Mar 2012 00:37:15 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jjpb6t$p8g$1@smc.vnet.net>

James Kochanski 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}]
>

This is because Mathematica always uses the principal root, eg.:

(-8)^(1/3)//ComplexExpand  yields 1+I Sqrt[3]

and Complex Values aren't displayed with Plot.

You may use the following little Funktion:

Attributes[realPower] = {Listable, NumericFunction, OneIdentity}
realPower[b_?Negative, Rational[m_, n_?OddQ]] := (-(-b)^(1/n))^m
realPower[x_, y_] := Power[x, y]

Then Plot[Cos[realPower[x^3+1,1/3]],{x,-10,10}] will plot the whole range.

-- 
_________________________________________________________________
Peter Breitfeld | Bad Saulgau, Germany | http://www.pBreitfeld.de



  • Prev by Date: Re: How can I make a sequence that includes lists?
  • Next by Date: Re: How can I make a sequence that includes lists?
  • Previous by thread: Re: Unexpected Output When Plotting...
  • Next by thread: Mathematica and square roots