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

Commit

Permalink
update doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
xcaruso committed Jul 9, 2020
1 parent 1cc0ed8 commit 200d7bd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
22 changes: 7 additions & 15 deletions src/sage/rings/polynomial/ore_polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,6 @@ cdef class OrePolynomial(AlgebraElement):
sage: r == c % b
True
Left euclidean division won't work over our current `S` because Sage can't
invert the twisting morphism::
sage: q,r = c.left_quo_rem(b)
Traceback (most recent call last):
...
NotImplementedError: inversion of the twisting morphism Ring endomorphism of Univariate Polynomial Ring in t over Integer Ring
Defn: t |--> t + 1
Here we can see the effect of the operator evaluation compared to the usual
polynomial evaluation::
Expand All @@ -174,7 +165,7 @@ cdef class OrePolynomial(AlgebraElement):
See http://trac.sagemath.org/13215 for details.
t + 2
Here is a working example over a finite field::
Here is another example over a finite field::
sage: k.<t> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
Expand Down Expand Up @@ -998,16 +989,17 @@ cdef class OrePolynomial(AlgebraElement):
In the following example, Sage does not know the inverse
of the twisting morphism::
sage: R.<t> = ZZ[]
sage: sigma = R.hom([t+1])
sage: S.<x> = R['x',sigma]
sage: R.<t> = QQ[]
sage: K = R.fraction_field()
sage: sigma = K.hom([(t+1)/(t-1)])
sage: S.<x> = K['x',sigma]
sage: a = (-2*t^2 - t + 1)*x^3 + (-t^2 + t)*x^2 + (-12*t - 2)*x - t^2 - 95*t + 1
sage: b = x^2 + (5*t - 6)*x - 4*t^2 + 4*t - 1
sage: a.left_quo_rem(b)
Traceback (most recent call last):
...
NotImplementedError: inversion of the twisting morphism Ring endomorphism of Univariate Polynomial Ring in t over Integer Ring
Defn: t |--> t + 1
NotImplementedError: inversion of the twisting morphism Ring endomorphism of Fraction Field of Univariate Polynomial Ring in t over Rational Field
Defn: t |--> (t + 1)/(t - 1)
"""
if not other:
raise ZeroDivisionError("division by zero is not valid")
Expand Down
12 changes: 7 additions & 5 deletions src/sage/rings/polynomial/ore_polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,19 +670,21 @@ def twisting_morphism(self, n=1):
If ``n`` in negative, Sage tries to compute the inverse of the
twisting morphism::
sage: k.<t> = GF(5^3)
sage: k.<a> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
sage: T.<y> = k['y',Frob]
sage: T.twisting_morphism(-1)
Frobenius endomorphism t |--> t^(5^2) on Finite Field in t of size 5^3
Frobenius endomorphism a |--> a^(5^2) on Finite Field in a of size 5^3
Sometimes it fails, even if the twisting morphism is actually invertible::
sage: S.twisting_morphism(-1)
sage: K = R.fraction_field()
sage: phi = K.hom([(t+1)/(t-1)])
sage: T.<y> = K['y', phi]
sage: T.twisting_morphism(-1)
Traceback (most recent call last):
...
NotImplementedError: inversion of the twisting morphism Ring endomorphism of Univariate Polynomial Ring in t over Rational Field
Defn: t |--> t + 1
NotImplementedError: inverse not implemented for morphisms of Fraction Field of Univariate Polynomial Ring in t over Rational Field
When the Ore polynomial ring is only twisted by a derivation, this
method returns nothing::
Expand Down
10 changes: 5 additions & 5 deletions src/sage/rings/polynomial/skew_polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,12 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
EXAMPLES::
sage: R.<t> = QQ[]
sage: sigma = R.hom([t+1])
sage: S.<x> = R['x',sigma]
sage: K = R.fraction_field()
sage: sigma = K.hom([1 + 1/t])
sage: S.<x> = K['x',sigma]
sage: a = t*x^3 + (t^2 + 1)*x^2 + 2*t
sage: b = a.conjugate(2); b
(t + 2)*x^3 + (t^2 + 4*t + 5)*x^2 + 2*t + 4
((2*t + 1)/(t + 1))*x^3 + ((5*t^2 + 6*t + 2)/(t^2 + 2*t + 1))*x^2 + (4*t + 2)/(t + 1)
sage: x^2*a == b*x^2
True
Expand All @@ -394,8 +395,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense):
sage: b = a.conjugate(-1)
Traceback (most recent call last):
...
NotImplementedError: inversion of the twisting morphism Ring endomorphism of Univariate Polynomial Ring in t over Rational Field
Defn: t |--> t + 1
NotImplementedError: inverse not implemented for morphisms of Fraction Field of Univariate Polynomial Ring in t over Rational Field
Here is a working example::
Expand Down

0 comments on commit 200d7bd

Please sign in to comment.