Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Fixing the doc and != for polynomial injection maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
tscrim committed Jul 6, 2020
1 parent f111d30 commit 5d822f3
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 148 deletions.
4 changes: 2 additions & 2 deletions src/sage/rings/polynomial/ore_polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ AUTHORS:
- Xavier Caruso (2020-05)
"""

#############################################################################
# ***************************************************************************
# Copyright (C) 2020 Xavier Caruso <xavier.caruso@normalesup.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#****************************************************************************
# ***************************************************************************

import re
from cysignals.signals cimport sig_check
Expand Down
53 changes: 31 additions & 22 deletions src/sage/rings/polynomial/ore_polynomial_ring.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
r"""
Univariate Ore Polynomial Rings
This module provides the :class:`~sage.rings.polynomial.ore_polynomial_ring.OrePolynomialRing`.
which constructs a general dense univariate Ore polynomial ring over a commutative base with
equipped with an endomorphism and/or a derivation.
This module provides the
:class:`~sage.rings.polynomial.ore_polynomial_ring.OrePolynomialRing`,
which constructs a general dense univariate Ore polynomial ring over a
commutative base with equipped with an endomorphism and/or a derivation.
AUTHOR:
Expand Down Expand Up @@ -68,14 +69,14 @@ class OrePolynomialRing(UniqueRepresentation, Algebra):
- ``names`` -- a string or a list of strings
- ``sparse`` -- a boolean (default: ``False``). Currently not supported.
- ``sparse`` -- a boolean (default: ``False``); currently not supported
EXAMPLES:
.. RUBRIC:: The case of a twisting endomorphism
We create the Ore ring `\GF{5^3}[x, \text{Frob}]` where Frob is the
Frobenius endomorphism.
Frobenius endomorphism::
sage: k.<a> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
Expand All @@ -96,7 +97,7 @@ class OrePolynomialRing(UniqueRepresentation, Algebra):
We emphasize that it is necessary to repeat the name of the variable
in the right hand side. Indeed, the following fails (it is interpreted
by Sage as a classical polynomial ring with variable name ``Frob``).
by Sage as a classical polynomial ring with variable name ``Frob``)::
sage: T.<x> = k[Frob]
Traceback (most recent call last):
Expand Down Expand Up @@ -147,13 +148,15 @@ class OrePolynomialRing(UniqueRepresentation, Algebra):
sage: F.<u> = Qq(3^2)
sage: sigma = F.frobenius_endomorphism(); sigma
Frobenius endomorphism on 3-adic Unramified Extension Field in u defined by x^2 + 2*x + 2 lifting u |--> u^3 on the residue field
Frobenius endomorphism on 3-adic Unramified Extension Field in u
defined by x^2 + 2*x + 2 lifting u |--> u^3 on the residue field
sage: der = F.derivation(3, twist=sigma); der
(3 + O(3^21))*([Frob] - id)
sage: M.<X> = F['X', der]
sage: M
Ore Polynomial Ring in X over 3-adic Unramified Extension Field in u defined by x^2 + 2*x + 2 twisted by Frob and (3 + O(3^21))*([Frob] - id)
Ore Polynomial Ring in X over 3-adic Unramified Extension Field in u
defined by x^2 + 2*x + 2 twisted by Frob and (3 + O(3^21))*([Frob] - id)
We emphasize that we only need to pass in the twisted derivation as
it already contains in it the datum of the twisting endomorphism.
Expand All @@ -166,6 +169,8 @@ class OrePolynomialRing(UniqueRepresentation, Algebra):
.. RUBRIC:: Examples of variable name context
Consider the following::
sage: R.<t> = ZZ[]
sage: sigma = R.hom([t+1])
sage: S.<x> = SkewPolynomialRing(R, sigma); S
Expand All @@ -187,7 +192,7 @@ class OrePolynomialRing(UniqueRepresentation, Algebra):
.. RUBRIC:: Uniqueness and immutability
In Sage, there is exactly one Ore polynomial ring for each quadruple
(base ring, twisting morphism, twisting derivation, name of the variable).
(base ring, twisting morphism, twisting derivation, name of the variable)::
sage: k.<a> = GF(7^3)
sage: Frob = k.frobenius_endomorphism()
Expand Down Expand Up @@ -642,12 +647,12 @@ def characteristic(self):
"""
return self.base_ring().characteristic()


@cached_method
def twisting_morphism(self, n=1):
r"""
Return the twisting endomorphism defining this Ore polynomial ring iterated ``n`` times
or ``None`` if this Ore polynomial ring is not twisted by an endomorphism.
Return the twisting endomorphism defining this Ore polynomial ring
iterated ``n`` times or ``None`` if this Ore polynomial ring is not
twisted by an endomorphism.
INPUT:
Expand Down Expand Up @@ -676,7 +681,8 @@ def twisting_morphism(self, n=1):
sage: T.twisting_morphism(-1)
Frobenius endomorphism t |--> t^(5^2) on Finite Field in t of size 5^3
Sometimes it fails, even if the twisting morphism is actually invertible::
Sometimes it fails, even if the twisting morphism is
actually invertible::
sage: S.twisting_morphism(-1)
Traceback (most recent call last):
Expand Down Expand Up @@ -720,10 +726,11 @@ def twisting_morphism(self, n=1):

