I will try to answer by following from @Ernest in the comments.
This mainly depends on which derivatives you want to enable. If you want to distinguish only polynomials, then it would be quite simple to write your own differentiation methods, because they are really understandable.
The part requiring thought is the presentation of polynomials. This can simply be done by saving each member as a pair consisting of a coefficient and parts of the exponent. With the help of simple multiplication and subtraction, you can distinguish.
You can do this even further using recursion and implement a chain rule for differentiation to allow differentiation of nested polynomials.
For most people, this is probably good enough or better than necessary.
My suggestion: limit your reach and enjoy it yourself.
source share