[SciPy-user] poly1d equality test

Ryan Krauss ryanlists at gmail.com
Mon Feb 27 19:34:43 CST 2006


Is there an easy way to test for the equality of two poly1d objects?

I have the following problem:
In [36]: p1
Out[36]: poly1d([  6.66666667,   0.        , -49.        ])

In [37]: p2
Out[37]: poly1d([  6.66666667,   0.        , -49.        ])

In [38]: p1==p2
Out[38]: False

In [39]: (p1.coeffs==p2.coeffs).all()
Out[39]: True

It seems like == is only testing if they are the same object.  I am
trying to write a class for transfer functions which model a system as
a numerator and denominator poly1d.  When I multiply or divide them I
need to check if the numerator and denominators cancel exactly.

Thanks,

Ryan



More information about the SciPy-user mailing list