此为 Mathematica 7 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.2)

Defining Derivatives

You can define the derivative in Mathematica of a function f of one argument simply by an assignment like f'[x_]=fp[x].
This defines the derivative of f (x) to be fp (x). In this case, you could have used = instead of :=.
In[1]:=
Click for copyable input
The rule for f'[x_] is used to evaluate this derivative.
In[2]:=
Click for copyable input
Out[2]=
Differentiating again gives derivatives of fp.
In[3]:=
Click for copyable input
Out[3]=
This defines a value for the derivative of g at the origin.
In[4]:=
Click for copyable input
Out[4]=
The value for g'[0] is used.
In[5]:=
Click for copyable input
Out[5]=
This defines the second derivative of g, with any argument.
In[6]:=
Click for copyable input
Out[6]=
The value defined for the second derivative is used.
In[7]:=
Click for copyable input
Out[7]=
To define derivatives of functions with several arguments, you have to use the general representation of derivatives in Mathematica.
f'[x_]:=rhsdefine the first derivative of f
Derivative[n][f][x_]:=rhsdefine the nth derivative of f
Derivative[m,n,...][g][x_,_,...]:=rhs
define derivatives of g with respect to various arguments

Defining derivatives.

This defines the second derivative of g with respect to its second argument.
In[8]:=
Click for copyable input
This uses the definition just given.
In[9]:=
Click for copyable input
Out[9]=