Using machine learning. I guess that you can optimize a model to learn derivatives.
Using some imaginative thinking.
Then why not take the 2x derivative. That is. Train on the two steps forward derivative.
This way there should be possible to get derivative like values for when the function is even a constant. If the function had some previous non constant value.
The reason for this I suspect is that the universe could make use of imaginative values. Maybe our operations are not enough.