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.Thu, 05 Dec 2019 18:36:44 +0100Non-homogenous Ideals In Unital Associative Free Algebrashttps://ask.sagemath.org/question/10597/non-homogenous-ideals-in-unital-associative-free-algebras/I want to define a two-sided ideal `I = [x*y*x*y - x*y]`
in a unital associative free algebra `K.<x,y>`.
But I get:
ArithmeticError: Can only subtract elements of the same degree.
Is there any way to define such an ideal in Sage?Abdolrasoul BaharifardTue, 08 Oct 2013 09:43:39 +0200https://ask.sagemath.org/question/10597/Creating an object of the Magmatic Algebras categoryhttps://ask.sagemath.org/question/48953/creating-an-object-of-the-magmatic-algebras-category/ For the moment being, the category of Sage for nonassociative algebras is called MagmaticAlgebras. I want to know which methods are available in this category, and specifically how to create an object (i.e., a nonassociative algebra). In particular, what I want is to get the free nonassociative algebra in four variables (a,b,c,d) over the rational field. The MagmaticAlgebras reference page is of no use to me. Thank you!Jose BroxThu, 05 Dec 2019 18:36:44 +0100https://ask.sagemath.org/question/48953/substitution of ideal generators of a free algebrahttps://ask.sagemath.org/question/43903/substitution-of-ideal-generators-of-a-free-algebra/I'm trying to map the generators of an ideal $I$ of a free $k$-algebra $A = k \\{ x, y \\}$ to a different free $k$-algebra $B = k \\{ u, v \\}$ (really I'm trying something more complicated, but the failure occurs in even this simplified example). I was attempting to do this via `subs` by creating a dictionary taking $x$ to $u$ and $y$ to $v$, but this is not working.
sage: A.<x, y> = FreeAlgebra(QQ, 2)
sage: I = A*[x*y - y*x - 1]*A
sage: B.<u, v> = FreeAlgebra(QQ, 2)
sage: genMap = {'x':'u', 'y':'v'}
sage: I.gen(0).subs(genMap)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-9d969fff6a4a> in <module>()
----> 1 I.gen(Integer(0)).subs(genMap)
sage/structure/element.pyx in sage.structure.element.Element.subs (build/cythonized/sage/structure/element.c:7572)()
/usr/lib/python2.7/dist-packages/sage/algebras/free_algebra_element.pyc in __call__(self, *x, **kwds)
176 for m, c in six.iteritems(self._monomial_coefficients):
177 if result is None:
--> 178 result = c*m(x)
179 else:
180 result += c*m(x)
sage/rings/rational.pyx in sage.rings.rational.Rational.__mul__ (build/cythonized/sage/rings/rational.c:21325)()
sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:10686)()
TypeError: unsupported operand parent(s) for *: 'Rational Field' and 'Free monoid on 2 generators (x, y)'
This error seems strange to me; is it not understanding elements of $\mathbb{Q}$ and $\\{ x, y \\}$ as elements of $\mathbb{Q} \\{ x, y \\}$? I also tried to do this via a homomorphism $A \to B$ but I could not get this to work, as it seems they are not fully implemented yet for free algebras, from what I could tell. Any help or alternatives would be very appreciated.
**EDIT**: I got a slight work-around, by converting the elements to strings, replacing the variables as characters, and the evaluating the string in the target. However, I feel like this is way more costly than a substitution would be, so I am still interested in a solution.rhoadskjWed, 10 Oct 2018 17:04:18 +0200https://ask.sagemath.org/question/43903/How to implement the free nonassociative algebra?https://ask.sagemath.org/question/42867/how-to-implement-the-free-nonassociative-algebra/ How can I work with nonassociative and noncommutative polynomials over a field (in some prefixed number of variables)? The function FreeAlgebra produces a free associative algebra.Jose BroxMon, 09 Jul 2018 08:28:38 +0200https://ask.sagemath.org/question/42867/Free algebra with involutionhttps://ask.sagemath.org/question/42253/free-algebra-with-involution/ I'd like to implement an involution over a free (associative noncommutative) algebra, i.e., an antiautomorphism of order 2 (linear map such that $f(ab)=f(b)f(a)$ and $f(f(a))=a$), but I don't know where to start. Perhaps we could define the algebra with a double number of generators, every generator x having its involution x1, and then define f from this by correspondence of generators (but I have no knowledge to do this).
More precisely, what I actually want to do is to take the product of the algebra as starting point to define a new product of the form
$$a*b:=af(b).$$Jose BroxFri, 04 May 2018 00:30:23 +0200https://ask.sagemath.org/question/42253/Calculations in quotient of a free algebrahttps://ask.sagemath.org/question/41219/calculations-in-quotient-of-a-free-algebra/I want to define (the algebra part of) Sweedler's four-dimensional Hopf algebra, which is freely generated by $x,y$ and subject to the relations
$$
x^2 = 1, \qquad y^2 = 0, \qquad x\cdot y = - y\cdot x~ ,
$$
but I don't see how to do it.
I have tried the following:
sage: A.<x,y> = FreeAlgebra(QQbar)
sage: I = A*[x*x - 1, y*y, x*y + y*x]*A
sage: H.<x,y> = A.quo(I)
sage: H
Quotient of Free Algebra on 2 generators (x, y) over Algebraic Field by the ideal (-1 + x^2, y^2, x*y + y*x)
But then I get
sage: H.one() == H(x*x)
False
So is this currently possibly using a different method?
ThanksJo BeWed, 21 Feb 2018 14:44:18 +0100https://ask.sagemath.org/question/41219/How to extract exponents from a monomial in a FreeAlgebrahttps://ask.sagemath.org/question/37170/how-to-extract-exponents-from-a-monomial-in-a-freealgebra/I want something like this, or a way to get the equivalent information:
sage: S.<X,Y> = FreeAlgebra(QQ)
sage: m = X*Y*X^2
sage: m.my_exponents_function()
[(X,1),(Y,1),(X,2)]
or
sage: m.my_factor_function()
[X,Y,X,X]
would be as good or maybe better.
How can I get that information? I've looked over the available methods and can't seem to find anything. This is easy to do with Polynomial Rings.
I guess I could parse the string representation, but shouldn't there be a better way?paragonWed, 05 Apr 2017 01:34:43 +0200https://ask.sagemath.org/question/37170/default order in FreeAlgebrahttps://ask.sagemath.org/question/36369/default-order-in-freealgebra/In this link : http://doc.sagemath.org/html/en/reference/algebras/sage/algebras/free_algebra.html I am interested in the method lie_polynomial(w), which takes word from a FreeMonoid as input and give the output, the corresponding Lie monomial. But All these things depends on the order in the FreeAlgebra elements. Theoretically this is the lex order induced from the order on the alphabets, but in sage, the order in FreeAlgebra is it same as lex or different order?
F = FreeAlgebra(QQ, 3, 'x,y,z')
M.<x,y,z> = FreeMonoid(3)
w = x*y*z
print F.lie_polynomial(w)
w = w.to_word()
w.lyndon_factorization()
This code giving me the output :
x*y*z - y*z*x
(xyz)
Since, w is Lyndon, the associated Lie monomial is [x [y z]] = xyz - xzy - yzx + zyx which is different from the above output, where am I making mistake. please tell.
The method of associating monomial to a word can be seen here : https://en.wikipedia.org/wiki/Free_Lie_algebra#Lyndon_basis
Edit :
There is a ticket regarding lie_polynomial( ) method. Please see here : https://trac.sagemath.org/ticket/22251
Thanks a lot once again.GA316Tue, 24 Jan 2017 07:41:56 +0100https://ask.sagemath.org/question/36369/Exterior and tensor product of algebrashttps://ask.sagemath.org/question/33337/exterior-and-tensor-product-of-algebras/Hi,
I've been trying to construct something like $\Lambda^2 A \otimes A$ where $A$ is a free associative $\mathbb{Q}$-algebra on some generators, say, $x$ and $y$, without success. I think I understand the basics of the FreeAlgebra object in Sage, but I could not find more specific information about this kind of construction in the documentation or here in this forum. Ultimately, I would like to form and calculate with expressions like $x y \wedge xx \otimes xy$ where $x,y\in \mathbb{Q}\langle x,y\rangle$, the free associative unital algebra, and such that, for instance, $xy \wedge xx \otimes xy = - xx \wedge xy \otimes xy$. Does anyone know whether this is or is not possible to achieve in Sage at the moment? Any help will be greatly appreciated.
Cheers,
WaldeckWaldeckSat, 07 May 2016 00:59:45 +0200https://ask.sagemath.org/question/33337/Confused about FreeAlgebra quotientshttps://ask.sagemath.org/question/32178/confused-about-freealgebra-quotients/I think I'm misunderstanding how quotients of free algebras work. I tried to make a free algebra on two generators x, y and mod out by xy = yx, so you get a polynomial algebra -- but that's not what happened.
<pre><code>sage: R.<x,y> = FreeAlgebra(QQ)
sage: I = R*[x*y-y*x]*R
sage: Q.<a,b> = R.quo(I)
sage: a*b is b*a
False
sage: Q.is_commutative()
False</code></pre>
Relatedly, the documentation for free_module_quotient gives an example (constructing the quaternions as a free quotient):
<pre><code>sage: n = 2
sage: A = FreeAlgebra(QQ,n,'x')
sage: F = A.monoid()
sage: i, j = F.gens()
sage: mons = [ F(1), i, j, i*j ]
sage: r = len(mons)
sage: M = MatrixSpace(QQ,r)
sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]) ]
sage: H2.<i,j> = A.quotient(mons,mats)
</code></pre>
but I'm confused exactly how the matrices in the penultimate line describe the (multiplication) action? I.e. if I have some relation, say x^2 = 0, that I want to mod out by, how do I accomplish that using matrices?qwWed, 13 Jan 2016 00:03:58 +0100https://ask.sagemath.org/question/32178/Products in a free algebra.https://ask.sagemath.org/question/8807/products-in-a-free-algebra/If I have a free algebra generated by x and y is there a way to tell that x*y is a product of x and y? I would like to define a function that takes products x*y and returns -2*x - 2*y - 4. broken_symlinkMon, 01 Jul 2013 06:10:15 +0200https://ask.sagemath.org/question/8807/Square root in FunctionFieldhttps://ask.sagemath.org/question/9585/square-root-in-functionfield/Hi,
I'm working with $q$-functions and I would like to define a free algebra over the algebraic field with an extra parameter $q$ for which I can also take roots i.e. I would like to do something like this
sage: F.<q> = FunctionAlgebra(AA)
sage: A.<a,b,c,d> = FreeAlgebra(F, 4)
sage: (1+q)**(1/2)*a*b
sqrt(1+q)*a*b
The function FunctionAlgebra is not the correct function, since it only includes (integer) powers of $q$. Is it possible to extend this FunctionAlgebra to something where sums of powers of $q$ also have roots? Or is there an other function for which I can do this?
Best,
NoudNoudThu, 29 Nov 2012 08:39:45 +0100https://ask.sagemath.org/question/9585/Skew commuting variableshttps://ask.sagemath.org/question/9512/skew-commuting-variables/I want to work in the ring `QQ<x0, x1, x2> / (xi*xj = -xj*xi for i \neq j)`. (In particular, xi^2 \neq 0; this is not the exterior algebra.)
I seems like FreeAlgebraQuotient is the thing to use, but I am not sure how. In the documentation for FreeAlgebraQuotient, the algebras are 4-dimensional as modules over QQ. However in my application, the algebra is infinite-dimensional as a module, so I can't write down the matrices for the action of the generators.
Is there another way to obtain this ring?
Thanks.OliverPWed, 07 Nov 2012 18:22:17 +0100https://ask.sagemath.org/question/9512/Free algebra over infinite alphabethttps://ask.sagemath.org/question/8599/free-algebra-over-infinite-alphabet/Is it possible to work with a free algebra over an infinite alphabet ? Or to define an Infinite ring of **non-commutative** polynomials ?
I need one of these structures to work with the quasi shuffle product.Matthieu DeneufchâtelThu, 29 Dec 2011 07:39:25 +0100https://ask.sagemath.org/question/8599/