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.
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
| Parameter | Type | Default | Description |
|---|---|---|---|
f_of_xrequired | sympy.Expr | — | A SymPy expression representing the analytic function (e.g., f(x) = x**2 + 3*x). |
print_functions | bool | False | If True, prints the original and derivative expressions for inspection. |
return_derivative_function | bool | False | If True, returns the symbolic derivative expression. |
plot_functions | bool | False | If True, generates a plot of the original and derivative over a default or user-supplied domain. |
minimum_x | float | -10 | The minimum x value for plotting. |
maximum_x | float | 10 | The maximum x value for plotting. |
n | int | 100 | The number of points to use for plotting. |
**plot_kwargs | | — | Additional keyword arguments passed to the plotting routine. |
Returns
The symbolic derivative expression if return_derivative_function is True, otherwise None.
Example
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)