# Weyl character formula in Sagemath

I am trying to program Weyl character formula in Sage as follows:

A2 = WeylCharacterRing("A2")
a2 = WeightRing(A2)
L = A2.space()
W = L.weyl_group()
Lambda = L.simple_roots()[1]+L.simple_roots()[2]
rho = L.rho().coerce_to_sl()
r1 = sum((-1)^(w.length())*a2(w.action(Lambda+rho)) for w in W)
r2 = prod(1-a2(-alpha) for alpha in L.positive_roots())
r3 = a2(-rho)


Now I want to compute r1*r3/r2. But there is some error: AttributeError: 'WeightRing_with_category.element_class' object has no attribute 'quo_rem'

How to fix this problem?

Also the result of r2 is:

a2(0,0,0) + a2(-2,1,1) - a2(-2,0,2) + a2(-1,-1,2) - a2(-1,1,0) - a2(0,-1,1)


How to translate r2 (and the final result of Weyl character) into a form which is easier to read? I would like to write it as a Laurent polynomial in $e^{\omega_1}, e^{\omega_2}$, where $\omega_1, \omega_2$ are fundamental weights.

Thank you very much.

edit retag close merge delete