Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1639

Re: How to plot derivative directly?

From Richard Hofler <rhofler@bus.ucf.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to plot derivative directly?
Date 2011-04-12 09:52 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <io17dl$i4c$1@smc.vnet.net> (permalink)

Show all headers | View raw


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@panska.cz]
Sent: Monday, April 11, 2011 7:05 AM
Subject:  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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: How to plot derivative directly? Richard Hofler <rhofler@bus.ucf.edu> - 2011-04-12 09:52 +0000

csiph-web