Ask Your Question
0

What is the bug ?

asked 2016-05-03 07:31:12 +0100

Anupamsage gravatar image

I am writing this code in sage online worksheet given a tuple say $a=(a_1,a_2,...a_n)$ \phi be an permutation in S_n then \phi(a)= (a_\phi(1),...,a_\phi(n)) I want to count the number of permutation that fixes a The code is as follows

def Aut(tuple): c=1 for a in SymmetricGroup(len(tuple)): if a.action(tuple)== tuple : c=c+1

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-05-03 15:38:32 +0100

B r u n o gravatar image

There is no method action for elements of the symmetric group. You should write a(tuple) instead of a.action(tuple). And by the way, your function does not return anything, and I think c should be initialized to 0. Maybe:

def Aut(tuple):
    c = 0
    for a in SymmetricGroup(len(tuple)):
        if a(tuple) == tuple:
            c = c+1
    return c
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-05-03 07:31:12 +0100

Seen: 641 times

Last updated: May 03 '16