> ?diff diff or Diff - Differentiation or Partial Differentiation Calling Sequence: diff(a, x1, x2, ..., xn) Diff(a, x1, x2, ..., xn) diff(a, [x1, x2, ..., xn]) Diff(a, [x1, x2, ..., xn]) Parameters: a - an algebraic expression x1, x2, ..., xn - names Description: - diff 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. - Note that where n is greater than 1, the call to diff is the same as diff called recursively. Thus diff(f(x), x, y); is equivalent to the call diff(diff (f(x), x), y); - 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. - 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. In this case, the result is simply the original expression, a. This format is especially useful when used together with the sequence operator and sequences with potentially zero variables. - 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 d/dx format.) - The diff command assumes that partial derivatives commute. - The capitalized function name Diff is the inert diff function, which simply returns unevaluated. The prettyprinter understands Diff to be equivalent to diff for printing purposes but formats the derivative in black to visually distinguish the inert case. - The differential operator D is also defined in Maple; see D. For a comparison of D and diff see operators[D]. Examples: > diff(sin(x),x); cos(x) > diff(sin(x),y); 0 > diff(sin(x),x$3); -cos(x) > diff(x*sin(cos(x)),x); sin(cos(x)) - x cos(cos(x)) sin(x) > diff(tan(x),x); 2 1 + tan(x) > Diff(tan(x),x); d -- tan(x) dx > Diff(tan(x),x) = diff(tan(x),x); d 2 -- tan(x) = 1 + tan(x) dx > diff(f(x),x); d -- f(x) dx > diff(f(x,y),x,y); 2 d ----- f(x, y) dy dx > diff(f(x,y),x,y) - diff(f(x,y),y,x); 0 # These two forms are equivalent: > diff(g(x,y,z),x,z,z); 3 d ------ g(x, y, z) 2 dz dx > diff(g(x,y,z),[x,z,z]); 3 d ------ g(x, y, z) 2 dz dx # An empty list specifies no derivatives: > diff(g(x,y,z),[]); g(x, y, z) # teach Maple how to differentiate f(g(x)) = diff(g(x),x)/f(x)^2 > `diff/f` := proc(g,x) diff(g,x)/f(x)^2 end: > diff(f(x),x); d -- f(x) dx > diff(f(sin(x)),x); cos(x) ------ 2 f(x) See Also: D, int, dsolve, $, implicitdiff, operators[D]