Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to store outputs from a function for later use

My function that I have written to compute the rank of fundamental representations is as follows:

# given a prime p, return all A_n representations of dimension = p^2
def rankrep(p):
    bound = p*p
    s = SymmetricFunctions(QQ).schur()
    Sym_p = s[p]
    A = lambda i: WeylCharacterRing("A{0}".format(i))
    deg = []
    index = []
    L = []
    for i in xrange(bound):
        fw = A(i+1).fundamental_weights()
        temp = A(i+1)
        for j in fw.keys():
            if temp(fw[j]).degree() == bound:
    return index, deg

But now if I call rankrep it does not let me store index or deg, it just prints them. I am wanting to also store the L variable I create as these are the weights that give me the desired dimension, and convert from these weights, which make up the highest weight $Lambda = a_1 \omega_1 + \cdots + a_n \omega_n$ (here $Lambda$ is the high weight, $\omega_i$ are the fundamental weights). The $\omega_i$ have the form $(1,1,\dots,1,0, \dots, 0)$, and I would like to express my high weight as $(a_1 + \cdots + a_{n-1}, a_2 + \cdots + a_{n-1}, \dots, a_{n-1},0)$. However, since I am only considering one of the $a_i$ nonzero, this vector will look like $(a_i, a_i, \dots, a_i, 0, \dots, 0)$. I would like to store this vector, and then pass it as a partition to a schur function s that I define in the code.

How can I store these outputs and format them (i.e., data types, lists, dictionaries, vectors) so that I can then alter them as described and apply my schur function?