## Derivative

Function

Derivative(function)

 function

Derivative(function, varName)

 function varName

Derivative is included by default in each file as part of the Math library.

##### Use

The Derivative() function returns the derivative of a function. The result is given as a new function that can be used. The input for Derivative() is given as a named custom function, or as an in-line function.

The resulting function is calculated symbolically, but if no symbolic solution can be found, a numerically derived function will be given.

If the input function has more than one variable, then Derivative() performs a partial derivative, where the second input specifies which variable the partial derivative will be done on. The second input must be given as a text value that matches one of the variables in the input function.

Units can be used, but care must be taken that the variables and functions work together.

##### Simple Examples
• `Derivative(x=>x^2+x+1)  = 2*x + 1`
• `Derivative((x, y)=>x^2+x*y+y^2, "x")  = 2*x + y`