PDA

View Full Version : Mathematica assign derivative


daudaudaudau
Oct20-08, 07:37 PM
Hi. A quick mathematica question. If I compute a derivative using D[f[x],x], how can I assign this result to another function, e.g. I want g[x]=f'[x] using the D-notation. Thanks.

JeffNYC
Oct20-08, 08:22 PM
This what you mean?

In[1]:= j = x^2

Out[1]= x^2

In[2]:= e = D[j, x]

Out[2]= 2 x

In[3]:= f = D[e, x]

Out[3]= 2

In[4]:= ff = D[f, x]

Out[4]= 0

adriank
Oct21-08, 03:00 AM
g[x_] = D[f[x], x]

Note the underscore in g[x_].

(Alternatively, you could just do g = f')