jesterTOV.utils.cumtrapz#
- cumtrapz(y, x)[source]#
Cumulatively integrate y(x) using the composite trapezoidal rule.
This function performs cumulative integration using the trapezoidal rule, which is essential for computing thermodynamic quantities like enthalpy and chemical potential from EOS data.
The trapezoidal rule approximates:
\[\int_{x_0}^{x_i} y(x) dx \approx \sum_{j=1}^{i} \frac{\Delta x_j}{2}(y_{j-1} + y_j)\]- Parameters:
y (Array) – Values to integrate
x (Array) – The coordinate to integrate along
- Returns:
Array – The result of cumulative integration of y along x
Notes
The result array has the same length as the input, with the first element set to a small value (1e-30) to avoid logarithm issues.