[SciPy-user] polynomial division problems

Ted Horst ted.horst at earthlink.net
Thu Dec 22 19:40:55 CST 2005


On Dec 22, 2005, at 13:06, David M.Cooke wrote:

> On Dec 21, 2005, at 15:12 , Ted Horst 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:
>
> Yes, this is bad :) I'm working on it.
>
>>>>> xp1/x2m1
>> [poly1d([ 0.]), poly1d([1, 1])]
>>
>> but even with args reversed, this should be poly1d([1, -1])
>
> eh? (x+1)/(x**2-1) should have a quotient of 0, and a remainder of x+1.

Sorry, this was based on a guess that the problem had something to do 
with the args to polydiv being backwards, so I thought that 
(x+1)/(x**2-1) was being interpreted as (x**2-1)/(x+1).  I have no idea 
why I thought that, so just ignore me.

> -- 
> |>|\/|<
> /------------------------------------------------------------------\
> |David M. Cooke              http://arbutus.physics.mcmaster.ca/dmc/
> |cookedm at physics.mcmaster.ca



More information about the SciPy-user mailing list