Returns the quotient and remainder of polynomial division.
The input arrays are the coefficients (including any coefficients
equal to zero) of the “numerator” (dividend) and “denominator”
(divisor) polynomials, respectively.
Parameters : | u : array_like or poly1d
Dividend polynomial’s coefficients.
v : array_like or poly1d
Divisor polynomial’s coefficients.
|
Returns : | q : ndarray
Coefficients, including those equal to zero, of the quotient.
r : ndarray
Coefficients, including those equal to zero, of the remainder.
|
Notes
Both u and v must be 0-d or 1-d (ndim = 0 or 1), but u.ndim need
not equal v.ndim. In other words, all four possible combinations -
u.ndim = v.ndim = 0, u.ndim = v.ndim = 1,
u.ndim = 1, v.ndim = 0, and u.ndim = 0, v.ndim = 1 - work.
Examples
System Message: WARNING/2 (\frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25
)
latex exited with error:
[stderr]
[stdout]
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux)
restricted \write18 enabled.
entering extended mode
(./math.tex
LaTeX2e <2011/06/27>
Babel <3.9f> and hyphenation patterns for 78 languages loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2007/10/19 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.131 \endinput
^^M
No pages of output.
Transcript written on math.log.
>>> x = np.array([3.0, 5.0, 2.0])
>>> y = np.array([2.0, 1.0])
>>> np.polydiv(x, y)
(array([ 1.5 , 1.75]), array([ 0.25]))