even() function for permutations

9 views
Skip to first unread message

dan mcveagh

unread,
Mar 26, 2026, 4:39:30 AM (7 days ago) Mar 26
to Numbas Users
Hello Numas Users
Can anyone help me understand what is going on in the screenshot below?
sigma3=(1,5,2,6,4) is a single 5-cycle and therefore an even permutation.
But sig3_even=even(sigma3) returns false.
Similarly when sigma3=(1,4,3,7,2,5), which should be odd, sig3_even is true.
But for some permutations (not single cycles), the even() fuction seems to behave correctly.
What am I missing?
Thanks,
Dan
`even_permutation.png

Christian Lawson-Perfect

unread,
Mar 26, 2026, 6:23:27 AM (7 days ago) Mar 26
to numbas...@googlegroups.com
I think my code was just wrong, sorry. I had a look at it and couldn't work out what I meant by it. I've replaced it with a routine that I'm fairly sure is correct now. Please have a look yourself and tell me if you spot any other errors.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/numbas-users/e5eef916-857f-4180-9344-ce9b52fab5a5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages