jax.numpy.polyder#
- jax.numpy.polyder(p, m=1)[source]#
Returns the coefficients of the derivative of specified order of a polynomial.
JAX implementation of
numpy.polyder()
.- Parameters:
p (ArrayLike) – Array of polynomials coefficients.
m (int) – Order of differentiation (positive integer). Default is 1. It must be specified statically.
- Returns:
An array of polynomial coefficients representing the derivative.
- Return type:
Note
jax.numpy.polyder()
differs fromnumpy.polyder()
when an integer array is given. NumPy returns the result with dtypeint
whereas JAX returns the result with dtypefloat
.See also
jax.numpy.polyint()
: Computes the integral of polynomial.jax.numpy.polyval()
: Evaluates a polynomial at specific values.
Examples
The first order derivative of the polynomial \(2 x^3 - 5 x^2 + 3 x - 1\) is \(6 x^2 - 10 x +3\):
>>> p = jnp.array([2, -5, 3, -1]) >>> jnp.polyder(p) Array([ 6., -10., 3.], dtype=float32)
and its second order derivative is \(12 x - 10\):
>>> jnp.polyder(p, m=2) Array([ 12., -10.], dtype=float32)