evaluate_derivative

sofia_redux.toolkit.resampling.evaluate_derivative(coefficients, phi_point, derivative_map)[source]

Calculates the derivative of a polynomial at a single point.

Please see polynomial_derivative_map() for a full description of how the derivatives are calculated from a polynomial equation defined by polynomial_exponents(). These also explain how one should transform the independent variables to the “phi” (\(\Phi\)) terms (which may be done using polynomial_terms()).

The derivative at a point is calculated by:

\[\frac{\partial f}{\partial X_k} = \sum_{m=1}^{M} {h_{k, 0, m} \cdot c_{h_{k, 1, m}} \cdot \Phi_{h_{k, 2, m}}}\]

for a polynomial equation consisting of \(M\) terms at the coordinate \(X\) in dimension \(k\), where \(h\) is the derivative map.

Parameters:
coefficientsnumpy.ndarray (n_terms,)

The coefficients of the polynomial equation for each term.

phi_pointnumpy.ndarray (n_terms,)

The polynomial terms of the fittin equation at a single coordinate.

derivative_mapnumpy.ndarray

An array of shape (n_dimensions, 3, n_valid_terms). The second dimension (of size 3) gives a constant multiplier in the first element, the coefficient index in the second element, and the phi index in the second element. The third dimension will generally be of a smaller size than the number of terms in the polynomial equation as not all are required to calculate the derivative. Due to the fact that some dimensions may contain more valid terms than others, n_valid_terms is set to the maximum number of valid terms over all dimensions. Any invalid terms still remaining in the mapping array will have multipliers set to zero, and index pointers set to -1.

Returns:
derivativenumpy.ndarray (n_dimensions,)

The partial derivative of the polynomial equation with respect to each dimension.