jax.numpy.poly

Contents

jax.numpy.poly#

jax.numpy.poly(seq_of_zeros)#

Find the coefficients of a polynomial with the given sequence of roots.

LAX-backend implementation of numpy.poly().

This differs from np.poly when an integer array is given. np.poly returns a result with dtype float64 in this case. jax returns a result with an inexact type, but not necessarily float64.

This also differs from np.poly when the input array strictly contains pairs of complex conjugates, e.g. [1j, -1j, 1-1j, 1+1j]. np.poly returns an array with a real dtype in such cases. jax returns an array with a complex dtype in such cases.

Original docstring below.

Note

This forms part of the old polynomial API. Since version 1.4, the new polynomial API defined in numpy.polynomial is preferred. A summary of the differences can be found in the transition guide.

Returns the coefficients of the polynomial whose leading coefficient is one for the given sequence of zeros (multiple roots must be included in the sequence as many times as their multiplicity; see Examples). A square matrix (or array, which will be treated as a matrix) can also be given, in which case the coefficients of the characteristic polynomial of the matrix are returned.

Parameters:

seq_of_zeros (array_like, shape (N,) or (N, N)) – A sequence of polynomial roots, or a square array or matrix object.

Returns:

c – 1D array of polynomial coefficients from highest to lowest degree:

c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N] where c[0] always equals 1.

Return type:

ndarray

References