Calculus

deriv(f, x, var="x")

Computes the numerical derivative for the function \(f\) at point \(x\) with respect to the variable var which by default is \(x\). That is, it computes

\[f'(a) = \left(\frac{\partial}{\partial x} f \right) (a)\]
>>> deriv(sin(x), 3)
= -0.9899924966004454
>>> deriv(sin(cos(x)), 3)
= -0.07743200279648704
>>> deriv(sin(cos(y)), 3, y)
= -0.07743200279648704
diff(f, var="x")

Computes the differentiation of the function \(f\) with respect to the variable var which by default is \(x\). That is, it computes

\[f'(x) = \frac{\partial}{\partial x} f\]
>>> diff(sin(x))
= cos(x)
>>> sin(x)'
= cos(x)
>>> diff(sin(cos(t)), t)
= cos(cos(t)) * -sin(t)
integral(f, a, b, var="x")

Computes the numerical integration for the function \(f\) from \(a\) to \(b\) with respect to the variable var which by default is \(x\). That is, it computes

\[\int_{a}^{b} {f(x) dx}\]
>>> integral(sin(x), 3, 5)
= -1.273654682063672
>>> integral(ln(sin(x)^2), -4, 7)
= -17.06809502828264
>>> integral(exp(-x), 1, infty)
= 0.3678794411714423
>>> integral(exp(x), -infty, 1)
= 2.718281828459045
>>> integral(exp(x), 1, infty)
= 1/0 = inf