Individual terms in a sum
G=WeylCharacterRing(['A',2])
G(1,0,0)*G(1,1,0)
returns
A2(1,1,1) + A2(2,1,0)
How can I get a list with the individual terms A2(1,1,1) and A2(2,1,0)?
G=WeylCharacterRing(['A',2])
G(1,0,0)*G(1,1,0)
returns
A2(1,1,1) + A2(2,1,0)
How can I get a list with the individual terms A2(1,1,1) and A2(2,1,0)?
Like this:
sage: G = WeylCharacterRing(['A',2])
sage: p = G(1,0,0)*G(1,1,0)
sage: p.monomials()
[A2(2,1,0), A2(1,1,1)]
sage: p.coefficients()
[1, 1]
See also:
sage: list(p)
[((2, 1, 0), 1), ((1, 1, 1), 1)]
sage: dict(p)
{(2, 1, 0): 1, (1, 1, 1): 1}
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2022-12-31 10:27:39 +0100
Seen: 180 times
Last updated: Dec 31 '22