ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 10 Jun 2024 18:06:28 +0200Dimensions of representations obtained by branching rule are incorrecthttps://ask.sagemath.org/question/77810/dimensions-of-representations-obtained-by-branching-rule-are-incorrect/Consider $\mathrm{SO}_3\subset\mathrm{GL}_3$ as fixed points of the obvious involution. Then we should be able to compute restrictions of representations via the "symmetric" branching rule:
GL3 = WeylCharacterRing(['A', 2])
B1=WeylCharacterRing(['B',1])
V=GL3(3,2,-1); V.degree()
Sage says the output it 24. Now if we restrict to $\mathrm{SO}_3$, we get
b = branching_rule("A2","B1")
V.branch(B1, rule=b)
Sage says the output is
B1(1) + B1(2) + B1(3) + B1(4)
and the result of
[B1(1).degree(), B1(2).degree(), B1(3).degree(), B1(4).degree()]
is
[1, 2, 3, 4]
which is clearly wrong if $\mathrm{dim}V=24$. As noted in another question ten years ago (I have too little karma to post links), Sage seems to not be able to do this properly.
Is this a problem with Sage, or am I doing something wrong?
SDawydiakMon, 10 Jun 2024 18:06:28 +0200https://ask.sagemath.org/question/77810/Unexpected error with sign() function in SageMathhttps://ask.sagemath.org/question/73186/unexpected-error-with-sign-function-in-sagemath/I have the following rather strange issue with SageMath. More specifically the problem seem to be related with SageMath libraries dealing with permutations and Lie algebras. Here is the part of the code which does not compile properly for some reason:
gl = lie_algebras.gl(QQ, 4)
Ugl = gl.pbw_basis()
E = matrix(Ugl, 4, 4, Ugl.gens())
for sigma in Permutations(4):
for tau in Permutations(4):
pr = sigma.signature() * tau.signature()
for i in range(4):
pr = pr * E[sigma[i] - 1, tau[i] - 1]
The interesting thing is that while the code above does not work well, the issue could be resolved just by adding `1 * `, see below:
gl = lie_algebras.gl(QQ, 4)
Ugl = gl.pbw_basis()
E = matrix(Ugl, 4, 4, Ugl.gens())
for sigma in Permutations(4):
for tau in Permutations(4):
pr = sigma.signature() * tau.signature()
for i in range(4):
pr = 1 * pr * E[sigma[i] - 1, tau[i] - 1]
My experiments show that there is some issue with SageMath function `signature()` since if I replace the line `pr = sigma.signature() * tau.signature()` with `pr = 1`, then both versions compile successfully. The final block of the error message for the first excerpt is as follows:
/usr/lib/python3/dist-packages/sage/algebras/lie_algebras/poincare_birkhoff_witt.py in _act_on_(self, x, self_on_left)
513 # Try the _acted_upon_ first as it might have a direct PBW action
514 # implemented that is faster
--> 515 ret = x._acted_upon_(self, not self_on_left)
516 if ret is not None:
517 return ret
AttributeError: 'int' object has no attribute '_acted_upon_'
Therefore, it might be the case that there is something strange happening with the action of integers on element of Lie algebras (some type-related issue?).
Of course, since the second version works I can proceed, but it looks weird and I would be really interested in understanding the source of this error (to avoid similar ones in the future).
**Comment.** I did no realize at first that for SageMath there is a special Q&A forum, so initially I posted it on SE.
richrow23Wed, 06 Sep 2023 19:04:54 +0200https://ask.sagemath.org/question/73186/Code working on cocalc but not locallyhttps://ask.sagemath.org/question/71075/code-working-on-cocalc-but-not-locally/ Hello everyone. I'm trying to define a new class on sage (called 'SuperLieAlgebra', for Lie algebras with a graded bracket). The code runs fine on cocalc, but when I download it and run it on sage locally (version 10.0), I get a 'SuperLieAlgebra: Name not defined' error. Any idea why this could be? I suspect it has to do with the fact that on cocalc, I'm working on a .sagews file, but locally it's a .py file that I run-but I'm not sure how to fix this.adiFri, 28 Jul 2023 21:25:32 +0200https://ask.sagemath.org/question/71075/Universal enveloping algebra over the complex numbershttps://ask.sagemath.org/question/67678/universal-enveloping-algebra-over-the-complex-numbers/In the documentation there is an example of defining the universal enveloping algebra of a lie algebra L, with the multiplication being *. However, this works only over the field of rationals QQ. How would one instead do this over the field of complex numbers CC?
L = LieAlgebra(QQ, {('e','h'): {'e':-2}, ('f','h'): {'f':2},
('e','f'): {'h':1}}, names='e,f,h')
e,f,h = L.lie_algebra_generators()
L.bracket(h, e)
2*e
elt = h*e; elt
e*h + 2*eAlAnGeToTue, 18 Apr 2023 08:44:43 +0200https://ask.sagemath.org/question/67678/rational weights of (affine) Lie algebrahttps://ask.sagemath.org/question/67562/rational-weights-of-affine-lie-algebra/I am studying affine Lie algebra with non-integral level and weights.
However, multiplying a rational number, like -3/4, to the affine fundamental weights will cause an error `TypeError: unsupported operand parent(s) for *: 'Rational Field' and 'Extended weight lattice of the Root system of type ['A', 2, 1]'`.
**I wonder how to work with rationals?**lelouchFri, 14 Apr 2023 16:51:20 +0200https://ask.sagemath.org/question/67562/Names of variables in universal enveloping algebrahttps://ask.sagemath.org/question/66486/names-of-variables-in-universal-enveloping-algebra/I need to do some computations in the universal enveloping algebras of special linear Lie algebras. I would like to name the standard basis of the Lie algebra in a recognizable way, then make the universal enveloping algebra take that names and print the results of computations with such names.
My problem is that the Lie algebras are defined from generators, not bases, and moreover they impose their own labels (indexed by roots, e.g. E[alpha[1]]) to the universal enveloping algebra.
I wonder if there is any procedure to do this easily and avoid writing a conversion function by hand for each Lie algebra.
An example of my code:
L = LieAlgebra(ZZ, cartan_type=['A',2])
L.inject_variables() #One can use e1,e2, etc. for computing, but they do not appear in the result
PBW = L.pbw_basis()
e12,e23,e13,h2,h1,e21,e32,e31 = PBW.algebra_generators() #One can use e12,etc. to compute, but they do not appear in the result
Then the input e12 produces the output PBW[E[alpha[2]] instead of PBW[e12] as would be desired.
Jose BroxFri, 17 Feb 2023 19:51:41 +0100https://ask.sagemath.org/question/66486/Infinite-dimensional Lie algebras with generators and relationshttps://ask.sagemath.org/question/65416/infinite-dimensional-lie-algebras-with-generators-and-relations/ I need to work with the polynomial current Lie algebra of the general linear Lie algebra, that is $\mathfrak{gl}_N[x]$, which I consider as a complex Lie algebra. In fact I would like to work with its universal enveloping algebra. But the Lie algebra in question is infinite-dimensional. How can I define it by specifying the structure constants? Nikita_SafonkinTue, 20 Dec 2022 10:24:59 +0100https://ask.sagemath.org/question/65416/Weyl character formula in Sagemathhttps://ask.sagemath.org/question/60597/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.
lijr07Sun, 09 Jan 2022 16:11:22 +0100https://ask.sagemath.org/question/60597/Dimension of weight spaces of Lie algebra representationhttps://ask.sagemath.org/question/60530/dimension-of-weight-spaces-of-lie-algebra-representation/Consider a Lie algebra $\frak{g}$. Let $\lambda$ be a dominant integral weight and $L(\lambda)$ be the unique irreducible representation of highest weight $\lambda$. (Since $\lambda$ is dominant and integral, $L(\lambda)$ is finite dimensional).
We know that $L(\lambda)$ decomposes into a direct sum
$$L(\lambda)=\bigoplus_{\mu} L(\lambda)_\mu$$
where $L(\lambda)_\mu$ is a weight space of weight $\mu$.
Is there a way to compute $\dim L(\lambda)_\mu$ in Sage?
I know that Freudenthal formula can be used to find these dimensions by hand. But I want to verify if my calculations are correct. Thanks in advance!
slartibartfastMon, 03 Jan 2022 14:07:51 +0100https://ask.sagemath.org/question/60530/How to compute in the Tensor Algebra $T(V)$ ?https://ask.sagemath.org/question/55256/how-to-compute-in-the-tensor-algebra-tv/I need to make some computations in low degree in the Tensor algebra $T(V)$ of a rational vector space $V$, but i cannot find a good way of doing this. I could use FreeAlgebras, but then i cannot get access to the summands in my element : for example i want to be able to retrieve $a$ $b$ and $c$ from the element $a*b*c $ (whenever the element is homogeneous).
The reason for this is I need to define a 'cycle' function that associates $Wa$ to a tensor $aW$ when $W$ is a tensor and $a \in V$.qfaesWed, 13 Jan 2021 16:21:54 +0100https://ask.sagemath.org/question/55256/Acess bracked elements in free lie algebra element?https://ask.sagemath.org/question/49897/acess-bracked-elements-in-free-lie-algebra-element/I'm trying to access the left and right elements in a free lie algebra element, whose monomials are stored as binary trees. Thus I want a method (like exists in the source for lie_algebra_element) which would return something like
sage: L = LieAlgebra(QQ, 3, 'x')
sage: x0,x1,x2 = L.gens()
sage: Lyn = FL.Lyndon()
sage: a = Lyn.graded_basis(3)[2]; a
[[x0, x1], x1]
sage: a._left
[x0,x1]
sage: a._right
x1
Of course the last 4 lines are fake. One way of seeing this is the following:
sage: isinstance(a, LyndonBracket)
False
sage: isinstance(a, LieBracket)
False
How do I fix this "the right way" ? My current solution is just to set
sage: a_tree = eval(repr(a)); a_tree
[[x0, x1], x1]
But this feels extremely wrong.samdehorityThu, 13 Feb 2020 04:34:45 +0100https://ask.sagemath.org/question/49897/How to access tree information from Free Lie Algebra elements?https://ask.sagemath.org/question/49896/how-to-access-tree-information-from-free-lie-algebra-elements/ I'm trying to access the left and right elements in a free lie algebra element, whose monomials are stored as binary trees. Thus I want a method (like exists in the source for lie_algebra_element) which would return something like
sage: L = LieAlgebra(QQ, 3, 'x')
sage: sx0,x1,x2 = L.gens()
sage: Lyn = FL.Lyndon()
sage: a = Lyn.graded_basis(3)[2]; a
[[x0, x1], x1]
sage: a._left
[x0,x1]
sage: a._right
x1
Of course the last 4 lines are fake. One way of seeing this is the following:
sage: isinstance(a, LyndonBracket)
False
sage: isinstance(a, LieBracket)
False
How do I fix this "the right way" ? My current solution is just to set
sage: a_tree = eval(repr(a)); a_tree
[[x0, x1], x1]
But this feels extremely wrong.
samdehorityThu, 13 Feb 2020 04:33:58 +0100https://ask.sagemath.org/question/49896/Verma modules and accessing constants of proportionalityhttps://ask.sagemath.org/question/48346/verma-modules-and-accessing-constants-of-proportionality/**The Math Part:**
Let me first describe the math without going into the programming. Start with two vectors $v$ and $w$ in a vector space (just a regular vector space with no additional structure). Let's say we know that $w=\lambda\cdot v$ for some scalar $\lambda$. Given $w$ and $v$, can we figure out what $\lambda$ is?
**The Programming Part:** Now let me describe specifics of my calculation. I am working with a Verma Module over $\frak{sp}(4)$.
sage: L = lie_algebras.sp(QQ, 4)
sage: La = L.cartan_type().root_system().weight_lattice().fundamental_weights()
sage: M = L.verma_module(La[1] - 3*La[2])
sage: pbw = M.pbw_basis()
sage: x1,x2,y1,y2,h1,h2 = [pbw(g) for g in L.gens()]
We will call the highest weight vector $v$. In code,
sage: v = M.highest_weight_vector()
sage: v
sage: v[Lambda[1] - 3*Lambda[2]]
Now we have $x_2y_2\cdot v=-3\cdot v$ and $x_2^2y_2^2\cdot v= 24\cdot v$. So in code,
sage: x2*y2*v
sage: -3*v[Lambda[1] - 3*Lambda[2]]
sage: x2^2*y2^2*v
sage: 24*v[Lambda[1] - 3*Lambda[2]]
In general, we will have
$$x_2^ny_2^n\cdot v=c_n\cdot v$$
for some constant $c_n$ (with $c_1=-3$ and $c_2=24$).
My questions is the following.
How to access this constant $c_n$, given that we know $v$ and $c_n\cdot v$?slartibartfastTue, 15 Oct 2019 02:33:14 +0200https://ask.sagemath.org/question/48346/Questions about Lie algebrahttps://ask.sagemath.org/question/48103/questions-about-lie-algebra/I am trying to do some calculations and I don't understand what the output is.
L = lie_algebras.sp(QQ, 4)
L.gens()
The output is the following
(E[alpha[1]], E[alpha[2]], E[-alpha[1]], E[-alpha[2]], h1, h2)
1. I know that the command `L.gens()` gives a set of genearators of the Lie algebra. So I understand that this is giving us an element from $e_\alpha\in L_\alpha$ for each $\alpha\in \Delta$ and the corresponding elements $h_\alpha \in H$, (where $\Delta$ is a base of the root system and $H$ is a Cartan Subalgebra). But I don't understand what these elements exactly are. Are these elements of a Chevalley basis?
2. Let's say I want to figure out $\alpha_1(h_1)$. So I thought maybe `alpha1(h1)` will give me the answer. But I am getting an error. I also tried `L.alpha[1](h1)` which results in an error as well. How can I fix this?slartibartfastMon, 30 Sep 2019 10:44:33 +0200https://ask.sagemath.org/question/48103/Computations on Verma Moduleshttps://ask.sagemath.org/question/48042/computations-on-verma-modules/I want to do some computation on Verma Modules.
Consider the Verma Module $W_\lambda$ of weight $\lambda$. We know that $W_\lambda$ has a unique maximal submodule $N_\lambda$ and a corresponding irreducible quotient $L(\lambda)=W_\lambda/N_\lambda$.
1. I found some documentation about Verma Modules on the SAGE website. But it does not tell how to find the irreducible quotient. I want to figure out this quotient $L(\lambda)$.
2. Secondly, I want to see know the dimensions of weight spaces of $W_\lambda$ and $L(\lambda)$ and what they look like explicitly.
Could you please help me with the syntax? Thanks is advance.slartibartfastTue, 24 Sep 2019 01:44:47 +0200https://ask.sagemath.org/question/48042/