Base R
provides a function D()
that outputs the expression of the derivative of a given function.
For example:
f <- expression(x^3+2*x)
D(f, "x") # with respect to x
# 3 * x^2 + 2
Is there a similar function that would yield the expression of the integral of a function?
I know that stats::integrate()
will evaluate the integral of a function for a given interval, but as far as I know, it will not output the expression of the Integral.