diff
differentiation or partial differentiation
Diff
inert form of diff
Calling Sequence
Parameters
Description
Examples
diff(f, x1, ..., xj)
ⅆjⅆxj⁢...⁢ⅆx1⁢f
diff(f, [x1$n])
ⅆnⅆx1n⁢f
diff(f, x1$n, [x2$n, x3], ..., xj, [xk$m])
ⅆrⅆxkm⁢ⅆxj⁢...⁢ⅆx3⁢ⅆx2n⁢ⅆx1n⁢f
Remark: these calling sequences are also valid with the inert Diff command
f
-
algebraic expression or an equation
x1, x2, ..., xj
names representing differentiation variables
n
algebraic expression entering constructions like x$n, representing nth order derivative, assumed to be integer order differentiation
The diff command computes the partial derivative of the expression f with respect to x1, x2, ..., xn, respectively. The most frequent use is diff(f(x),x), which computes the derivative of the function f(x) with respect to x.
You can enter the command diff using either the 1-D or 2-D calling sequence. For example, diff(x, x) is equivalent to ⅆxⅆx.
Note that where j in xj is greater than 1, the call to diff is the same as diff called recursively. Thus diff(f(x1,x2), x1, x2); is equivalent to the call diff(diff (f(x1,x2), x1), x2). The sequence operator $ is useful for forming higher-order derivatives. diff(f(x),x$4), for example, is equivalent to diff(f(x),x,x,x,x) and diff(g(x,y),x$2,y$3) is equivalent to diff(g(x,y),x,x,y,y,y)
The names with respect to which the differentiation is to be done can also be given as a list of names. This format allows for the special case of differentiation with respect to no variables, in the form of an empty list, so the zeroth order derivative is handled through diff(f,[x$0]) = diff(f,[]). In this case, the result is simply the original expression, f. This format is especially useful when used together with the sequence operator and sequences with potentially zero variables.
Derivatives of nth order, where n is not specified as a number, can be constructed as in diff(f(x),[x$n]) and are interpreted as integer order derivatives, that is, computed assuming n is an integer. The routines for computing these symbolic nth order derivatives can handle most functions of the mathematical language and an increasing number of expressions formed by composing them with other functions or algebraic expressions. The results are returned in closed form or as finite sums - see the Examples section.
diff has a user interface that will call the user's own differentiation functions. If the procedure `diff/f` is defined, then the function call diff(f(x, y, z), y) will invoke `diff/f`(x,y,z,y) to compute the derivative. See example below.
If the derivative cannot be expressed (if the expression is an undefined function), the diff function call itself is returned. (The prettyprinter displays the diff function in a two-dimensional ⅆⅆx format.)
The diff command assumes that partial derivatives commute.
The capitalized function name Diff is the inert diff function, which simply returns unevaluated. It appears gray so that it is easily distinguished from a returned diff calling sequence.
The differential operator D is also defined in Maple; see D. For a comparison of D and diff see operators[D].
Compute first order derivatives.
diff⁡x,x
1
diff⁡exp⁡x,x
ⅇx
diff⁡sin⁡x,x
cos⁡x
diff⁡tan⁡x,x
1+tan⁡x2
diff⁡sqrt⁡x2,x
xx2
diff⁡x⁢sin⁡cos⁡x,x
sin⁡cos⁡x−x⁢sin⁡x⁢cos⁡cos⁡x
Find higher order derivatives.
diff⁡sin⁡x,`$`⁡x,3
−cos⁡x
diff⁡3⁢x3+2⁢x2+23⁢x+2342,`$`⁡x,2
18⁢x+4
Compute partial derivatives.
diff⁡sin⁡x,y
0
diff⁡x2+x⁢y2,x
y2+2⁢x
diff⁡2⁢x+y2,y
2⁢y
diff⁡x2+x⁢y2,x,y
h≔5⁢x2+2⁢x2⁢y+3⁢x⁢y2+12⁢y⁢x+3⁢y3x
diff⁡h,x,y
4⁢x+6⁢y+12−9⁢y2x2
diff⁡h,y,x
diff⁡h,`$`⁡y,3
18x
The Diff command is inert, it returns unevaluated.
Note: To enter the 2-D calling sequence of the Diff command, type Diff at the input, press Esc, and then select Diff(inline).
Diff⁡tan⁡x,x
ⅆⅆxtan⁡x
Diff⁡tan⁡x,x=diff⁡tan⁡x,x
ⅆⅆxtan⁡x=1+tan⁡x2
diff⁡f⁡x,x
ⅆⅆxf⁡x
diff⁡f⁡x,y,x,y
∂2∂x∂yf⁡x,y
diff⁡f⁡x,y,x,y−diff⁡f⁡x,y,y,x
An empty list specifies no derivatives:
diff⁡g⁡x,y,z,
g⁡x,y,z
Teach Maple how to differentiate f⁡g⁡x = ⅆⅆxg⁡xf⁡x2
`diff/f` := proc(g,x) diff(g,x)/f(x)^2 end proc:
diff⁡f⁡sin⁡x,x
cos⁡xf⁡x2
Symbolic order differentiation is also handled. For example, for arbitrary integer values of n,
Diff⁡sin⁡x,`$`⁡x,n
ⅆnⅆxnsin⁡x
Inert objects can be evaluated with the value command.
value⁡
sin⁡x+n⁢π2
Note that in the context of a call to diff (or Diff), n entering ⅆnⅆxnf⁡x is understood to be an integer; that is: diff computes integer order derivatives. To compute fractional derivatives see fracdiff.
A more involved example
Diff⁡exp⁡x2,`$`⁡x,n
ⅆnⅆxnⅇx2
x−n⁢2n⁢MeijerG⁡0,12,,0,12+n2,n2,−x2
The Leibniz rule for the nth derivative of a product
Diff⁡f⁡x⁢g⁡x,`$`⁡x,n
ⅆnⅆxnf⁡x⁢g⁡x
∑_k1=0n⁡n_k1⁢ⅆ_k1ⅆx_k1f⁡x⁢ⅆn−_k1ⅆxn−_k1g⁡x
See Also
$
D
dsolve
ExtendingMaple
fracdiff
implicitdiff
int
operators[D]
symbolic order differentiation
Download Help Document