Diff Function
diff('expression','variable','order') differentiates. If 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 the Derivative template (this is simpler).
Choose the Derivative template and insert x in the 'variable' placeholder and x² in the 'expression' placeholder. Then press CTRL+. (symbolic calculation). You should get this result:

We could also have first defined the expression f in terms of x and y, for instance:

and then found the first derivatives with respect to each variable (partial derivatives, in this case):

To get higher-order derivatives, press comma after the 'variable' and insert the 'order' (an integer) in the resulting placeholder. Here are the second derivatives:

Mixed derivatives work the same way:

Instead of an expression, you could define a function and repeat the procedure:

Numerical derivatives are evaluated at the given values. For instance:

A very important SMath feature is the ability to find derivatives over the elements of a vector (matrix). Here is an example of finding the Jacobi matrix and the Jacobian:

This page is based on a legacy wiki article by Radovan Omorjan.