Ask Your Question

How to define multiple WeylCharacterRings at one time

asked 2013-05-17 13:32:51 +0100

JoshIzzard gravatar image

I am trying to use a script like the one below (to use a simplistic version)

for i in [1..4]:
    B"i" = WeylCharacterRing("Bi")

to define multiple Weyl character rings at one time. I then am hoping to go through, and compute the degrees of the representation corresponding to the weight (1,1,1,...,1) depending on which B$i$ I am considering i.e., for $B4$ I would want to calculate


(its $126$). How can I go about automating this in some way? Any tips or reference materials?

Thanks for your time.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2013-05-17 15:36:55 +0100

niles gravatar image

You could define a function or use a list comprehension to do this. Both rely on using string formatting to convert integers into strings for the WeylCharacterRing constructor.

Here's an example using list comprehension: I add an empty string '' at the beginning of the list to fix indexing, because lists in Sage are always indexed starting with 0, so you would want B[1] to be the second element in the list, etc.

sage: B = ['']+[WeylCharacterRing("B{0}".format(i)) for i in range(1,5)]
sage: B[1]
The Weyl Character Ring of Type ['B', 1] with Integer Ring coefficients
sage: B[1](1)
sage: B[1](1).degree()
sage: B[4](1,1,1,1).degree()

And here's a different way you could do this, using a lambda function:

sage: B = lambda i: WeylCharacterRing("B{0}".format(i))
sage: B(2)
The Weyl Character Ring of Type ['B', 2] with Integer Ring coefficients

You can automate lots more things by defining more functions and, if you eventually need to, a new object class!

edit flag offensive delete link more


Thanks very much niles, I appreciate these answers. This is perfect for what I'm looking for.

JoshIzzard gravatar imageJoshIzzard ( 2013-05-18 17:56:53 +0100 )edit

answered 2013-05-17 15:42:10 +0100

niles gravatar image

updated 2013-05-17 15:46:18 +0100

Oh, I think @Volker Braun and I had different ideas about what you were looking for :) Here's another list comprehension which just computes the degrees of various elements (using the lambda function B defined in my other answer):

sage: [B(i)(*[1]*i).degree() for i in range(1,5)]
[1, 10, 35, 126]
edit flag offensive delete link more

answered 2013-05-17 15:34:30 +0100

Volker Braun gravatar image

Looks like you want a combination of IntegerVectors and the Python * operator to pass a list as multiple arguments:

sage: B4 = WeylCharacterRing('B4', style='coroots')
sage: l = [1,2,0,1]
sage: B4(*l).degree()
edit flag offensive delete link more


So that's how to define a vector....ha I am slowly hacking through the Sage basics. Thanks for the answer @Volker

JoshIzzard gravatar imageJoshIzzard ( 2013-05-18 17:57: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


Asked: 2013-05-17 13:32:51 +0100

Seen: 510 times

Last updated: May 17 '13