# [SciPy-user] polynomial division problems

Alan G Isaac aisaac at american.edu
Thu Dec 22 12:21:55 CST 2005

```On Wed, 21 Dec 2005, Ted Horst apparently wrote:
> Polynomial division seems not to be working for me:
>  >>> import scipy
>  >>> scipy.__core_version__
> '0.8.6.1693'
>  >>> x2m1 = scipy.poly1d([1,0,-1])
>  >>> xp1 = scipy.poly1d([1,1])
>  >>> xm1 = scipy.poly1d([1,-1])
>  >>> x2m1/xp1
> hangs, it seems the args in polydiv are backwards, so:
>  >>> xp1/x2m1
> [poly1d([ 0.]), poly1d([1, 1])]
> but even with args reversed, this should be poly1d([1, -1])

Confirmed: poly1d division is broken.
Report below.
Cheers,
Alan Isaac

>>> import scipy as S
>>> S.base.__version__
'0.8.4'
>>> x = S.poly1d([1,0,-1])
>>> x1 = S.poly1d([1,1])
>>> x/x1
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Python24\Lib\site-packages\scipy\base\polynomial.py", line 494, in __
div__
return map(poly1d, polydiv(self.coeffs, other.coeffs))
File "C:\Python24\Lib\site-packages\scipy\base\polynomial.py", line 316, in po
lydiv
r = polysub(r, polymul(q, monDivisor))[1:]
File "C:\Python24\Lib\site-packages\scipy\base\polynomial.py", line 282, in po
lymul
val = NX.convolve(a1, a2)
File "C:\Python24\Lib\site-packages\scipy\base\numeric.py", line 130, in convo
lve
return multiarray.correlate(a,asarray(v)[::-1],mode)
KeyboardInterrupt
>>> x1/x
[poly1d([ 0.]), poly1d([1, 1])]

```