On Jun 28, 11:26 am, michel paul <mpaul...@gmail.com> wrote:
> I've been exploring the permutations and combinations functions for use in
> class.  After seeing this:
>
> sage: permutations(list('abc'))
> [['a', 'b', 'c'], ['a', 'c', 'b'], ['b', 'a', 'c'], ['b', 'c', 'a'], ['c',
> 'a', 'b'], ['c', 'b', 'a']]
>
> sage: permutations(var('a b c'))
> [[a, b, c], [a, c, b], [b, a, c], [b, c, a], [c, a, b], [c, b, a]]
>
> I then got this:
>
> sage: combinations(list('abcde'), 3)
> ['abc', 'abd', 'abe', 'acd', 'ace', 'ade', 'bcd', 'bce', 'bde', 'cde']
>
> sage: combinations(var('a b c d e'), 3)
>
> RuntimeError: Gap produced error output
> Variable: 'a' must have a value
>
> Permutations of a list of strings returns a list of lists of strings, but
> combinations from a list of strings returns a list of strings.
>
> Also, permutations of a list of symbolic variables returns lists of symbolic
> variables, but combinations from a list of symbolic variables produces a
> runtime error.
>
> There's no problem whatsoever in using lists of numbers, both the
> combinations and permutations functions return the expected lists of values,
> but there is this inconsistency when trying to use letters.
>
> - Michel

The developers will know more about this than I do, but I believe this
is a known issue. Look at the docstrings for the permutations and
combinations functions (type "permutations?" and "combinations?").

By the way, to the developers out there, I couldn't find a trac ticket
on this issue. Perhaps one should be opened?

-- Tianwei

-- 
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
To post to this group, send email to sage-...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-edu+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-edu?hl=en.

Reply via email to