Algosim documentation: diff

diff

Performs numerical differentiation at a point.

Syntax

Description

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

diff(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

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

See also