1 | initial version |
You should be able to create a class of a function, though, and give it a custom derivative.
https://github.com/sagemath/sage/blob/master/src/sage/symbolic/function.pyx
# only one of derivative and tderivative should be defined
if hasattr(self, '_derivative_') and hasattr(self, '_tderivative_'):
raise ValueError("only one of _derivative_ or _tderivative_ should be defined.")
There are a number of examples in the src/sage/functions directory, e.g. https://github.com/sagemath/sage/blob/master/src/sage/functions/bessel.py