harold.haroldpolydiv

harold.haroldpolydiv(dividend, divisor)

Polynomial division wrapped around scipy.signal.deconvolve() function. Takes two arguments and divides the first by the second.

Parameters:
  • dividend ((n,) array_like) – The polynomial to be divided
  • divisor ((m,) array_like) – The polynomial that divides
Returns:

  • factor (ndarray) – The resulting polynomial coeffients of the factor
  • remainder (ndarray) – The resulting polynomial coefficients of the remainder

Examples

>>> a = np.array([2, 3, 4 ,6])
>>> b = np.array([1, 3, 6])
>>> haroldpolydiv(a, b)
(array([ 2., -3.]), array([ 1., 24.]))
>>> c = np.array([1, 3, 3, 1])
>>> d = np.array([1, 2, 1])
>>> haroldpolydiv(c, d)
(array([1., 1.]), array([], dtype=float64))