numpy.polysub#
- numpy.polysub(a1, a2)[原始碼]#
Difference (subtraction) of two polynomials.
備註
這是舊版多項式 API 的一部分。自 1.4 版本起,建議使用
numpy.polynomial中定義的新版多項式 API。有關差異的概述,請參閱 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), orpoly1dobjects.- 參數:
- a1, a2array_like or poly1d
Minuend and subtrahend polynomials, respectively.
- 回傳值:
- outndarray 或 poly1d
Array or
poly1dobject of the difference polynomial’s coefficients.
範例
\[(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])