10.5.1 Differentiation

The a d (calc-derivative) [deriv] command computes the derivative of the expression on the top of the stack with respect to some variable, which it will prompt you to enter. Normally, variables in the formula other than the specified differentiation variable are considered constant, i.e., ‘deriv(y,x)’ is reduced to zero. With the Hyperbolic flag, the tderiv (total derivative) operation is used instead, in which derivatives of variables are not reduced to zero unless those variables are known to be “constant,” i.e., independent of any other variables. (The built-in special variables like pi are considered constant, as are variables that have been declared const; see Declarations.)

With a numeric prefix argument n, this command computes the nth derivative.

When working with trigonometric functions, it is best to switch to Radians mode first (with m r). The derivative of ‘sin(x)’ in degrees is ‘(pi/180) cos(x)’, probably not the expected answer!

If you use the deriv function directly in an algebraic formula, you can write ‘deriv(f,x,x0)’ which represents the derivative of ‘f’ with respect to ‘x’, evaluated at the point ‘x=x0’.

If the formula being differentiated contains functions which Calc does not know, the derivatives of those functions are produced by adding primes (apostrophe characters). For example, ‘deriv(f(2x), x)’ produces ‘2 f'(2 x)’, where the function f' represents the derivative of f.

For functions you have defined with the Z F command, Calc expands the functions according to their defining formulas unless you have also defined f' suitably. For example, suppose we define ‘sinc(x) = sin(x)/x’ using Z F. If we then differentiate the formula ‘sinc(2 x)’, the formula will be expanded to ‘sin(2 x) / (2 x)’ and differentiated. However, if we also define ‘sinc'(x) = dsinc(x)’, say, then Calc will write the result as ‘2 dsinc(2 x)’. See Programming with Formulas.

For multi-argument functions ‘f(x,y,z)’, the derivative with respect to the first argument is written ‘f'(x,y,z)’; derivatives with respect to the other arguments are ‘f'2(x,y,z)’ and ‘f'3(x,y,z)’. Various higher-order derivatives can be formed in the obvious way, e.g., ‘f''(x)’ (the second derivative of f) or ‘f''2'3(x,y,z)’ (f differentiated with respect to each argument once).