Ask Your Question
0

How to store outputs from a function for later use

asked 2013-05-31 11:15:08 +0100

JoshIzzard gravatar image

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):
        deg.append([])
        fw = A(i+1).fundamental_weights()
        temp = A(i+1)
        for j in fw.keys():
            deg[i].append(temp(fw[j]).degree())
            if temp(fw[j]).degree() == bound:
                index.append('A'+str(i+1)+'(fw['+str(j)+'])')
                L.append(fw[j])
    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?

edit retag flag offensive close merge delete

Comments

Just figured out part of it: `[index, deg, L] = rankrep(3)`

JoshIzzard gravatar imageJoshIzzard ( 2013-05-31 11:19:15 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-05-31 11:27:23 +0100

tmonteil gravatar image

updated 2013-05-31 11:36:26 +0100

I am not sure to understand your request, but you can modify the last line of your function to return L as well by:

return index, deg, L

And then play with it:

sage: index, deg, L = rankrep(3)
sage: index
['A8(fw[1])', 'A8(fw[8])']
sage: deg
[[2],
 [3, 3],
 [4, 6, 4],
 [5, 10, 10, 5],
 [6, 15, 20, 15, 6],
 [7, 21, 35, 35, 21, 7],
 [8, 28, 56, 70, 56, 28, 8],
 [9, 36, 84, 126, 126, 84, 36, 9],
 [10, 45, 120, 210, 252, 210, 120, 45, 10]]
sage: deg[3]
[5, 10, 10, 5]
sage: L
[(1, 0, 0, 0, 0, 0, 0, 0, 0), (1, 1, 1, 1, 1, 1, 1, 1, 0)]

To transform the elements of L to a list of vectors, you can:

sage: w = [i.to_vector() for i in L]
sage: w[0]
(1, 0, 0, 0, 0, 0, 0, 0, 0)
sage: w[1]
(1, 1, 1, 1, 1, 1, 1, 1, 0)
edit flag offensive delete link more

Comments

@tmontneil but will the `w[i]` values now feed into a Schur function? I thought they had to be lists i.e., I think I need `w[0] = [1,0,...,0]` right?

JoshIzzard gravatar imageJoshIzzard ( 2013-05-31 11:51:47 +0100 )edit
1

As i defined them, they are vectors: sage: w[1].parent() Vector space of dimension 9 over Rational Fiel You can make them partitions: sage: Partition(w[1]) [1, 1, 1, 1, 1, 1, 1, 1] and perhaps sage: s = SymmetricFunctions(QQ).schur() sage: s(Partition(w[1])) s[1, 1, 1, 1, 1, 1, 1, 1] If you prefer lists, you can: sage: w[1].list() [1, 1, 1, 1, 1, 1, 1, 1, 0] But it seems it leads to the same things: sage: s(w[1].list()) == s(Partition(w[1])) True Of course, you can do everything in one step: sage: w = [i.to_vector().list() for i in L] sage: [s(i) for i in w] [s[1], s[1, 1, 1, 1, 1, 1, 1, 1]] By the way, i am not expert in Symmetric functions at all, just guessing what your needs are.

tmonteil gravatar imagetmonteil ( 2013-05-31 12:19:24 +0100 )edit

Many thanks @tmontneil, I now understand. Partition is indeed useful to keep in mind

JoshIzzard gravatar imageJoshIzzard ( 2013-06-03 14:00:42 +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

Stats

Asked: 2013-05-31 11:15:08 +0100

Seen: 458 times

Last updated: May 31 '13