Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions numpy/lib/_polynomial_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,22 @@ def polydiv(u, v):
>>> np.polydiv(x, y)
(array([1.5 , 1.75]), array([0.25]))

The case where the divisor has higher degree than the dividend returns
a zero quotient and the dividend as remainder:

>>> x = np.array([1.0, 2.0])
>>> y = np.array([1.0, 2.0, 3.0])
>>> np.polydiv(x, y)
(array([0.]), array([1., 2.]))

A perfect factoring case with zero remainder, since
:math:`x^2 - 1 = (x-1)(x+1)`:

>>> x = np.array([1.0, 0.0, -1.0])
>>> y = np.array([1.0, -1.0])
>>> np.polydiv(x, y)
(array([1., 1.]), array([0.]))

"""
truepoly = (isinstance(u, poly1d) or isinstance(v, poly1d))
u = atleast_1d(u) + 0.0
Expand Down
Loading