I would still say that this is a bug, since the following does work:
sage: Permutation('(1)(2)(3)(4,5)')
[1, 2, 3, 5, 4]
and the docstring says the Permutation can be given a string in cycle
notation, and 1-cycles are usually omitted. Looking at the code
(Permutation??) the error is in the call to from_cycles where the
first parameter n is computed as the sum of the lengths of the cycles
input instead of the maximum integer input.
John Cremona
2008/7/3 Pierre <[EMAIL PROTECTED]>:
>
> hi all,
>
> I'm confused with the cycle notation for permutations (bug ?)
> While the following works:
>
> sage: Permutation( '(1,2)' )
>
> the following yields an error:
>
> sage: Permutation( '(4,5)' )
> IndexError: list assignment index out of range
>
> What's confusing is that if you go:
>
> sage: x= Permutation( (4,5) )
> sage: s= x.cycle_string(); s
> '(4,5)'
>
> I'm trying to build a dictionnary whose keys are permutations; since
> the keys have to be hashable, i'm relying on the cycle_string()
> strings. But the above issue prevents me from recovering a permutation
> from its string !
>
> Is there a way around this ?
>
> thanks
> pierre
>
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---