# diff

diff('expression','variable','order') - Differentiate.

If the 'order' is omitted, the first order derivative is assumed.

The function is used to perform symbolic or numeric derivatives. It can be inserted by typing diff( or from the Function palette under Derivative template (this is simpler).

Chose the Derivative template and insert in the 'variable' placeholder x and in the 'expression' placeholder x2. After that press CTRL+. (symbolic calculation). You should obtain this result: We could have defined the 'expression' f first in variable x and y, for instance: and found the first derivatives over the variables (partial derivatives, actually): How to obtain the higher order derivatives? Press comma after the 'variable' and in the obtained placeholder insert the 'order' (integer). Here are the second derivatives: Here are mixed derivatives as well: Instead of an expression we could have defined a function and repeat the procedure: Numerical derivatives are found at the given values. For instance: Very important SMath feature is ability to find the derivatives over the elements of a vector (matrix). Here is an example of finding Jacobi matrix and Jacobian: 