Comment #35 on issue 2133 by [email protected]: Merge new polynomials
manipulation module
http://code.google.com/p/sympy/issues/detail?id=2133
I tracked down the problem with RootSum to:
In [1]: var('a,b')
Out[1]: (a, b)
In [2]: f = (x**3 - a)**2*(x**4 - b)**3
In [3]: g = Lambda(x, 5*tan(x) + 7)
In [5]: r = RootSum(f, g, x)
In [6]: h = Lambda(x, tan(x))
In [7]: R = 10*RootSum(x**3 - a, h, x) + 15*RootSum(x**4 - b, h, x) + 126
In [8]: r == R
/home/matt/repo/git/sympy/sympy/core/basic.py(596)__eq__()
-> st = self._hashable_content()
(Pdb) c
Out[8]: False
In [9]: r == R
/home/matt/repo/git/sympy/sympy/core/basic.py(596)__eq__()
-> st = self._hashable_content()
(Pdb) n
/home/matt/repo/git/sympy/sympy/core/basic.py(597)__eq__()
-> ot = other._hashable_content()
(Pdb) n
/home/matt/repo/git/sympy/sympy/core/basic.py(599)__eq__()
-> return (st == ot)
(Pdb) p st
(126, 15*RootSum(-b + x**4, Lambda(_x, tan(_x))), 10*RootSum(-a + x**3,
Lambda(_x, tan(_x))))
(Pdb) p ot
(126, 10*RootSum(-a + x**3, Lambda(_x, tan(_x))), 15*RootSum(-b + x**4,
Lambda(_x, tan(_x))))
(Pdb) p st == ot
False
So, now there are (at least) three ways to proceed:
1. I can use a simpler test in test_RootSum_independent :)
2. We can improve hashing of Lambdas or reconsider dummy substitution.
3. Implement __eq__ in Add (and Mul) and use hash independent sorting of
arguments (
this would be optimal, but speed reduction may be significant).
--
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.