diff or Diff  differentiation or partial differentiation

Calling Sequence


diff(f, x1, ..., xj)


diff(f, [x1$n])


diff(f, x1$n, [x2$n, x3], ..., xj, [xk$m])




Remark: these calling sequences are also valid with the inert Diff command


Parameters


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





Description


•

The diff command computes the partial
derivative
of the expression a 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 1D or 2D calling sequence. For example, diff(x, x) is equivalent to .

•

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 higherorder 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 twodimensional 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].



Examples


>


 (1) 
>


 (2) 
>


 (3) 
>


 (4) 
>


 (5) 
>


 (6) 
Find higher order derivatives.
>


 (7) 
>


 (8) 
Compute partial derivatives.
>


 (9) 
>


 (10) 
>


 (11) 
>


 (12) 
>


 (13) 
>


 (14) 
>


 (15) 
>


 (16) 
The Diff command is inert, it returns unevaluated.
>


 (17) 
>


 (18) 
>


 (19) 
>


 (20) 
>


 (21) 
An empty list specifies no derivatives:
>


 (22) 
Teach Maple how to differentiate =
>

`diff/f` := proc(g,x) diff(g,x)/f(x)^2 end proc:

>


 (23) 
Symbolic order differentiation is also handled. For example, for arbitrary integer values of n,
>


 (24) 
Inert objects can be evaluated with the value command.
>


 (25) 
Note that in the context of a call to diff (or Diff), n entering is understood to be an integer; that is: diff computes integer order derivatives. To compute fractional derivatives see fracdiff.
A more involved example
>


 (26) 
>


 (27) 
The Leibniz rule for the nth derivative of a product
>


 (28) 
>


 (29) 

