Comment #7 on issue 3501 by [email protected]: Missing partitions in
sympy.utilities.iterables.multiset_partitions
http://code.google.com/p/sympy/issues/detail?id=3501
Here is a failing test for the partitions of range(5) into 2 groups:
Should be
for ai in a:
... print ai
...
((0, 1, 3, 4), (2,))
((0, 3), (1, 2, 4))
((0, 1), (2, 3, 4))
((0, 2), (1, 3, 4))
((0, 1, 2, 4), (3,))
((0, 1, 4), (2, 3))
((0, 2, 3), (1, 4))
((0, 2, 3, 4), (1,))
((0, 1, 2, 3), (4,))
((0, 1, 3), (2, 4))
((0, 4), (1, 2, 3))
((0, 1, 2), (3, 4))
((0, 3, 4), (1, 2))
((0, 2, 4), (1, 3))
((0,), (1, 2, 3, 4))
But gave (when sorted)
for ai in b:
... print ai
...
((0, 1, 4), (2, 3))
((0, 1), (2, 3, 4))
((0, 2, 3), (1, 4))
((0, 2, 3, 4), (1,))
((0, 1, 2, 3), (4,))
((0, 2), (1, 3, 4))
((0, 4), (1, 2, 3))
((0, 1, 3, 4), (2,))
((0, 3, 4), (1, 2))
((0,), (1, 2, 3, 4))
It is missing these:
for ai in a:
... if ai not in b: print ai
...
((0, 3), (1, 2, 4))
((0, 1, 2, 4), (3,))
((0, 1, 3), (2, 4))
((0, 1, 2), (3, 4))
((0, 2, 4), (1, 3))
My hunch is that it is an error made when dealing with 0-based or 1-based
lists. (And I, too, doubt that the error is in Knuth.)
--
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.