 Diff - Maple Help

diff

differentiation or partial differentiation

Diff

inert form of diff Calling Sequence

 diff(f, x1, ..., xj) $\frac{{ⅆ}^{j}}{ⅆ{x}_{j}\mathrm{...}ⅆ{x}_{1}}f$ diff(f, [x1$n]) $\frac{{ⅆ}^{n}}{ⅆ{x}_{1}^{n}}f$ diff(f, x1$n, [x2$n, x3], ..., xj, [xk$m]) $\frac{{ⅆ}^{r}}{ⅆ{x}_{k}^{m}ⅆ{x}_{j}\mathrm{...}ⅆ{x}_{3}ⅆ{x}_{2}^{n}ⅆ{x}_{1}^{n}}f$

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 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 $\frac{ⅆ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 $\frac{ⅆ}{ⅆ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]. Examples Compute first order derivatives.  > $\frac{ⅆ}{ⅆx}x$  ${1}$ (1)  > $\frac{ⅆ}{ⅆx}{ⅇ}^{x}$  ${{ⅇ}}^{{x}}$ (2)  > $\frac{ⅆ}{ⅆx}\mathrm{sin}\left(x\right)$  ${\mathrm{cos}}{}\left({x}\right)$ (3)  > $\frac{ⅆ}{ⅆx}\mathrm{tan}\left(x\right)$  ${1}{+}{{\mathrm{tan}}{}\left({x}\right)}^{{2}}$ (4)  > $\frac{ⅆ}{ⅆx}\sqrt{{x}^{2}}$  $\frac{{x}}{\sqrt{{{x}}^{{2}}}}$ (5)  > $\frac{ⅆ}{ⅆx}\left(x\mathrm{sin}\left(\mathrm{cos}\left(x\right)\right)\right)$  ${\mathrm{sin}}{}\left({\mathrm{cos}}{}\left({x}\right)\right){-}{x}{}{\mathrm{sin}}{}\left({x}\right){}{\mathrm{cos}}{}\left({\mathrm{cos}}{}\left({x}\right)\right)$ (6) Find higher order derivatives.  > $\frac{{ⅆ}^{3}}{ⅆ{x}^{3}}\mathrm{sin}\left(x\right)$  ${-}{\mathrm{cos}}{}\left({x}\right)$ (7)  > $\frac{{ⅆ}^{2}}{ⅆ{x}^{2}}\left(3{x}^{3}+2{x}^{2}+23x+2342\right)$  ${18}{}{x}{+}{4}$ (8) Compute partial derivatives.  > $\frac{\partial }{\partial y}\mathrm{sin}\left(x\right)$  ${0}$ (9)  > $\frac{\partial }{\partial x}\left({x}^{2}+x{y}^{2}\right)$  ${{y}}^{{2}}{+}{2}{}{x}$ (10)  > $\frac{\partial }{\partial y}\left(2x+{y}^{2}\right)$  ${2}{}{y}$ (11)  > $\frac{{\partial }^{2}}{\partial y\partial x}\left({x}^{2}+x{y}^{2}\right)$  ${2}{}{y}$ (12)  > $h≔5{x}^{2}+2{x}^{2}y+3x{y}^{2}+12yx+\frac{3{y}^{3}}{x}$  ${h}{≔}{5}{}{{x}}^{{2}}{+}{2}{}{{x}}^{{2}}{}{y}{+}{3}{}{x}{}{{y}}^{{2}}{+}{12}{}{y}{}{x}{+}\frac{{3}{}{{y}}^{{3}}}{{x}}$ (13)  > $\frac{{\partial }^{2}}{\partial y\partial x}h$  ${4}{}{x}{+}{6}{}{y}{+}{12}{-}\frac{{9}{}{{y}}^{{2}}}{{{x}}^{{2}}}$ (14)  > $\frac{{\partial }^{2}}{\partial x\partial y}h$  ${4}{}{x}{+}{6}{}{y}{+}{12}{-}\frac{{9}{}{{y}}^{{2}}}{{{x}}^{{2}}}$ (15)  > $\mathrm{diff}\left(h,y$3\right)$
 $\frac{{18}}{{x}}$ (16)

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).

 > $\frac{{ⅆ}}{{ⅆ}x}\mathrm{tan}\left(x\right)$
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{tan}}{}\left({x}\right)$ (17)
 > $\frac{{ⅆ}}{{ⅆ}x}\mathrm{tan}\left(x\right)=\frac{ⅆ}{ⅆx}\mathrm{tan}\left(x\right)$
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{tan}}{}\left({x}\right){=}{1}{+}{{\mathrm{tan}}{}\left({x}\right)}^{{2}}$ (18)
 > $\frac{ⅆ}{ⅆx}f\left(x\right)$
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}\right)$ (19)
 > $\frac{{\partial }^{2}}{\partial y\partial x}f\left(x,y\right)$
 $\frac{{{\partial }}^{{2}}}{{\partial }{x}{\partial }{y}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right)$ (20)
 > $\frac{{\partial }^{2}}{\partial y\partial x}f\left(x,y\right)-\left(\frac{{\partial }^{2}}{\partial x\partial y}f\left(x,y\right)\right)$
 ${0}$ (21)

