9
9
# Distributed under the terms of the GNU General Public License (GPL)
10
10
# as published by the Free Software Foundation; either version 2 of
11
11
# the License, or (at your option) any later version.
12
- # http:s //www.gnu.org/licenses/
12
+ # https: //www.gnu.org/licenses/
13
13
# ***************************************************************************
14
14
15
15
from .finite_dimensional_algebra_element import FiniteDimensionalAlgebraElement
18
18
from sage .rings .integer_ring import ZZ
19
19
20
20
from sage .categories .magmatic_algebras import MagmaticAlgebras
21
+ from sage .categories .algebras import Algebras
21
22
from sage .matrix .constructor import matrix
22
23
from sage .structure .element import Matrix
23
24
from sage .structure .category_object import normalize_names
@@ -32,6 +33,9 @@ class FiniteDimensionalAlgebra(UniqueRepresentation, Parent):
32
33
r"""
33
34
Create a finite-dimensional `k`-algebra from a multiplication table.
34
35
36
+ This is a magmatic `k`-algebra, i.e., not necessarily
37
+ associative or unital.
38
+
35
39
INPUT:
36
40
37
41
- ``k`` -- a field
@@ -45,6 +49,10 @@ class FiniteDimensionalAlgebra(UniqueRepresentation, Parent):
45
49
``True``, then the category is set to ``category.Associative()``
46
50
and methods requiring associativity assume this
47
51
52
+ - ``assume_unital`` -- boolean (default: ``False``); if
53
+ ``True``, then the category is set to ``category.Unital()``
54
+ and methods requiring unitality assume this
55
+
48
56
- ``category`` -- (default:
49
57
``MagmaticAlgebras(k).FiniteDimensional().WithBasis()``)
50
58
the category to which this algebra belongs
@@ -67,6 +75,49 @@ class FiniteDimensionalAlgebra(UniqueRepresentation, Parent):
67
75
....: Matrix([[0,0,0], [0,0,0], [0,0,1]])])
68
76
sage: B
69
77
Finite-dimensional algebra of degree 3 over Rational Field
78
+ sage: B.one()
79
+ e0 + e2
80
+ sage: B.is_associative()
81
+ True
82
+
83
+ A more complicated example (the 3-rd descent algebra in
84
+ a slightly rescaled I-basis, see :class:`DescentAlgebra`)::
85
+
86
+ sage: Ma = Matrix([[6,0,0,0], [0,0,0,0], [0,0,0,0], [0,0,0,0]])
87
+ sage: Mb = Matrix([[0,0,0,0], [0,1,0,0], [0,1,0,0], [0,0,0,0]])
88
+ sage: Mc = Matrix([[0,0,0,0], [0,0,1,0], [0,0,1,0], [0,0,0,0]])
89
+ sage: Md = Matrix([[0,0,0,0], [0,1,-1,0], [0,-1,1,0], [0,0,0,2]])
90
+ sage: C = FiniteDimensionalAlgebra(QQ, [Ma, Mb, Mc, Md])
91
+ sage: C.one()
92
+ 1/6*e0 + 1/2*e1 + 1/2*e2 + 1/2*e3
93
+ sage: C.is_associative()
94
+ True
95
+ sage: C.is_commutative()
96
+ False
97
+
98
+ If we set both ``is_associative`` and ``is_unital`` to
99
+ ``True``, then this is an associative unital algebra and
100
+ belongs to the category of
101
+ :class:`sage.categories.finite_dimensional_algebras_with_basis.FiniteDimensionalAlgebrasWithBasis`::
102
+
103
+ sage: C = FiniteDimensionalAlgebra(QQ, [Ma, Mb, Mc, Md],
104
+ ....: assume_associative=True,
105
+ ....: assume_unital=True)
106
+ sage: C.radical_basis()
107
+ (e1 - e2,)
108
+ sage: C.radical()
109
+ Radical of Finite-dimensional algebra of degree 4 over Rational Field
110
+ sage: C.center_basis()
111
+ (e0, e1 + e2 + e3)
112
+ sage: C.center()
113
+ Center of Finite-dimensional algebra of degree 4 over Rational Field
114
+ sage: C.center().is_commutative()
115
+ True
116
+ sage: e = C.basis()
117
+ sage: C.annihilator_basis([e[1]])
118
+ (e0, e1 - e2, e3)
119
+ sage: C.annihilator_basis([e[1]], side='left')
120
+ (e0, e1 - e2 - e3)
70
121
71
122
TESTS::
72
123
@@ -82,7 +133,7 @@ class FiniteDimensionalAlgebra(UniqueRepresentation, Parent):
82
133
"""
83
134
@staticmethod
84
135
def __classcall_private__ (cls , k , table , names = 'e' , assume_associative = False ,
85
- category = None ):
136
+ assume_unital = False , category = None ):
86
137
"""
87
138
Normalize input.
88
139
@@ -105,6 +156,26 @@ def __classcall_private__(cls, k, table, names='e', assume_associative=False,
105
156
sage: A1 is A2
106
157
True
107
158
159
+ Likewise for the ``assume_associative`` keyword::
160
+
161
+ sage: A3 = FiniteDimensionalAlgebra(GF(3), table,
162
+ ....: category=cat.Unital())
163
+ sage: A4 = FiniteDimensionalAlgebra(GF(3), table, assume_unital=True)
164
+ sage: A3 is A4
165
+ True
166
+
167
+ With both keywords on, the
168
+ :class:`sage.categories.algebras.Algebras` category
169
+ is used::
170
+
171
+ sage: cat_a = Algebras(GF(3)).FiniteDimensional().WithBasis()
172
+ sage: A5 = FiniteDimensionalAlgebra(GF(3), table,
173
+ ....: category=cat_a)
174
+ sage: A6 = FiniteDimensionalAlgebra(GF(3), table, assume_associative=True,
175
+ ....: assume_unital=True)
176
+ sage: A5 is A6
177
+ True
178
+
108
179
Uniqueness depends on the category::
109
180
110
181
sage: cat = Algebras(GF(3)).FiniteDimensional().WithBasis()
@@ -144,6 +215,12 @@ def __classcall_private__(cls, k, table, names='e', assume_associative=False,
144
215
cat = cat .or_subcategory (category )
145
216
if assume_associative :
146
217
cat = cat .Associative ()
218
+ if assume_unital :
219
+ # both unital and associative, so algebra in modern sense
220
+ cat = Algebras (k ).FiniteDimensional ().WithBasis ()
221
+ cat = cat .or_subcategory (category )
222
+ elif assume_unital :
223
+ cat = cat .Unital ()
147
224
148
225
names = normalize_names (n , names )
149
226
@@ -610,10 +687,10 @@ def is_unitary(self):
610
687
v = matrix (k , 1 , n ** 2 , (n - 1 ) * ([kone ] + n * [kzero ]) + [kone ])
611
688
try :
612
689
sol1 = B1 .solve_left (v )
613
- sol2 = B2 .solve_left (v )
614
690
except ValueError :
615
691
return False
616
- assert sol1 == sol2
692
+ if sol1 * B2 != v :
693
+ return False
617
694
self ._one = sol1
618
695
return True
619
696
@@ -931,7 +1008,8 @@ def maximal_ideals(self):
931
1008
"""
932
1009
Return a list consisting of all maximal ideals of ``self``.
933
1010
934
- The algebra ``self`` has to be in the category of associative algebras.
1011
+ The algebra ``self`` has to be in the category of
1012
+ commutative, associative algebras.
935
1013
936
1014
EXAMPLES::
937
1015
0 commit comments