jax.numpy.polysub

jax.numpy.polysub(a1, a2)[source]

Difference (subtraction) of two polynomials.

LAX-backend implementation of polysub(). Original docstring below.

Given two polynomials a1 and a2, returns a1 - a2. a1 and a2 can be either array_like sequences of the polynomials’ coefficients (including coefficients equal to zero), or poly1d objects.

Parameters

a2 (a1,) – Minuend and subtrahend polynomials, respectively.

Returns

out – Array or poly1d object of the difference polynomial’s coefficients.

Return type

ndarray or poly1d

See also

polyval(), polydiv(), polymul(), polyadd()

Examples

\[(2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2)\]
>>> np.polysub([2, 10, -2], [3, 10, -4])
array([-1,  0,  2])