ANALYSIS TOOL BOX

Calculus

FindDerivative

Compute and explore the symbolic derivative of a mathematical function.

calculusderivativesintegralsoptimization

Introduction

When you track something over time — a threat likelihood, an incident count, a biomarker — the level alone rarely answers the question you care about. What you usually need to know is how fast it is changing, and whether that change is speeding up or slowing down. FindDerivative gives you an exact, symbolic answer: it turns a function into a new one describing its instantaneous rate of change, so you can locate acceleration, inflection points, maxima, and minima precisely rather than eyeballing a curve. Reach for it when the analytic question is about momentum and turning points — is a risk accelerating, has offender behavior shifted, is a treatment effect decelerating — not just about the current value.

Teaching Note

A derivative transforms a function into a new one that reflects how fast the original changes. For example, steep slopes (large derivative values) may indicate critical transitions. Plotting the original and derivative together often reveals features like maxima, minima, or inflection points that are not obvious from raw numbers alone.

Parameters

ParameterTypeDefaultDescription
f_of_xrequiredsympy.ExprA SymPy expression representing the analytic function (e.g., f(x) = x**2 + 3*x).
print_functionsboolFalseIf True, prints the original and derivative expressions for inspection.
return_derivative_functionboolFalseIf True, returns the symbolic derivative expression.
plot_functionsboolFalseIf True, generates a plot of the original and derivative over a default or user-supplied domain.
minimum_xfloat-10The minimum x value for plotting.
maximum_xfloat10The maximum x value for plotting.
nint100The number of points to use for plotting.
**plot_kwargsAdditional keyword arguments passed to the plotting routine.

Returns

The symbolic derivative expression if return_derivative_function is True, otherwise None.

Example

python
from analysistoolbox.calculus import FindDerivative
import sympy

# Symbolically differentiate f(x) = x^3 + 2x^2
x = sympy.symbols('x')
FindDerivative(x**3 + 2*x**2, print_functions=True, return_derivative_function=True)