14
14
# (at your option) any later version.
15
15
# http://www.gnu.org/licenses/
16
16
#*****************************************************************************
17
+
17
18
from sage .categories .commutative_additive_groups import CommutativeAdditiveGroups
18
- from sage .categories .groups import Groups
19
- from sage .structure .element import MultiplicativeGroupElement
20
- from sage .structure .unique_representation import UniqueRepresentation
21
- from sage .structure .parent import Parent
22
- from sage .categories .morphism import SetMorphism
23
19
from sage .categories .functor import Functor
20
+ from sage .categories .groups import Groups
24
21
from sage .categories .homset import Hom
22
+ from sage .categories .morphism import SetMorphism
23
+ from sage .structure .element import MultiplicativeGroupElement
25
24
from sage .structure .element_wrapper import ElementWrapper
25
+ from sage .structure .parent import Parent
26
+ from sage .structure .unique_representation import UniqueRepresentation
26
27
27
28
28
29
class GroupExp (Functor ):
@@ -59,7 +60,7 @@ class GroupExp(Functor):
59
60
-3
60
61
sage: x.parent()
61
62
Multiplicative form of Integer Ring
62
- sage: EZ(-1)* EZ(6) == EZ(5)
63
+ sage: EZ(-1) * EZ(6) == EZ(5)
63
64
True
64
65
sage: EZ(3)^(-1)
65
66
-3
@@ -77,9 +78,10 @@ class GroupExp(Functor):
77
78
....: return s2.action(mu)
78
79
sage: from sage.categories.morphism import SetMorphism
79
80
sage: from sage.categories.homset import Hom
80
- sage: f = SetMorphism(Hom(L,L, CommutativeAdditiveGroups()), my_action)
81
+ sage: f = SetMorphism(Hom(L, L, CommutativeAdditiveGroups()), my_action)
81
82
sage: F = E(f); F
82
- Generic endomorphism of Multiplicative form of Ambient space of the Root system of type ['A', 2]
83
+ Generic endomorphism of
84
+ Multiplicative form of Ambient space of the Root system of type ['A', 2]
83
85
sage: v = L.an_element(); v
84
86
(2, 2, 3)
85
87
sage: y = F(EL(v)); y
@@ -114,8 +116,8 @@ def _apply_functor(self, x):
114
116
OUTPUT: an isomorphic group whose operation is multiplication rather
115
117
than addition
116
118
117
- In the following example, ``self`` is the functor `GroupExp()`,
118
- `x` is the additive group `QQ^2`, and the output group is stored as `EQ2`.
119
+ In the following example, ``self`` is the functor `` GroupExp()` `,
120
+ ``x`` is the additive group `` QQ^2`` , and the output group is stored as `` EQ2` `.
119
121
120
122
EXAMPLES::
121
123
@@ -145,8 +147,6 @@ def _apply_functor_to_morphism(self, f):
145
147
OUTPUT: the above homomorphism, but between the corresponding
146
148
multiplicative groups
147
149
148
- - The above homomorphism, but between the corresponding multiplicative groups.
149
-
150
150
In the following example, ``self`` is the functor :class:`GroupExp` and `f`
151
151
is an endomorphism of the additive group of integers.
152
152
@@ -156,22 +156,23 @@ def _apply_functor_to_morphism(self, f):
156
156
....: return x + x
157
157
sage: from sage.categories.morphism import SetMorphism
158
158
sage: from sage.categories.homset import Hom
159
- sage: f = SetMorphism(Hom(ZZ,ZZ,CommutativeAdditiveGroups()),double)
159
+ sage: f = SetMorphism(Hom(ZZ, ZZ, CommutativeAdditiveGroups()), double)
160
160
sage: E = GroupExp()
161
161
sage: EZ = E._apply_functor(ZZ)
162
162
sage: F = E._apply_functor_to_morphism(f)
163
163
sage: F.domain() == EZ
164
164
True
165
165
sage: F.codomain() == EZ
166
166
True
167
- sage: F(EZ(3)) == EZ(3)* EZ(3)
167
+ sage: F(EZ(3)) == EZ(3) * EZ(3)
168
168
True
169
169
"""
170
170
new_domain = self ._apply_functor (f .domain ())
171
171
new_codomain = self ._apply_functor (f .codomain ())
172
172
new_f = lambda a : new_codomain (f (a .value ))
173
173
return SetMorphism (Hom (new_domain , new_codomain , Groups ()), new_f )
174
174
175
+
175
176
class GroupExpElement (ElementWrapper , MultiplicativeGroupElement ):
176
177
r"""
177
178
An element in the exponential of a commutative additive group.
@@ -184,13 +185,14 @@ class GroupExpElement(ElementWrapper, MultiplicativeGroupElement):
184
185
185
186
EXAMPLES::
186
187
188
+ sage: from sage.groups.group_exp import GroupExpElement
187
189
sage: G = QQ^2
188
190
sage: EG = GroupExp()(G)
189
- sage: z = GroupExpElement(EG, vector(QQ, (1,-3))); z
191
+ sage: z = GroupExpElement(EG, vector(QQ, (1, -3))); z
190
192
(1, -3)
191
193
sage: z.parent()
192
194
Multiplicative form of Vector space of dimension 2 over Rational Field
193
- sage: EG(vector(QQ,(1,-3)))== z
195
+ sage: EG(vector(QQ, (1, -3))) == z
194
196
True
195
197
196
198
"""
@@ -202,7 +204,7 @@ def __init__(self, parent, x):
202
204
sage: EG = GroupExp()(G)
203
205
sage: x = EG.an_element(); x
204
206
(1, 0)
205
- sage: TestSuite(x).run(skip = "_test_category")
207
+ sage: TestSuite(x).run(skip= "_test_category")
206
208
207
209
See the documentation of :meth:`sage.structure.element_wrapper.ElementWrapper.__init__`
208
210
for the reason behind skipping the category test.
@@ -233,7 +235,7 @@ def __mul__(self, x):
233
235
sage: x = G(2)
234
236
sage: x.__mul__(G(3))
235
237
5
236
- sage: G.product(G(2),G(3))
238
+ sage: G.product(G(2), G(3))
237
239
5
238
240
"""
239
241
return GroupExpElement (self .parent (), self .value + x .value )
@@ -245,7 +247,7 @@ class GroupExp_Class(UniqueRepresentation, Parent):
245
247
246
248
INPUT:
247
249
248
- - `G ` -- a commutative additive group
250
+ - ``G` ` -- a commutative additive group
249
251
250
252
OUTPUT: the multiplicative form of `G`
251
253
@@ -260,7 +262,7 @@ def __init__(self, G):
260
262
EXAMPLES::
261
263
262
264
sage: EG = GroupExp()(QQ^2)
263
- sage: TestSuite(EG).run(skip = "_test_elements")
265
+ sage: TestSuite(EG).run(skip= "_test_elements")
264
266
"""
265
267
if G not in CommutativeAdditiveGroups ():
266
268
raise TypeError ("%s must be a commutative additive group" % G )
@@ -286,7 +288,7 @@ def _element_constructor_(self, x):
286
288
EXAMPLES::
287
289
288
290
sage: G = GroupExp()(ZZ)
289
- sage: G(4) # indirect doctest
291
+ sage: G(4) # indirect doctest
290
292
4
291
293
"""
292
294
return GroupExpElement (self , x )
0 commit comments