[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../generated/../generated/numpy.polysub.html [Back]  [Original]

numpy.polysub — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.polysub#

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

Difference (subtraction) of two polynomials.

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.

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, a2array_like or poly1d

Minuend and subtrahend polynomials, respectively.

Returns:
outndarray or poly1d

Array or poly1d object of the difference polynomials coefficients.

Examples

Try it in your browser!
\[(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])
array([-1,  0,  2])

Web Proxy Viewer  |  New URL  |  Original Page