# Getting the denominator takes ages...

Hi,

I am trying to run the following code (I am including the full code, this is about representation theory but my question is much simpler):

B2 = WeylCharacterRing(['B', 2])
b2 = WeightRing(B2)
Weyl = B2(2, 2)

l = B2.rank()
z = [var('z0')]
for k in range(1, l):
z.append(var('z' + str(k)))
u = var('u')

def toPoly(v):
return prod([z[k]^v[k] for k in range(0, l)])

Molien = 1
W = Weyl.weight_multiplicities()
for w in W:
T = toPoly(-w)
Molien *= 1/(1-u*T)^W[w]

Molien = factor(Molien)
WeylDenom = prod(1-toPoly(-alpha) for alpha in b2.positive_roots())

MolienInt = factor(Molien*WeylDenom/prod(z[k] for k in range(0, l)))
DEN = MolienInt.denominator()
(...)


Everything works fine except for the very last line that seems to run forever. Yet it is pretty straightforward to get the denominator of MolienInt.

I made some tests using PolynomialRing but it also seems not to end and has also the drawback that the denominator is expanded while I need it to remain factored.

Can you help me?

edit retag close merge delete

Sort by » oldest newest most voted

Getting the denominator takes sage...

# rootType = 'B2'
# weight   = (2,2)

rootType = 'B3'
weight   = (3,3,3)

# the rootType is e.g. 'B2', or ['B', 2], or RootSystem('B2')
# The weight is a corresponding dominant weight...

B = WeylCharacterRing( rootType )
b = WeightRing( B )
bpr  = b.positive_roots()
Weyl = B( weight )
W = Weyl.weight_multiplicities()

r = B.rank()
print "%s :: rank=%s weight=%s" % (rootType, r, weight)
R = range(r)

names = [ 'z%s' % k for k in R ] + [ 'u', ]
ring  = PolynomialRing( QQ, names=names )
gens  = ring.gens()
z = gens[:-1]
u = gens[-1]

def denomPart( z, u, w ):
"""z, v should be a vectors of length r..."""
return (       prod( [ z[k]^( - w[k] ) for k in R if w[k] < 0 ] )
- u * prod( [ z[k]^    w[k]   for k in R if w[k] > 0 ] ) )

def   nomPart( z, u, w ):
"""z, v should be a vectors of length r..."""
return (       prod( [ z[k]^( - w[k] ) for k in R if w[k] < 0 ] ) )

MolienDenom = Factorization( [ ( denomPart( z, u, -w ), W[w] ) for w in W ], cr=True )
MolienNom   = Factorization( [ (   nomPart( z, u, -w ), W[w] ) for w in W ], cr=True )

WeylDenom   = Factorization( [ ( denomPart( z, 1, -w ), W[w] ) for w in bpr ], cr=True )
WeylNom     = Factorization( [ (   nomPart( z, 1, -w ), W[w] ) for w in bpr ], cr=True )

DEN = MolienDenom \
* WeylDenom \
* ( MolienNom * WeylNom / prod( z ) ).value().denominator().factor()

# print DEN    # this is not humanly readable
print "DEN has the following factors:"
for f in DEN:
print f


...not too much time, if we isolate and use the factorization we have.

Note: The main improvement is to not expand, than (re)factor.

(Since there are too many terms to be recollected after expansion.)

This is obtained by explicitly using the Factorization constructor. The code was carefully typed, hope that the denominator contribution from the original post were correctly collected. The code was typed so that it is easy to isolate a function getDen( rootType, weight ) .

The DEN may have no contribution from the third factor (which is a monomial in the z components.) Since the complexity of DEN grows with the one of W, the results are omitted.

more

Wow! Once again I thank you very much!

I will hopefully try this code tomorrow.

This solution also works:

DEN = prod(d.denominator() for d in list(MolienInt.op))