|
7 | 7 | which constructs a general dense univariate Ore polynomial ring over a |
8 | 8 | commutative base with equipped with an endomorphism and/or a derivation. |
9 | 9 |
|
| 10 | +TESTS: |
| 11 | +
|
| 12 | +The Ore polynomial ring is commutative if the twisting morphism is the |
| 13 | +identity and the twisting derivation vanishes. :: |
| 14 | +
|
| 15 | + sage: # needs sage.rings.finite_rings |
| 16 | + sage: k.<a> = GF(5^3) |
| 17 | + sage: Frob = k.frobenius_endomorphism() |
| 18 | + sage: S.<x> = k['x', Frob] |
| 19 | + sage: S.is_commutative() |
| 20 | + False |
| 21 | + sage: T.<y> = k['y', Frob^3] |
| 22 | + sage: T.is_commutative() |
| 23 | + True |
| 24 | +
|
| 25 | + sage: R.<t> = GF(5)[] |
| 26 | + sage: der = R.derivation() |
| 27 | + sage: A.<d> = R['d', der] |
| 28 | + sage: A.is_commutative() |
| 29 | + False |
| 30 | + sage: B.<b> = R['b', 5*der] |
| 31 | + sage: B.is_commutative() |
| 32 | + True |
| 33 | +
|
10 | 34 | AUTHOR: |
11 | 35 |
|
12 | 36 | - Xavier Caruso (2020-04) |
|
21 | 45 | # https://www.gnu.org/licenses/ |
22 | 46 | # *************************************************************************** |
23 | 47 |
|
24 | | -from sage.misc.prandom import randint |
| 48 | +from sage.categories.algebras import Algebras |
| 49 | +from sage.categories.commutative_rings import CommutativeRings |
| 50 | +from sage.categories.morphism import Morphism |
25 | 51 | from sage.misc.cachefunc import cached_method |
26 | 52 | from sage.misc.lazy_import import lazy_import |
| 53 | +from sage.misc.prandom import randint |
27 | 54 | from sage.rings.infinity import Infinity |
| 55 | +from sage.rings.integer import Integer |
| 56 | +from sage.rings.polynomial.ore_polynomial_element import OrePolynomialBaseringInjection |
| 57 | +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing |
| 58 | +from sage.rings.ring import _Fields |
28 | 59 | from sage.structure.category_object import normalize_names |
| 60 | +from sage.structure.element import Element |
29 | 61 | from sage.structure.parent import Parent |
30 | | - |
31 | 62 | from sage.structure.unique_representation import UniqueRepresentation |
32 | | -from sage.rings.integer import Integer |
33 | | -from sage.structure.element import Element |
34 | | - |
35 | | -from sage.categories.commutative_rings import CommutativeRings |
36 | | -from sage.categories.algebras import Algebras |
37 | | -from sage.rings.ring import _Fields |
38 | | - |
39 | | -from sage.categories.morphism import Morphism |
40 | | - |
41 | | -from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing |
42 | | -from sage.rings.polynomial.ore_polynomial_element import OrePolynomialBaseringInjection |
43 | 63 |
|
44 | 64 | lazy_import('sage.rings.derivation', 'RingDerivation') |
45 | 65 |
|
@@ -421,7 +441,11 @@ def __init__(self, base_ring, morphism, derivation, name, sparse, category=None) |
421 | 441 | self._morphism = morphism |
422 | 442 | self._derivation = derivation |
423 | 443 | self._fraction_field = None |
424 | | - category = Algebras(base_ring).or_subcategory(category) |
| 444 | + if morphism is None and derivation is None: |
| 445 | + cat = Algebras(base_ring).Commutative() |
| 446 | + else: |
| 447 | + cat = Algebras(base_ring) |
| 448 | + category = cat.or_subcategory(category) |
425 | 449 | Parent.__init__(self, base_ring, names=name, |
426 | 450 | normalize=True, category=category) |
427 | 451 |
|
@@ -506,7 +530,7 @@ def build(check): |
506 | 530 | pass |
507 | 531 | if isinstance(a, str): |
508 | 532 | try: |
509 | | - from sage.misc.parser import Parser, LookupNameMaker |
| 533 | + from sage.misc.parser import LookupNameMaker, Parser |
510 | 534 | R = self.base_ring() |
511 | 535 | p = Parser(Integer, R, LookupNameMaker({self.variable_name(): self.gen()}, R)) |
512 | 536 | return self(p.parse(a)) |
@@ -1095,36 +1119,6 @@ def random_irreducible(self, degree=2, monic=True, *args, **kwds): |
1095 | 1119 | if irred.is_irreducible(): |
1096 | 1120 | return irred |
1097 | 1121 |
|
1098 | | - def is_commutative(self) -> bool: |
1099 | | - r""" |
1100 | | - Return ``True`` if this Ore polynomial ring is commutative. |
1101 | | -
|
1102 | | - This holds if the twisting morphism is the identity and the |
1103 | | - twisting derivation vanishes. |
1104 | | -
|
1105 | | - EXAMPLES:: |
1106 | | -
|
1107 | | - sage: # needs sage.rings.finite_rings |
1108 | | - sage: k.<a> = GF(5^3) |
1109 | | - sage: Frob = k.frobenius_endomorphism() |
1110 | | - sage: S.<x> = k['x', Frob] |
1111 | | - sage: S.is_commutative() |
1112 | | - False |
1113 | | - sage: T.<y> = k['y', Frob^3] |
1114 | | - sage: T.is_commutative() |
1115 | | - True |
1116 | | -
|
1117 | | - sage: R.<t> = GF(5)[] |
1118 | | - sage: der = R.derivation() |
1119 | | - sage: A.<d> = R['d', der] |
1120 | | - sage: A.is_commutative() |
1121 | | - False |
1122 | | - sage: B.<b> = R['b', 5*der] |
1123 | | - sage: B.is_commutative() |
1124 | | - True |
1125 | | - """ |
1126 | | - return self._morphism is None and self._derivation is None |
1127 | | - |
1128 | 1122 | def is_field(self, proof=False) -> bool: |
1129 | 1123 | r""" |
1130 | 1124 | Return always ``False`` since Ore polynomial rings are never fields. |
|
0 commit comments