differentiation or partial differentiation
inert form of diff
diff(f, x1, ..., xj)
diff(f, x1$n, [x2$n, x3], ..., xj, [xk$m])
Remark: these calling sequences are also valid with the inert Diff command
algebraic expression or an equation
x1, x2, ..., xj
names representing differentiation variables
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.
Find higher order derivatives.
Compute partial derivatives.
h ≔ 5⁢x2+2⁢x2⁢y+3⁢x⁢y2+12⁢y⁢x+3⁢y3x
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).
An empty list specifies no derivatives:
Teach Maple how to differentiate f⁡g⁡x = ⅆⅆxg⁡xf⁡x2
`diff/f` := proc(g,x) diff(g,x)/f(x)^2 end proc:
Symbolic order differentiation is also handled. For example, for arbitrary integer values of n,
Inert objects can be evaluated with the value command.
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
The Leibniz rule for the nth derivative of a product
symbolic order differentiation
Download Help Document