2008/7/4 William Stein <[EMAIL PROTECTED]>:
>
> On Thu, Jul 3, 2008 at 10:50 AM, John Cremona <[EMAIL PROTECTED]> wrote:
>>
>> 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
>
> I agree and have made this trac #3548:
>
> http://trac.sagemath.org/sage_trac/ticket/3548
>
> This should be easy pickings for somebody to fix. Go at it!
>
I have posted a simple patch to fix this. With the patch you see this:
sage: p = Permutation( '(4,5)' ); p
[1, 2, 3, 5, 4]
sage: p2 = Permutation( '(4,5)(10)' ); p2
[1, 2, 3, 5, 4, 6, 7, 8, 9, 10]
I hope that this patch will be reviewed so that the bug can be fixed
for sage-3.0.4.
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
>>>
>>>
>>>
>>>
>>>
>>> >
>>>
>>
>> >
>>
>
>
>
> --
> William Stein
> Associate Professor of Mathematics
> University of Washington
> http://wstein.org
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---