differentiation or partial differentiation - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Group Theory : Inert Functions : diff

diff or Diff - differentiation or partial differentiation

Calling Sequence

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

ⅆjⅆxj...ⅆx1f

diff(f, [x1$n])

ⅆnⅆx1nf

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

ⅆrⅆxkmⅆxj...ⅆx3ⅆx2nⅆx1nf

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 1-D or 2-D calling sequence. For example, diff(x, x) is equivalent to ⅆⅆxx.

• 

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

Examples

ⅆⅆxx

1

(1)

ⅆⅆxⅇx

ⅇx

(2)

ⅆⅆxsinx

cosx

(3)

ⅆⅆxtanx

1+tanx2

(4)

ⅆⅆxx2

xx2

(5)

ⅆⅆxxsincosx

sincosxxsinxcoscosx

(6)

Find higher order derivatives.

ⅆ3ⅆx3sinx

cosx

(7)

ⅆ2ⅆx23x3+2x2+23x+2342

18x+4

(8)

Compute partial derivatives.

ysinx

0

(9)

xx2+xy2

y2+2x

(10)

y2x+y2

2y

(11)

2yxx2+xy2

2y

(12)

h:=5x2+2x2y+3xy2+12yx+3y3x

h:=5x2+2x2y+3xy2+12yx+3y3x

(13)

2yxh

4x+6y+129y2x2

(14)

2xyh

4x+6y+129y2x2

(15)

diffh,y$3

18x

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

ⅆⅆxtanx

ⅆⅆxtanx

(17)

ⅆⅆxtanx=ⅆⅆxtanx

ⅆⅆxtanx=1+tanx2

(18)

ⅆⅆxfx

ⅆⅆxfx

(19)

2yxfx,y

2yxfx,y

(20)

2yxfx,y2xyfx,y

0

(21)

An empty list specifies no derivatives:

diffgx,y,z,

gx,y,z

(22)

Teach Maple how to differentiate fgx = ⅆⅆxgxfx2

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

ⅆⅆxfsinx

cosxfx2

(23)

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

Diffsinx,x$n

ⅆnⅆxnsinx

(24)

Inert objects can be evaluated with the value command.

value

sinx+12nπ

(25)

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

A more involved example

Diffexpx2,x$n

ⅆnⅆxnⅇx2

(26)

value

xn2nMeijerG0,12,,0,12+12n,12n,x2

(27)

The Leibniz rule for the nth derivative of a product

Difffxgx,x$n

ⅆnⅆxnfxgx

(28)

value

_k1=0nbinomialn,_k1ⅆ_k1ⅆx_k1fxⅆn_k1ⅆxn_k1gx

(29)

See Also

$, D, dsolve, ExtendingMaple, fracdiff, implicitdiff, int, operators[D], symbolic order differentiation


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam