Status: Accepted
Owner: asmeurer
CC: [email protected]
Labels: Type-Defect Priority-Medium Polynomial

New issue 2550 by asmeurer: Bug with AlgebraicNumber.__eq__
http://code.google.com/p/sympy/issues/detail?id=2550

This came up at https://github.com/sympy/sympy/pull/480. There is a bug with AlgebraicNumber.__eq__. First, it assumes that the `other` term is an Expr object.

Second, this does not work

In [2]: AlgebraicNumber(1) == S(1)
Out[2]: False

Even though we usually get

In [10]: AlgebraicNumber(sqrt(2)) == sqrt(2)
Out[10]: True

It's because

In [13]: AlgebraicNumber(1)
Out[13]: 1

In [14]: to_number_field(1, AlgebraicNumber(1))
Out[14]: 1

In [15]: AlgebraicNumber(1).rep
Out[15]: DMP([mpq(1,1), mpq(0,1)], QQ)

In [16]: to_number_field(1, AlgebraicNumber(1)).rep
Out[16]: DMP([mpq(1,1)], QQ)

And AlgebraicNumber.__eq__ compares the rep values.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to