### The Maxima on-line user's manual

Algebra Calculator

#### Diff

Function: diff (<expr>, <x_1>, <n_1>, ..., <x_m>, <n_m>)

Function: diff (<expr>, <x>, <n>)

Function: diff (<expr>, <x>)

Function: diff (<expr>) Returns the derivative or differential of <expr> with respect to some or all variables in <expr>.

`diff (<expr>, <x>, <n>)` returns the <n>th derivative of <expr> with respect to <x>.

`diff (<expr>, <x_1>, <n_1>, ..., <x_m>, <n_m>)` returns the mixed partial derivative of <expr> with respect to <x_1>, ..., <x_m>. It is equivalent to `diff (... (diff (<expr>, <x_m>, <n_m>) ...), <x_1>, <n_1>)`.

`diff (<expr>, <x>)` returns the first derivative of <expr> with respect to the variable <x>.

`diff (<expr>)` returns the total differential of <expr>, that is, the sum of the derivatives of <expr> with respect to each its variables times the differential `del` of each variable. No further simplification of `del` is offered.

The noun form of `diff` is required in some contexts, such as stating a differential equation. In these cases, `diff` may be quoted (as diff) to yield the noun form instead of carrying out the differentiation.

When `derivabbrev` is `true`, derivatives are displayed as subscripts. Otherwise, derivatives are displayed in the Leibniz notation, `dy/dx`.

Examples:

```          (%i1) diff (exp (f(x)), x, 2);
2
f(x)  d               f(x)  d         2
(%o1)       %e     (--- (f(x))) + %e     (-- (f(x)))
2                   dx
dx
(%i2) derivabbrev: true\$
(%i3) integrate (f(x, y), y, g(x), h(x));
h(x)
/
[
(%o3)                   I     f(x, y) dy
]
/
g(x)
(%i4) diff (%, x);
h(x)
/
[
(%o4) I     f(x, y)  dy + f(x, h(x)) h(x)  - f(x, g(x)) g(x)
]            x                     x                  x
/
g(x)```

For the tensor package, the following modifications have been incorporated:

(1) The derivatives of any indexed objects in <expr> will have the variables <x_i> appended as additional arguments. Then all the derivative indices will be sorted.

(2) The <x_i> may be integers from 1 up to the value of the variable `dimension` [default value: 4]. This will cause the differentiation to be carried out with respect to the <x_i>th member of the list `coordinates` which should be set to a list of the names of the coordinates, e.g., `[x, y, z, t]`. If `coordinates` is bound to an atomic variable, then that variable subscripted by <x_i> will be used for the variable of differentiation. This permits an array of coordinate names or subscripted names like `X[1]`, `X[2]`, ... to be used. If `coordinates` has not been assigned a value, then the variables will be treated as in (1) above.

There are also some inexact matches for `diff`. Try `?? diff` to see them.

```(%o1)                                true
(%i2) ```

### Related Articles

How to create Hessian matrix

### Related Examples

##### diff-factor

f(x):=((x+3)*(x-3))/(...

factor(diff(f(x),x));

g(x):=-((3*x^3+2*x^2-...

Calculate

##### diff

f(x):=1*x^2+11*x-20/1...

diff(f(x),x);

g(x):=11-38*xdiff(g(x...

Calculate

##### diff-euler-ratsimp-solve-subst

f: (y-x^2)^n + (yp-x^...

dfyp: diff( f, yp);

euler: diff(f, y) - s...

Calculate

0.5 + 0.1 * -3*0.1;

dt: 0.01;

Calculate

##### diff-sin-solve-sqrt

solve((diff(sin(2*x+s...

Calculate

##### diff-ode2

eq1:'diff(y,x)=((3*x^...

ode2(eq1,y,x);

Calculate

##### diff-integrate-plot2d-ratsimp

F(x) := x;

f(x) := ''(diff(F(x),...

q(x,K) := (K+x)/3;

Calculate

##### diff-sin

diff(sin(x^2),x);

Calculate

##### diff

f:(b*x^3+c*x^2 +x -d)/x;

diff(f,x);

Calculate

##### diff-factor-rat

res:[0,0,0,x,y,z],res...

Calculate