This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / polysub

_ArrayFunctionDispatcher

numpy:polysub

source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_polynomial_impl.py :864

Signature

def   polysub ( a1 a2 )

Summary

Difference (subtraction) of two polynomials.

Extended Summary

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

a1, a2 : array_like or poly1d

Minuend and subtrahend polynomials, respectively.

Returns

out : ndarray or poly1d

Array or poly1d object of the difference polynomial's coefficients.

Examples

.. math:: (2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2)
import numpy as np
np.polysub([2, 10, -2], [3, 10, -4])

See also

polyadd
polydiv
polymul
polyval

Aliases

  • numpy.polysub