An empty list specifies no derivatives:

 > $\mathrm{diff}\left(g\left(x,y,z\right),\left[\right]\right)$
 ${g}{}\left({x}{,}{y}{,}{z}\right)$ (22)

Teach Maple how to differentiate $f\left(g\left(x\right)\right)$ = $\frac{\frac{ⅆ}{ⅆx}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}g\left(x\right)}{{f\left(x\right)}^{2}}$

 > diff/f := proc(g,x) diff(g,x)/f(x)^2 end proc:
 > $\frac{ⅆ}{ⅆx}f\left(\mathrm{sin}\left(x\right)\right)$
 $\frac{{\mathrm{cos}}{}\left({x}\right)}{{{f}{}\left({x}\right)}^{{2}}}$ (23)

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

 > $\mathrm{Diff}\left(\mathrm{sin}\left(x\right),x$n\right)$  $\frac{{{ⅆ}}^{{n}}}{{ⅆ}{{x}}^{{n}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{sin}}{}\left({x}\right)$ (24) Inert objects can be evaluated with the value command.  > $\mathrm{value}\left(\right)$  ${\mathrm{sin}}{}\left({x}{+}\frac{{n}{}{\mathrm{\pi }}}{{2}}\right)$ (25) Note that in the context of a call to diff (or Diff), n entering $\frac{{ⅆ}^{n}}{ⅆ{x}^{n}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}f\left(x\right)$ is understood to be an integer; that is: diff computes integer order derivatives. To compute fractional derivatives see fracdiff. A more involved example  > $\mathrm{Diff}\left(\mathrm{exp}\left({x}^{2}\right),x$n\right)$
 $\frac{{{ⅆ}}^{{n}}}{{ⅆ}{{x}}^{{n}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{ⅇ}}^{{{x}}^{{2}}}$ (26)
 > $\mathrm{value}\left(\right)$
 ${{x}}^{{-}{n}}{}{{2}}^{{n}}{}{\mathrm{MeijerG}}{}\left(\left[\left[{0}{,}\frac{{1}}{{2}}\right]{,}\left[\right]\right]{,}\left[\left[{0}\right]{,}\left[\frac{{1}}{{2}}{+}\frac{{n}}{{2}}{,}\frac{{n}}{{2}}\right]\right]{,}{-}{{x}}^{{2}}\right)$ (27)

The Leibniz rule for the nth derivative of a product

 > $\mathrm{Diff}\left(f\left(x\right)g\left(x\right),x\$n\right)$
 $\frac{{{ⅆ}}^{{n}}}{{ⅆ}{{x}}^{{n}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({f}{}\left({x}\right){}{g}{}\left({x}\right)\right)$ (28)
 > $\mathrm{value}\left(\right)$
 ${\sum }_{{\mathrm{_k1}}{=}{0}}^{{n}}{}\left(\genfrac{}{}{0}{}{{n}}{{\mathrm{_k1}}}\right){}\left(\frac{{{ⅆ}}^{{\mathrm{_k1}}}}{{ⅆ}{{x}}^{{\mathrm{_k1}}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}\right)\right){}\left(\frac{{{ⅆ}}^{{n}{-}{\mathrm{_k1}}}}{{ⅆ}{{x}}^{{n}{-}{\mathrm{_k1}}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{g}{}\left({x}\right)\right)$ (29)