@@ -1313,7 +1313,7 @@ def __init__(self, base_ring, twist_map, name, sparse, category=None):
1313
1313
self ._order = twist_map .order ()
1314
1314
(self ._constants , self ._embed_constants ) = twist_map .fixed_field ()
1315
1315
1316
- def center (self , name = 'z' , names = None , coerce = False ):
1316
+ def center (self , name = 'z' , names = None , coerce = True ):
1317
1317
r"""
1318
1318
Return the center of this skew polynomial ring.
1319
1319
@@ -1359,12 +1359,21 @@ def center(self, name='z', names=None, coerce=False):
1359
1359
sage: y.parent() is Zy
1360
1360
True
1361
1361
1362
- By default, conversion maps between the center and the skew
1363
- polynomial ring are set in both directions, but no coercion
1364
- map is defined::
1362
+ By default, the canonical inclusion of the center into the skew
1363
+ polynomial ring is a coercion map::
1364
+
1365
+ sage: S.has_coerce_map_from(Zy)
1366
+ True
1367
+
1368
+ sage: P = y + x; P
1369
+ x^3 + x
1370
+ sage: P.parent()
1371
+ Skew Polynomial Ring in x over Finite Field in t of size 5^3 twisted by t |--> t^5
1372
+ sage: P.parent() is S
1373
+ True
1374
+
1375
+ Moreover, a conversion map in the other direction is set::
1365
1376
1366
- sage: S(y^2 + 2*y + 3)
1367
- x^6 + 2*x^3 + 3
1368
1377
sage: Zy(x^6 + 2*x^3 + 3)
1369
1378
y^2 + 2*y + 3
1370
1379
@@ -1373,32 +1382,24 @@ def center(self, name='z', names=None, coerce=False):
1373
1382
...
1374
1383
ValueError: x^2 is not in the center
1375
1384
1376
- We now illustrate the fact that no coercion map is set::
1377
-
1378
- sage: S.has_coerce_map_from(Zy)
1379
- False
1380
- sage: Zy.has_coerce_map_from(S)
1381
- False
1382
-
1383
- sage: P = y + x; P
1384
- y + x
1385
- sage: P.parent()
1386
- Univariate Polynomial Ring in y over Skew Polynomial Ring in x over Finite Field in t of size 5^3 twisted by t |--> t^5
1387
- sage: P.parent() is S
1388
- False
1389
-
1390
- Nevertheless, if the user wants to promote the embedding from the
1391
- center to the skew polynomial ring as a coercion map, he/she can
1392
- pass in the argument ``coerce=True``::
1385
+ It is possible to disable the coercion by passing in the
1386
+ argument ``coerce=False``::
1393
1387
1394
- sage: Zu.<u> = S.center(coerce=True )
1388
+ sage: Zu.<u> = S.center(coerce=False )
1395
1389
sage: S.has_coerce_map_from(Zu)
1396
- True
1390
+ False
1397
1391
1398
1392
sage: Q = u + x; Q
1399
- x^3 + x
1393
+ u + x
1394
+ sage: Q.parent()
1395
+ Univariate Polynomial Ring in u over Skew Polynomial Ring in x over Finite Field in t of size 5^3 twisted by t |--> t^5
1400
1396
sage: Q.parent() is S
1401
- True
1397
+ False
1398
+
1399
+ However, in this case, convertion continues to work::
1400
+
1401
+ sage: S(u)
1402
+ x^3
1402
1403
1403
1404
TESTS::
1404
1405
@@ -1412,13 +1413,15 @@ def center(self, name='z', names=None, coerce=False):
1412
1413
names = normalize_names (1 , names )
1413
1414
center = PolynomialRing (self ._constants , names )
1414
1415
embed = SkewPolynomialCenterInjection (center , self , self ._embed_constants , self ._order )
1415
- if coerce :
1416
- self .register_coercion (embed )
1417
- center .register_conversion (embed .section ())
1418
- else :
1419
- try :
1416
+ try :
1417
+ if coerce :
1418
+ self .register_coercion (embed )
1419
+ else :
1420
1420
self .register_conversion (embed )
1421
- center .register_conversion (embed .section ())
1422
- except AssertionError :
1423
- pass
1421
+ except AssertionError :
1422
+ pass
1423
+ try :
1424
+ center .register_conversion (embed .section ())
1425
+ except AssertionError :
1426
+ pass
1424
1427
return center
0 commit comments