#
# Compute the dimension of the irrep of LieAlg(R) of highest weight v.
# With a third argument q, compute the principal specialization.
# A fourth argument can be used to pass the positive co-roots.
# (For computing dimensions roots or co_roots can be used).
#
`weyl/weyl_dim`:=proc(v,R) local r,pr,r0,q,vr0,f;
  if nargs<3 or args[3]-1=0 then
    if nargs>3 then pr:=args[4]; r0:=weyl['rho'](R)
      else pr:=coxeter['pos_roots'](R); r0:=convert(pr,`+`)/2
    fi;
    f:=[seq(1+coxeter['iprod'](r,v)/coxeter['iprod'](r,r0),r=pr)];
    convert(f,`*`)
  else q:=args[3];
    if nargs>3 then pr:=args[4] else
      pr:=coxeter['pos_roots'](coxeter['co_base'](R)) fi;
    r0:=weyl['rho'](R); vr0:=v+r0;
    f:=[seq((1-q^coxeter['iprod'](r,vr0))/
      (1-q^coxeter['iprod'](r,r0)),r=pr)];
    q^coxeter['iprod'](-v,convert(pr,`+`)/2)*convert(f,`*`)
  fi
end:
#
save `weyl/weyl_dim`, cat(HomeLib,`/weyl/weyl_dim.m`);
read cat(HomeLib,`/help/weyl/weyl_dim`);
quit;