def twist_map(self, n=1):
r"""
Return the twisting endomorphism defining this Ore polynomial ring iterated ``n`` times
or ``None`` if this Ore polynomial ring is not twisted by an endomorphism.
Return the twisting endomorphism defining this Ore polynomial ring
iterated ``n`` times or ``None`` if this Ore polynomial ring is not
twisted by an endomorphism.
This method is deprecated. You should use :meth:`twisting_morphism` instead.
This method is deprecated. Use :meth:`twisting_morphism` instead.
INPUT:
Expand Down Expand Up @@ -770,7 +777,6 @@ def twisting_derivation(self):
"""
return self._derivation


@cached_method
def gen(self, n=0):
r"""
Expand Down Expand Up @@ -867,8 +873,8 @@ def is_exact(self):

def is_sparse(self):
r"""
Return ``True`` if the elements of this Ore polynomial ring are sparsely
represented.
Return ``True`` if the elements of this Ore polynomial ring are
sparsely represented.
.. WARNING::
Expand Down Expand Up @@ -931,15 +937,17 @@ def random_element(self, degree=2, monic=False, *args, **kwds):
sage: S.random_element(monic=True) # random
x^2 + (2*t^2 + t + 1)*x + 3*t^2 + 3*t + 2
Use ``degree`` to obtain polynomials of higher degree
Use ``degree`` to obtain polynomials of higher degree::
sage: p = S.random_element(degree=5) # random
(t^2 + 3*t)*x^4 + (4*t + 4)*x^3 + (4*t^2 + 4*t)*x^2 + (2*t^2 + 1)*x + 3
sage: p.degree() <= 5
True
When ``monic`` is ``False``, the returned Ore polynomial may have
a degree less than ``degree`` (it happens when the random leading
coefficient is zero). However, if ``monic`` is ``True``, this can't
happen::
coefficient is zero). However, if ``monic`` is ``True``, this
cannot happen::
sage: p = S.random_element(degree=4, monic=True)
sage: p.leading_coefficient() == S.base_ring().one()
Expand Down Expand Up @@ -1049,3 +1057,4 @@ def is_commutative(self):
True
"""
return self._morphism is None and self._derivation is None

15 changes: 9 additions & 6 deletions src/sage/rings/polynomial/skew_polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ AUTHORS:
- Johan Rosenkilde (2016-08-03): changes for bug fixes, docstring and
doctest errors
"""

#############################################################################
# ***************************************************************************
# Copyright (C) 2012 Xavier Caruso <xavier.caruso@normalesup.org>
#
# This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -345,7 +344,8 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
sage: a.operator_eval(t)
2*t^2 + 2*t + 3
Evaluation points outside the base ring is usually not possible due to the twisting morphism::
Evaluation points outside the base ring is usually not possible
due to the twisting morphism::
sage: R.<t> = QQ[]
sage: sigma = R.hom([t+1])
Expand All @@ -354,7 +354,9 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
sage: a.operator_eval(1/t)
Traceback (most recent call last):
...
TypeError: 1/t fails to convert into the map's domain Univariate Polynomial Ring in t over Rational Field, but a `pushforward` method is not properly implemented
TypeError: 1/t fails to convert into the map's domain
Univariate Polynomial Ring in t over Rational Field,
but a `pushforward` method is not properly implemented
"""
cdef RingHomomorphism sigma = self._parent.twisting_morphism()
cdef list coefficients = self.list()
Expand Down Expand Up @@ -414,7 +416,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
return r

def multi_point_evaluation(self, eval_pts):
"""
r"""
Evaluate ``self`` at list of evaluation points.
INPUT:
Expand All @@ -431,7 +433,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
repeatedly. If fast skew polynomial multiplication is available, an
asymptotically faster method is possible using standard divide and
conquer techniques and
:meth:`sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing_general.minimal_vanishing_polynomial`.
:meth:`~sage.rings.polynomial.skew_polynomial_ring.SkewPolynomialRing.minimal_vanishing_polynomial`.
EXAMPLES::
Expand Down Expand Up @@ -671,3 +673,4 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
q.append(c)
q.reverse()
return (self._new_c(q, parent), self._new_c(a[:db], parent, 1))

Loading

0 comments on commit 5d822f3

Please sign in to comment.