SciPy

numpy.polysub

numpy.polysub(a1, a2)[source]

Difference (subtraction) of two polynomials.

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

System Message: WARNING/2 ((2 x^2 + 10 x - 2) - (3 x^2 + 10 x -4) = (-x^2 + 2) )

latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/TeX Live for SUSE Linux) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2015/01/01> patch level 2 Babel <3.9m> and hyphenation patterns for 79 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.173 \endinput ^^M No pages of output. Transcript written on math.log.
>>> np.polysub([2, 10, -2], [3, 10, -4])
array([-1,  0,  2])

Previous topic

numpy.polymul

Next topic

numpy.RankWarning