Some time ago there were two questions on TeX.sx of about how to plot the derivative of a function and how to plot the integral function numerically:
As suggested in a comment to the second question by Matthew Leingang, a simple solution just to provide the functions diff and int in pgfmath, as defined as follows:
diff(f(x)) = (f(x + h) - f(x))/h
where h is a small constant, say h = 0.001 by default.
Similar int should return the numerical integral. See Jakes answer in the second link for an example.
For details see https://github.com/pgf-tikz/pgf/issues/623