pint.utils.taylor_horner_deriv
- pint.utils.taylor_horner_deriv(x, coeffs, deriv_order=1)[source]
Evaluate the nth derivative of a Taylor series.
For example, if we want: first order of (10 + 3*x/1! + 4*x^2/2! + 12*x^3/3!) with respect to x evaluated at 2.0, we would do:
In [1]: taylor_horner_deriv(2.0, [10, 3, 4, 12], 1) Out[1]: 15.0
- Parameters:
x (float or numpy.ndarray or astropy.units.Quantity) – Input value; may be an array.
coeffs (list of astropy.units.Quantity or uncertainties.ufloat) – Coefficient array; must have length at least one. The coefficient in position
i
is multiplied byx**i
. Each coefficient should just be a number, not an array. The units should be compatible once multiplied by an appropriate power of x.deriv_order (int) – The order of the derivative to take (that is, how many times to differentiate). Must be non-negative.
- Returns:
Output value; same shape as input. Units as inferred from inputs.
- Return type: