MathGroup Archive 2011

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

Search the Archive

Re: How to plot derivative directly?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118079] Re: How to plot derivative directly?
  • From: Richard Hofler <rhofler at bus.ucf.edu>
  • Date: Tue, 12 Apr 2011 05:54:29 -0400 (EDT)

Hello Jakub,

In[9]:= deriv=D[x^3-6 (x+1)^2+x-7,x];
plot1 = Plot[deriv,{x,-3,8}]

An alternative method with Evaluate inserted:
In[11]:= plot2 = Plot[Evaluate[D[x^3-6 (x+1)^2+x-7,x]],{x,-3,8}]

The two plots are the same.
In[12]:= plot1==plot2
Out[12]= True

Richard Hofler
________________________________________
From: =8Aer=FDch Jakub [Serych at panska.cz]
Sent: Monday, April 11, 2011 7:05 AM
To: mathgroup at smc.vnet.net
Subject: [mg118079] [mg118061] How to plot derivative directly?

Dear mathgroup,

it seems to me, that response to my question shall be very simple,
but I cannot find it. :-(

I want to plot the derivative of the function. I would like to do it
directly, something like:

Plot[D[x^3 - 6 (x + 1)^2 + x - 7, x],{x,-3,8}]

It returns: General::ivar: "-2.99978 is not a valid variable."

I can understand that it is because local variable x from Plot command
interferes with the x variable from the D[].

Yes I can bypass the problem by:
deriv = D[x^3 - 6 (x + 1)^2 + x - 7, x]
Plot[deriv, {x, -3, 8}]

which is fully functional, but as far as I know Mathematica, there must
be some simple solution how to do it directly inside the Plot[].

Thanks in advance for kick-off

Jakub


  • Prev by Date: Re: How to plot derivative directly?
  • Next by Date: Re: How to plot derivative directly?
  • Previous by thread: Re: How to plot derivative directly?
  • Next by thread: Re: How to plot derivative directly?