﻿ differentiate – Algosim documentation
Algosim documentation: differentiate

# differentiate

Performs numerical differentiation at a point.

## Syntax

• `differentiate(expr, var, x[, ε])`

• `expr` is a real or complex, scalar-. vector-, or matrix-valued expression in `var`

• `var`, a symbol, is the variable in `expr`

• `x` is the real point at which the derivative is computed

• `ε` is the radius about `x` used for numerical differentiation

## Description

`differentiate` computes a symmetric difference quotient of an expression at a specified point:

`differentiate(f(t), t, x, ε) = [f(x + ε) − f(x − ε)] / (2⋅ε).`

If omitted, `ε` is set to 10^−6.

The expression may be real or complex, scalar-, vector-, or matrix-valued.

## Examples

`differentiate(x^2, x, 1)`
`2`
`differentiate(e^x, x, 1)`
`2.71828182846`
`∫(differentiate(x^2, x, t), t, 0, 2)`
`4`
`differentiate(❨cos(t), sin(t), t❩, t, π/6)`
``` ⎛     −0.5     ⎞
e⎜0.866025403784⎟
⎝      1       ⎠
```
`differentiate(❨❨x, i⋅x❩, ❨−i⋅x, x❩❩, x, π)`
```⎛   1   1⋅i⎞
⎝−1⋅i     1⎠
```