jax.numpy.polyint#
- jax.numpy.polyint(p, m=1, k=None)[source]#
Returns the coefficients of the integration of specified order of a polynomial.
JAX implementation of
numpy.polyint()
.- Parameters:
- Returns:
An array of coefficients of integrated polynomial.
- Return type:
See also
jax.numpy.polyder()
: Computes the coefficients of the derivative of a polynomial.jax.numpy.polyval()
: Evaluates a polynomial at specific values.
Examples
The first order integration of the polynomial \(12 x^2 + 12 x + 6\) is \(4 x^3 + 6 x^2 + 6 x\).
>>> p = jnp.array([12, 12, 6]) >>> jnp.polyint(p) Array([4., 6., 6., 0.], dtype=float32)
Since the constant
k
is not provided, the result included0
at the end. If the constantk
is provided:>>> jnp.polyint(p, k=4) Array([4., 6., 6., 4.], dtype=float32)
and the second order integration is \(x^4 + 2 x^3 + 3 x\):
>>> jnp.polyint(p, m=2) Array([1., 2., 3., 0., 0.], dtype=float32)
When
m>=2
, the constantsk
should be provided as an array havingm
elements. The second order integration of the polynomial \(12 x^2 + 12 x + 6\) with the constantsk=[4, 5]
is \(x^4 + 2 x^3 + 3 x^2 + 4 x + 5\):>>> jnp.polyint(p, m=2, k=jnp.array([4, 5])) Array([1., 2., 3., 4., 5.], dtype=float32)