poly
Return polynomial coefficients given a sequence of roots. The returned array represents coefficients in descending degree order, with a leading coefficient of 1.
Returns:
NDArray — 1-D array of polynomial coefficients, highest degree first.
polyadd
Add two polynomials. Inputs are coefficient arrays in descending degree order. The result is trimmed of leading zeros.
Returns:
NDArray — Coefficients of the sum polynomial.
polyder
Differentiate a polynomial one or more times. Coefficients are in descending degree order.
Returns:
NDArray — Coefficients of the m-th derivative.
polydiv
Divide one polynomial by another. Returns quotient and remainder as a tuple.
Returns:
[NDArray, NDArray] — Tuple of [quotient, remainder] coefficient arrays.
Throws: Error if the divisor is the zero polynomial.
polyfit
Least-squares polynomial fit of degreedeg to data points (x, y). Returns coefficients in descending degree order.
Returns:
NDArray — Polynomial coefficients, highest degree first.
Throws: Error if deg >= len(x).
polyint
Integrate a polynomial one or more times. Optionally specify integration constants.
Returns:
NDArray — Coefficients of the integrated polynomial.
polymul
Multiply two polynomials. Equivalent to convolving their coefficient arrays.
Returns:
NDArray — Coefficients of the product polynomial.
polysub
Subtract two polynomials. Result is trimmed of leading zeros.
Returns:
NDArray — Coefficients of the difference a1 - a2.
polyval
Evaluate a polynomial at one or more points using Horner’s method.
Returns:
NDArray | number — Scalar if x is a single number, otherwise an NDArray of evaluated values.
roots
Find the roots of a polynomial with given coefficients. Uses the companion matrix eigenvalue method, the same algorithm used by NumPy.
Returns:
NDArray — 1-D complex128 array of roots, sorted by descending magnitude.