Ask Your Question

Problem getting indices to sync up

asked 2013-05-30 14:37:25 +0100

JoshIzzard gravatar image

I'm not sure what is wrong with the following code:

# given a prime p, return all A_n representations of dimension = p^2
def rankrep(p):
    bound = p**2
    A = lambda i: WeylCharacterRing("A{0}".format(i), style = "coroots")
    deg = []
    for i in xrange(bound):
        fw = A(i+1).fundamental_weights()
        temp = A(i+1)
        for j in range(len(fw)):
    return deg

But when I run it, it is unable to return anything, and tells me Keyval Error 0. Should I not be using append here?

I eventually hope to insert some if trees testing whether a given temp(fw[j].degree() == p**2, but I'm not sure how to pull those indices either. Any help would be greatly appreciated. Regards.

edit retag flag offensive close merge delete


I've added this line of code ` [(i,j) for (i,deg_i) in enumerate(deg) for (j,deg_ij) in enumerate(deg_i) if deg_ij == p**2]` to pull the indices

JoshIzzard gravatar imageJoshIzzard ( 2013-05-30 14:46:19 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-30 15:33:33 +0100

Try replacing

    for j in range(len(fw)):


    for j in fw.keys():

(In your code, fw is not a list, but a finite family, so its entries are not indexed by 0, 1, 2, ..., necessarily.)

edit flag offensive delete link more


Thanks very much @John for your help

JoshIzzard gravatar imageJoshIzzard ( 2013-05-30 17:18:01 +0100 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2013-05-30 14:37:25 +0100

Seen: 197 times

Last updated: May 30 '13