Numerical Calcs Utility
Numerical analysis helper utilities.
This module provides lightweight numerical tools for analyzing one-dimensional data series, such as detecting zero crossings or sign changes in curves produced by ReaxFF simulations.
Typical use cases include:
- locating x-axis crossings in energy or force curves
- identifying switching points in polarization or field-response signals
- detecting sign changes in derived observables
find_zero_crossings(x, y)
Find x-values where a 1D function crosses zero.
Zero crossings are identified by detecting sign changes between consecutive data points and estimating the root location using interpolation and numerical bracketing. Exact zeros at sampled points are also included.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
sequence of float
|
Monotonically ordered x-values (e.g., time, iteration index). |
required |
y
|
sequence of float
|
Function values corresponding to |
required |
Returns:
| Type | Description |
|---|---|
list of float
|
Sorted x-values at which |
Examples:
>>> find_zero_crossings(time, polarization)
>>> find_zero_crossings(iters, energy - energy.mean())