Uses the symbolic differentiation engine of math.js, which implements the standard rules: power rule, product rule, quotient rule, chain rule, and known derivatives of elementary functions.
Higher-order derivatives are obtained by repeated differentiation. Results are algebraically simplified where possible.