Estimate the derivative of a scalar polynomial using a forward difference. The Python list coefficients stores terms in ascending power order:
f(x)=k=0∑n−1ckxk.Here n is the coefficient count, k is the power, ck is its coefficient, and x is the evaluation point. For the supplied positive step h, the estimated slope is
hf(x+h)−f(x).Return a three-item tuple of Python floats in this order: the polynomial value at x, its value at x plus h, and the forward-difference slope.
Input: coefficients=[5.0,-4.0,3.0], x=3.0, h=0.001
Output: (20.0,20.014003,14.003)
Explanation: The polynomial is 3x² - 4x + 5, and the forward difference is close to its derivative value 14 at x=3.
Input: coefficients=[7.0], x=-2.0, h=0.1
Output: (7.0,7.0,0.0)
Input: coefficients=[-1.0,2.0], x=-3.0, h=0.25
Output: (-7.0,-6.5,2.0)
reversed visits coefficients from the highest power to the constant term.
float converts a NumPy scalar to a Python float.
Accepts: array
Accepts: number
Accepts: number
Estimate the derivative of a scalar polynomial using a forward difference. The Python list coefficients stores terms in ascending power order:
f(x)=k=0∑n−1ckxk.Here n is the coefficient count, k is the power, ck is its coefficient, and x is the evaluation point. For the supplied positive step h, the estimated slope is
hf(x+h)−f(x).Return a three-item tuple of Python floats in this order: the polynomial value at x, its value at x plus h, and the forward-difference slope.
Input: coefficients=[5.0,-4.0,3.0], x=3.0, h=0.001
Output: (20.0,20.014003,14.003)
Explanation: The polynomial is 3x² - 4x + 5, and the forward difference is close to its derivative value 14 at x=3.
Input: coefficients=[7.0], x=-2.0, h=0.1
Output: (7.0,7.0,0.0)
Input: coefficients=[-1.0,2.0], x=-3.0, h=0.25
Output: (-7.0,-6.5,2.0)
reversed visits coefficients from the highest power to the constant term.
float converts a NumPy scalar to a Python float.
Accepts: array
Accepts: number
Accepts: number