Compute the first derivative of polynomial, trigonometric, exponential and logarithmic terms.
Computes the first derivative f'(x) numerically using the central difference method: f'(x) ≈ [f(x+h) − f(x−h)] / (2h). Supports polynomials (x^n), trigonometric (sin, cos, tan), exponential (exp, e^x), logarithmic (ln, log), and their compositions. The step size h is chosen small enough for high accuracy on smooth functions.
Central difference
f'(x) ≈ [f(x+h) - f(x-h)] / (2h)
For smooth functions, central difference with h≈1e-7 gives about 8-10 digits of accuracy, which is sufficient for all practical purposes.
Any expression the parser handles: polynomials, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, ln, log, sqrt, cbrt, abs, and their combinations with +, -, *, /, ^.