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.Fri, 10 May 2019 18:35:29 +0200Coercion from PBW to universal enveloping algebrahttps://ask.sagemath.org/question/46483/coercion-from-pbw-to-universal-enveloping-algebra/I'm using *sage.algebras.lie_algebras.poincare_birkhoff_witt* to do computations in the universal enveloping algebras of some Lie algebras. I want to then use the resulting elements in the PBW basis to act on (a subalgebra) of the Lie algebra. For this I need to use the Lie algebra's bracket() method, which only works with elements of the Lie algebra.
Hence I need to coerce elements of PBW back into (NC polynomials of) elements of the Lie algebra. How do I do this?
Example
sage: lie_algebra = LieAlgebra(QQ, cartan_type='A4')
sage: pbw_basis = lie_algebra.pbw_basis()
sage: pbw_basis.an_element()
>>> PBW[alpha[4]]^2*PBW[alpha[3]]^2*PBW[alpha[2]]^3 + 2*PBW[alpha[4]] + 3*PBW[alpha[3]] + 1
Then I want to obtain
>>> E[alpha[4]]^2*E[alpha[3]]^2*E[alpha[2]]^3 + 2*E[alpha[4]] + 3*E[alpha[3]] + 1
Or rather it's enough if I can convert a term like PBW[alpha[4]] to E[alpha[4]], because I want to essentially use the following function
def universal_enveloping_algebra_action(pbw_elt,e):
result=0
for term,coefficient in pbw_elt:
sub_result=e
for factor,power in term:
for _ in range(power):
sub_result=lie_algebra.bracket(factor,sub_result)
result+=sub_result
return result
Here pbw_elt is an element of the PBW basis, and e is in the Lie algebra. In this case 'factor' needs to be coerced into an element of the Lie algebra.
Right now I solved the problem by making a dictionary converting algebra generators of pbw_basis into basis elements of the Lie algebra, but it feels like there should be a much more elegant solution.
TilpoFri, 10 May 2019 18:35:29 +0200https://ask.sagemath.org/question/46483/Monomial coefficients in a PBW basishttps://ask.sagemath.org/question/46432/monomial-coefficients-in-a-pbw-basis/ Hi,
I'm using the PBW basis. I can't add a link but one finds it easily by googling "PBW basis sage".
I have to multiply a lot of monomial and store their coefficients. So given a PBW monomial and an expression, is there a command which can give me the corresponding coefficient, i.e something like coefficient(degrees) but in the Lie algebra setting, where the monomials are PBW monomials ?
Thanks in advance. NicolasFri, 03 May 2019 14:59:57 +0200https://ask.sagemath.org/question/46432/Scaling and tensor product for Lie Groupshttps://ask.sagemath.org/question/46366/scaling-and-tensor-product-for-lie-groups/I am new to any coding. I want to compute a tensor product of several scaled weights of a lie group and I can't get this to work.
Looking at the sage math pages for Weyl Character Rings, I figured out how to do tensor product decompositions, e.g. if you put in
A2 = WeylCharacterRing("A3",style="coroots")
A2(1,1,1)*A2(1,1,0)*A2(1,1,0)
then it gives you the decomposition of the above tensor product (where the weights (1,1,1), etc., are written in the fundamental weight basis).
I want to compute something like
A2(2,2,2)*A2(2,2,0)*A2(2,2,0)
where each of the weights is scaled by 2, but without having to manually scale the weights (so I can implement this in some more general code).
You can scale weights by entering e.g. A2(1,1,1).scale(2), and this gives you A2(2,2,2), BUT this only works for me when I add .ambient() to the end of the definition of A2 above. HOWEVER after I add .ambient(), the tensor products no longer work! (If I try to do a tensor product after adding the .ambient(), it just adds the vectors componentwise...)
If anyone is familiar with how to do this sort of thing, your help would be greatly appreciated! Thanks.anonFri, 26 Apr 2019 18:38:48 +0200https://ask.sagemath.org/question/46366/Free nilpotent Lie algebra of step 3 with 11 generatorshttps://ask.sagemath.org/question/44619/free-nilpotent-lie-algebra-of-step-3-with-11-generators/ This works:
S = LieAlgebra(QQ, 10, step=3, names='X', naming='linear')
and this works:
S = LieAlgebra(QQ, 11, step=2, names='X', naming='linear')
but this doesn't work:
S = LieAlgebra(QQ, 11, step=3, names='X', naming='linear')
though it should?
Traceback:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-79-8672234ea66b> in <module>()
----> 1 S = LieAlgebra(QQ, Integer(11), step=Integer(3), names='X', naming='linear')
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/misc/classcall_metaclass.pyx in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (build/cythonized/sage/misc/classcall_metaclass.c:1640)()
327 """
328 if cls.classcall is not None:
--> 329 return cls.classcall(cls, *args, **kwds)
330 else:
331 # Fast version of type.__call__(cls, *args, **kwds)
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/algebras/lie_algebras/lie_algebra.pyc in __classcall_private__(cls, R, arg0, arg1, names, index_set, abelian, nilpotent, category, **kwds)
439 from sage.algebras.lie_algebras.nilpotent_lie_algebra import FreeNilpotentLieAlgebra
440 del kwds["step"]
--> 441 return FreeNilpotentLieAlgebra(R, arg1, step, names=names, **kwds)
442 elif nilpotent:
443 raise ValueError("free nilpotent Lie algebras must have a"
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/misc/classcall_metaclass.pyx in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (build/cythonized/sage/misc/classcall_metaclass.c:1640)()
327 """
328 if cls.classcall is not None:
--> 329 return cls.classcall(cls, *args, **kwds)
330 else:
331 # Fast version of type.__call__(cls, *args, **kwds)
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/algebras/lie_algebras/nilpotent_lie_algebra.pyc in __classcall_private__(cls, R, r, s, names, naming, category, **kwds)
325 return super(FreeNilpotentLieAlgebra, cls).__classcall__(
326 cls, R,r, s, names=tuple(names), naming=naming,
--> 327 category=category, **kwds)
328
329 def __init__(self, R, r, s, names, naming, category, **kwds):
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedFunction.__call__ (build/cythonized/sage/misc/cachefunc.c:6301)()
1003 return self.cache[k]
1004 except KeyError:
-> 1005 w = self.f(*args, **kwds)
1006 self.cache[k] = w
1007 return w
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/structure/unique_representation.py in __classcall__(cls, *args, **options)
1025 True
1026 """
-> 1027 instance = typecall(cls, *args, **options)
1028 assert isinstance( instance, cls )
1029 if instance.__class__.__reduce__ == CachedRepresentation.__reduce__:
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/misc/classcall_metaclass.pyx in sage.misc.classcall_metaclass.typecall (build/cythonized/sage/misc/classcall_metaclass.c:2090)()
494 TypeError: Argument 'cls' has incorrect type (expected type, got classobj)
495 """
--> 496 return (<PyTypeObject*>type).tp_call(cls, args, kwds)
497
498 # Class for timing::
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/algebras/lie_algebras/nilpotent_lie_algebra.pyc in __init__(self, R, r, s, names, naming, category, **kwds)
398 for X_ind, X in basis_by_deg[dx]:
399 for Y_ind, Y in basis_by_deg[dy]:
--> 400 Z = L[X, Y]
401 if not Z.is_zero():
402 s_coeff[(X_ind, Y_ind)] = {W_ind: Z[W.leading_support()]
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/algebras/lie_algebras/lie_algebra.pyc in __getitem__(self, x)
573 return x[1].ideal(x[0])
574 # Otherwise it is the bracket of two elements
--> 575 return self(x[0])._bracket_(self(x[1]))
576 return super(LieAlgebra, self).__getitem__(x)
577
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/algebras/lie_algebras/lie_algebra_element.pyx in sage.algebras.lie_algebras.lie_algebra_element.FreeLieAlgebraElement._bracket_ (build/cythonized/sage/algebras/lie_algebras/lie_algebra_element.c:19132)()
1452 a, b = mr, ml
1453 cr = -cr
-> 1454 for b_elt, coeff in self.parent()._rewrite_bracket(a, b).iteritems():
1455 d[b_elt] = d.get(b_elt, zero) + cl * cr * coeff
1456 if d[b_elt] == zero:
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCaller.__call__ (build/cythonized/sage/misc/cachefunc.c:10824)()
1951 return cache[k]
1952 except KeyError:
-> 1953 w = self._instance_call(*args, **kwds)
1954 cache[k] = w
1955 return w
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCaller._instance_call (build/cythonized/sage/misc/cachefunc.c:10280)()
1827 True
1828 """
-> 1829 return self.f(self._instance, *args, **kwds)
1830
1831 cdef fix_args_kwds(self, tuple args, dict kwds):
/opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/algebras/lie_algebras/free_lie_algebra.pyc in _rewrite_bracket(self, l, r)
690 # For a similar reason, we have b >= c.
691 # Compute the left summand
--> 692 for m, inner_coeff in iteritems(self._rewrite_bracket(l._right, r)):
693 if l._left == m:
694 continue
AttributeError: 'sage.algebras.lie_algebras.lie_algebra_element.Lie' object has no attribute '_right'
rburingSun, 09 Dec 2018 23:51:13 +0100https://ask.sagemath.org/question/44619/Branching to Levi Subgroups in Sagehttps://ask.sagemath.org/question/45691/branching-to-levi-subgroups-in-sage/In the Sage computer package, there useful exist tools for branching representations of a simple Lie group to a Levi subgroup. See for example the root system $branching Rules \subseteq $ combinatorics in the Sage manual
Explicitly, one is branching to subgroup corresponding to a Dynkin sub-diagram, obtained by removing a single node.
For example, we can branch from $\operatorname{SL}(n)$ to the subgroup $\operatorname{SL}(n-1)$.
However, $\operatorname{SL}(n-1)$ can be considered as "living" in the larger subgroup
$\operatorname{SL}(n-1) \times \operatorname{U}(1)$. This is true for every subgroup coming from a deleted node, i.e. one can always take the product of the subgroup with $\operatorname{U}(1)$, to obtain a larger subgroup.
How does one branch to this subgroup in Sage. For example, it is done in the LieArt program for mathematica: see A3 of the ArXiv version of Lie Art.
Is this also possible in Sage?nadiasusyWed, 06 Mar 2019 22:10:48 +0100https://ask.sagemath.org/question/45691/Automorphisms and derivations of Lie algebrashttps://ask.sagemath.org/question/34778/automorphisms-and-derivations-of-lie-algebras/Is there a way to compute automorphisms and/or derivations of a Lie algebra (of dimension 4)?
Thanks in advance!danieleThu, 08 Sep 2016 19:36:29 +0200https://ask.sagemath.org/question/34778/R-module/algebra valued differential formshttps://ask.sagemath.org/question/28736/r-modulealgebra-valued-differential-forms/I know one can work with real differential forms using SageManifolds, but what are the chances one can use out of the box code to extend to values in some vector space, or better, algebra? I'm thinking matrix Lie algebras, so one could work quite concretely, rather than over some abstract module.David RobertsFri, 31 Jul 2015 08:50:41 +0200https://ask.sagemath.org/question/28736/how to do inner product between two weights of a lie algebra?https://ask.sagemath.org/question/27188/how-to-do-inner-product-between-two-weights-of-a-lie-algebra/ how to do inner product between two weights of a lie algebra?huyichenWed, 24 Jun 2015 03:12:21 +0200https://ask.sagemath.org/question/27188/Dimensions of modules in branchinghttps://ask.sagemath.org/question/27011/dimensions-of-modules-in-branching/ For example, consider the following branching:
G2=WeylCharacterRing("G2",style="coroots")
adj=G2(0,1)
A1 = WeylCharacterRing("A1", style="coroots")
adj.branch(A1,rule="levi")
How can I find the dimensions of all representations that occur?
In this example, we obtain:
3*A1(0) + A1(2) + 2*A1(3)
and I would like to get:
3*1 + 3 + 2*4
(Note: If I try A1(1).degree() I obtain 1 which is wrong.)vit.tucekWed, 03 Jun 2015 16:55:46 +0200https://ask.sagemath.org/question/27011/Differential forms and tensorshttps://ask.sagemath.org/question/9297/differential-forms-and-tensors/Dear all,
A long time ago I was trying to implement a SAGE code for working with [Differential Forms with values in a certain Lie algebra](http://doxdrum.wordpress.com/2011/02/10/sage-tip-creating-a-class-for-non-abelian-forms/), but due to my lack of programming knowledge, I couldn't.
This kind of objects are important for working with *non-Abelin gauge theories*.
**Question**
Is it possible to define and work with those objects?
So far there is no reference of it in the manual.
Thank you!DoxWed, 05 Sep 2012 15:48:24 +0200https://ask.sagemath.org/question/9297/Killing formhttps://ask.sagemath.org/question/10442/killing-form/Hi,
is there a simple possibility to calculate the Killing form in some standard matrix Lie-Algebras like $\mathfrak{so}(n,\mathbb{R})$?
Thanks in advance for your answers!twchFri, 16 Aug 2013 18:13:38 +0200https://ask.sagemath.org/question/10442/Not able to relabel a Cartan type in the notebookhttps://ask.sagemath.org/question/9380/not-able-to-relabel-a-cartan-type-in-the-notebook/In the shell:
sage: A3 = CartanType("A3")
sage: A3.relabel({1:2,2:3,3:1})
['A', 3] relabelled by {1: 2, 2: 3, 3: 1}
But in the notebook:
In:
A3 = CartanType("A3")
A3.relabel({1:2,2:3,3:1})
Out:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_3.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("QTMgPSBDYXJ0YW5UeXBlKCJBMyIpCkEzLnJlbGFiZWwoezE6MiwyOjMsMzoxfSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmpWUCLyz/___code___.py", line 4, in <module>
exec compile(u'A3.relabel({_sage_const_1 :_sage_const_2 ,_sage_const_2 :_sage_const_3 ,_sage_const_3 :_sage_const_1 })
File "", line 1, in <module>
File "/usr/lib/sage/local/lib/python2.7/site-packages/sage/combinat/root_system/cartan_type.py", line 795, in relabel
import type_relabel
File "/usr/lib/sage/local/lib/python2.7/site-packages/sage/combinat/root_system/type_relabel.py", line 278, in <module>
class CartanType_affine(sage.combinat.root_system.cartan_type.CartanType_affine):
AttributeError: 'module' object has no attribute 'cartan_type'
Strange, isn't it?
JesustcTue, 02 Oct 2012 17:51:23 +0200https://ask.sagemath.org/question/9380/generalized Gell-Mann matriceshttps://ask.sagemath.org/question/8478/generalized-gell-mann-matrices/Does anyone know of an implementation of the generalized Gell-Mann matrices?
They are defined here:
http://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices
There is a nice Mathematica demonstration about the dimension 3 case:
http://demonstrations.wolfram.com/EverythingAboutGellMannMatricesPart1UnaryOperations/
Failing that, I would like to figure out how to put them in from scratch. Specifically, given a dimension, I would like a list of the Gell-Mann matrices and to be able to multiply and to take the commutator of two of them. The problem is that I do not have any ideas for turning these rules into sage code and creating a collection of matrices in this way.JohannesWachsTue, 15 Nov 2011 16:13:28 +0100https://ask.sagemath.org/question/8478/Infinite dimensional Lie algebras in Sagehttps://ask.sagemath.org/question/8264/infinite-dimensional-lie-algebras-in-sage/Dear Sage community,
I'm considering giving Sage a spin. Having the scripting possibilities that python offers at one's disposal seems very appealing.
But I would first like to know if - short of writing the module I need in python - Sage is currently capable of addressing the kind of problems I am interested in.
I mainly work with infinite dimensional Lie algebras such as the [Virasoro algebra](http://en.wikipedia.org/wiki/Virasoro_algebra). Is there an easy way to implement such algebras in Sage, by specifying structure constants or something like that?GonnemanMon, 08 Aug 2011 07:32:34 +0200https://ask.sagemath.org/question/8264/