diff --git a/src/sage/modular/abvar/homspace.py b/src/sage/modular/abvar/homspace.py
index 6d96cc0fabe..8e89399d611 100644
--- a/src/sage/modular/abvar/homspace.py
+++ b/src/sage/modular/abvar/homspace.py
@@ -148,14 +148,15 @@
::
- sage: T = E.image_of_hecke_algebra() # long time
- sage: T.gens() # long time
+ sage: # long time
+ sage: T = E.image_of_hecke_algebra()
+ sage: T.gens()
(Abelian variety endomorphism of Abelian variety J0(33) of dimension 3,
Abelian variety endomorphism of Abelian variety J0(33) of dimension 3,
Abelian variety endomorphism of Abelian variety J0(33) of dimension 3)
- sage: T.index_in(E) # long time
+ sage: T.index_in(E)
+Infinity
- sage: T.index_in_saturation() # long time
+ sage: T.index_in_saturation()
1
AUTHORS:
diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py
index 7e8ffa6658c..8d8b580a74e 100644
--- a/src/sage/modular/cusps_nf.py
+++ b/src/sage/modular/cusps_nf.py
@@ -1,3 +1,4 @@
+# sage.doctest: needs sage.rings.number_field
r"""
The set `\mathbb{P}^1(K)` of cusps of a number field `K`
@@ -62,7 +63,7 @@
sage: Gamma0_NFCusps(N)
[Cusp [0: 1] of Number Field in a with defining polynomial x^2 + 5,
- Cusp [1: 3] of Number Field in a with defining polynomial x^2 + 5,
+ Cusp [1: 3] of Number Field in a with defining polynomial x^2 + 5,
...]
"""
# ****************************************************************************
@@ -859,7 +860,7 @@ def ABmatrix(self):
sage: M = alpha.ABmatrix()
sage: M # random
[-a^2 - a - 1, -3*a - 7, 8, -2*a^2 - 3*a + 4]
- sage: M[0] == alpha.numerator() and M[2]==alpha.denominator()
+ sage: M[0] == alpha.numerator() and M[2] == alpha.denominator()
True
An AB-matrix associated to a cusp alpha will send Infinity to alpha:
@@ -870,7 +871,7 @@ def ABmatrix(self):
sage: M = alpha.ABmatrix()
sage: (k.ideal(M[1], M[3])*alpha.ideal()).is_principal()
True
- sage: M[0] == alpha.numerator() and M[2]==alpha.denominator()
+ sage: M[0] == alpha.numerator() and M[2] == alpha.denominator()
True
sage: NFCusp(k, oo).apply(M) == alpha
True
@@ -1249,7 +1250,8 @@ def units_mod_ideal(I):
sage: from sage.modular.cusps_nf import units_mod_ideal
sage: k. = NumberField(x^3 + 11)
sage: k.unit_group()
- Unit group with structure C2 x Z of Number Field in a with defining polynomial x^3 + 11
+ Unit group with structure C2 x Z of
+ Number Field in a with defining polynomial x^3 + 11
sage: I = k.ideal(5, a + 1)
sage: units_mod_ideal(I)
[1,
@@ -1261,7 +1263,8 @@ def units_mod_ideal(I):
sage: from sage.modular.cusps_nf import units_mod_ideal
sage: k. = NumberField(x^4 - x^3 -21*x^2 + 17*x + 133)
sage: k.unit_group()
- Unit group with structure C6 x Z of Number Field in a with defining polynomial x^4 - x^3 - 21*x^2 + 17*x + 133
+ Unit group with structure C6 x Z of
+ Number Field in a with defining polynomial x^4 - x^3 - 21*x^2 + 17*x + 133
sage: I = k.ideal(3)
sage: U = units_mod_ideal(I)
sage: all(U[j].is_unit() and (U[j] not in I) for j in range(len(U)))
diff --git a/src/sage/modular/modform/element.py b/src/sage/modular/modform/element.py
index fba61a0fdd8..6d10fdf47c3 100644
--- a/src/sage/modular/modform/element.py
+++ b/src/sage/modular/modform/element.py
@@ -2315,13 +2315,14 @@ def minimal_twist(self, p=None):
sage: f.twist(chi, level=11) == g
True
- sage: f = Newforms(575, 2, names='a')[4] # long time
- sage: g, chi = f.minimal_twist(5) # long time
- sage: g # long time
+ sage: # long time
+ sage: f = Newforms(575, 2, names='a')[4]
+ sage: g, chi = f.minimal_twist(5)
+ sage: g
q + a*q^2 - a*q^3 - 2*q^4 + (1/2*a + 2)*q^5 + O(q^6)
- sage: chi # long time
+ sage: chi
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> 1/2*a
- sage: f.twist(chi, level=g.level()) == g # long time
+ sage: f.twist(chi, level=g.level()) == g
True
"""
if p is None:
diff --git a/src/sage/modular/modform_hecketriangle/analytic_type.py b/src/sage/modular/modform_hecketriangle/analytic_type.py
index 7b2618991df..0c809b3328c 100644
--- a/src/sage/modular/modform_hecketriangle/analytic_type.py
+++ b/src/sage/modular/modform_hecketriangle/analytic_type.py
@@ -1,3 +1,4 @@
+# sage.doctest: needs sage.graphs
r"""
Analytic types of modular forms
diff --git a/src/sage/modular/overconvergent/weightspace.py b/src/sage/modular/overconvergent/weightspace.py
index 8f0ecc8b8c0..e9478c40a90 100644
--- a/src/sage/modular/overconvergent/weightspace.py
+++ b/src/sage/modular/overconvergent/weightspace.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# sage.doctest: needs sage.rings.padics
r"""
The space of `p`-adic weights
@@ -17,7 +17,8 @@
sage: W = pAdicWeightSpace(17)
sage: W
- Space of 17-adic weight-characters defined over 17-adic Field with capped relative precision 20
+ Space of 17-adic weight-characters
+ defined over 17-adic Field with capped relative precision 20
sage: R. = QQ[]
sage: L = Qp(17).extension(x^2 - 17, names='a'); L.rename('L')
sage: W.base_extend(L)
@@ -101,7 +102,8 @@ def WeightSpace_constructor(p, base_ring=None):
EXAMPLES::
sage: pAdicWeightSpace(3) # indirect doctest
- Space of 3-adic weight-characters defined over 3-adic Field with capped relative precision 20
+ Space of 3-adic weight-characters
+ defined over 3-adic Field with capped relative precision 20
sage: pAdicWeightSpace(3, QQ)
Space of 3-adic weight-characters defined over Rational Field
sage: pAdicWeightSpace(10)
@@ -248,11 +250,13 @@ def base_extend(self, R):
sage: W = pAdicWeightSpace(3, QQ)
sage: W.base_extend(Qp(3))
- Space of 3-adic weight-characters defined over 3-adic Field with capped relative precision 20
+ Space of 3-adic weight-characters
+ defined over 3-adic Field with capped relative precision 20
sage: W.base_extend(IntegerModRing(12))
Traceback (most recent call last):
...
- TypeError: No coercion map from 'Rational Field' to 'Ring of integers modulo 12' is defined
+ TypeError: No coercion map from 'Rational Field'
+ to 'Ring of integers modulo 12' is defined
"""
if R.has_coerce_map_from(self.base_ring()):
return WeightSpace_constructor(self.prime(), R)
@@ -356,7 +360,9 @@ def pAdicEisensteinSeries(self, ring, prec=20):
sage: kappa = pAdicWeightSpace(3)(3, DirichletGroup(3,QQ).0)
sage: kappa.pAdicEisensteinSeries(QQ[['q']], 20)
- 1 - 9*q + 27*q^2 - 9*q^3 - 117*q^4 + 216*q^5 + 27*q^6 - 450*q^7 + 459*q^8 - 9*q^9 - 648*q^10 + 1080*q^11 - 117*q^12 - 1530*q^13 + 1350*q^14 + 216*q^15 - 1845*q^16 + 2592*q^17 + 27*q^18 - 3258*q^19 + O(q^20)
+ 1 - 9*q + 27*q^2 - 9*q^3 - 117*q^4 + 216*q^5 + 27*q^6 - 450*q^7 + 459*q^8
+ - 9*q^9 - 648*q^10 + 1080*q^11 - 117*q^12 - 1530*q^13 + 1350*q^14 + 216*q^15
+ - 1845*q^16 + 2592*q^17 + 27*q^18 - 3258*q^19 + O(q^20)
"""
if not self.is_even():
raise ValueError("Eisenstein series not defined for odd weight-characters")
@@ -570,7 +576,8 @@ def chi(self):
sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14)
sage: kappa.chi()
- Dirichlet character modulo 29 of conductor 29 mapping 2 |--> 28 + 28*29 + 28*29^2 + ... + O(29^20)
+ Dirichlet character modulo 29 of conductor 29
+ mapping 2 |--> 28 + 28*29 + 28*29^2 + ... + O(29^20)
"""
return self._chi
@@ -667,7 +674,8 @@ def Lvalue(self):
sage: pAdicWeightSpace(7)(5, DirichletGroup(7, Qp(7)).0^4).Lvalue()
0
sage: pAdicWeightSpace(7)(6, DirichletGroup(7, Qp(7)).0^4).Lvalue()
- 1 + 2*7 + 7^2 + 3*7^3 + 3*7^5 + 4*7^6 + 2*7^7 + 5*7^8 + 2*7^9 + 3*7^10 + 6*7^11 + 2*7^12 + 3*7^13 + 5*7^14 + 6*7^15 + 5*7^16 + 3*7^17 + 6*7^18 + O(7^19)
+ 1 + 2*7 + 7^2 + 3*7^3 + 3*7^5 + 4*7^6 + 2*7^7 + 5*7^8 + 2*7^9 + 3*7^10 + 6*7^11
+ + 2*7^12 + 3*7^13 + 5*7^14 + 6*7^15 + 5*7^16 + 3*7^17 + 6*7^18 + O(7^19)
"""
if self._k > 0:
return -self._chi.bernoulli(self._k) / self._k
diff --git a/src/sage/modular/pollack_stevens/padic_lseries.py b/src/sage/modular/pollack_stevens/padic_lseries.py
index 396a96af90e..748b5dc9993 100644
--- a/src/sage/modular/pollack_stevens/padic_lseries.py
+++ b/src/sage/modular/pollack_stevens/padic_lseries.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# sage.doctest: needs sage.ring.padics
r"""
`p`-adic `L`-series attached to overconvergent eigensymbols
diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py
index 8c70602ad79..52ea3f83c85 100644
--- a/src/sage/schemes/affine/affine_homset.py
+++ b/src/sage/schemes/affine/affine_homset.py
@@ -211,8 +211,8 @@ def points(self, **kwds):
EXAMPLES: The bug reported at #11526 is fixed::
sage: A2 = AffineSpace(ZZ, 2)
- sage: F = GF(3) # optional - sage.rings.finite_rings
- sage: A2(F).points() # optional - sage.rings.finite_rings
+ sage: F = GF(3)
+ sage: A2(F).points()
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]
::
@@ -228,23 +228,23 @@ def points(self, **kwds):
::
sage: u = QQ['u'].0
- sage: K. = NumberField(u^2 + 3) # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: len(A(K).points(bound=2)) # optional - sage.rings.number_field
+ sage: K. = NumberField(u^2 + 3) # needs sage.rings.number_field
+ sage: A. = AffineSpace(K, 2) # needs sage.rings.number_field
+ sage: len(A(K).points(bound=2)) # needs sage.rings.number_field
1849
::
sage: A. = AffineSpace(QQ, 2)
sage: E = A.subscheme([x^2 + y^2 - 1, y^2 - x^3 + x^2 + x - 1])
- sage: E(A.base_ring()).points()
+ sage: E(A.base_ring()).points() # needs sage.libs.singular
[(-1, 0), (0, -1), (0, 1), (1, 0)]
::
- sage: A. = AffineSpace(CC, 2)
+ sage: A. = AffineSpace(CC, 2) # needs sage.rings.real_mpfr
sage: E = A.subscheme([y^3 - x^3 - x^2, x*y])
- sage: E(A.base_ring()).points()
+ sage: E(A.base_ring()).points() # needs sage.libs.singular sage.rings.real_mpfr
verbose 0 (...: affine_homset.py, points)
Warning: computations in the numerical fields are inexact;points
may be computed partially or incorrectly.
@@ -253,9 +253,9 @@ def points(self, **kwds):
::
- sage: A. = AffineSpace(CDF, 2)
- sage: E = A.subscheme([x1^2 + x2^2 + x1*x2, x1 + x2])
- sage: E(A.base_ring()).points()
+ sage: A. = AffineSpace(CDF, 2) # needs sage.rings.complex_double
+ sage: E = A.subscheme([x1^2 + x2^2 + x1*x2, x1 + x2]) # needs sage.libs.singular sage.rings.complex_double
+ sage: E(A.base_ring()).points() # needs sage.libs.singular sage.rings.complex_double
verbose 0 (...: affine_homset.py, points)
Warning: computations in the numerical fields are inexact;points
may be computed partially or incorrectly.
@@ -393,28 +393,29 @@ def numerical_points(self, F=None, **kwds):
EXAMPLES::
- sage: K. = QuadraticField(3) # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: X = A.subscheme([x^3 - v^2*y, y - v*x^2 + 3]) # optional - sage.rings.number_field
- sage: L = X(K).numerical_points(F=RR); L # abs tol 1e-14 # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: K. = QuadraticField(3)
+ sage: A. = AffineSpace(K, 2)
+ sage: X = A.subscheme([x^3 - v^2*y, y - v*x^2 + 3])
+ sage: L = X(K).numerical_points(F=RR); L # abs tol 1e-14
[(-1.18738247880014, -0.558021142104134),
(1.57693558184861, 1.30713548084184),
(4.80659931965815, 37.0162574656220)]
- sage: L[0].codomain() # optional - sage.rings.number_field
+ sage: L[0].codomain()
Affine Space of dimension 2 over Real Field with 53 bits of precision
::
sage: A. = AffineSpace(QQ, 2)
sage: X = A.subscheme([y^2 - x^2 - 3*x, x^2 - 10*y])
- sage: len(X(QQ).numerical_points(F=ComplexField(100)))
+ sage: len(X(QQ).numerical_points(F=ComplexField(100))) # needs sage.libs.singular
4
::
sage: A. = AffineSpace(QQ, 2)
sage: E = A.subscheme([30*x1^100 + 1000*x2^2 + 2000*x1*x2 + 1, x1 + x2])
- sage: len(E(A.base_ring()).numerical_points(F=CDF, zero_tolerance=1e-9))
+ sage: len(E(A.base_ring()).numerical_points(F=CDF, zero_tolerance=1e-9)) # needs sage.libs.singular
100
TESTS::
@@ -430,7 +431,7 @@ def numerical_points(self, F=None, **kwds):
sage: A. = AffineSpace(QQ, 2)
sage: X = A.subscheme([y^2 - x^2 - 3*x, x^2 - 10*y])
- sage: X(QQ).numerical_points(F=CC, zero_tolerance=-1)
+ sage: X(QQ).numerical_points(F=CC, zero_tolerance=-1) # needs sage.libs.singular
Traceback (most recent call last):
...
ValueError: tolerance must be positive
diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py
index d16d5ec37fc..1fc3f207464 100644
--- a/src/sage/schemes/affine/affine_morphism.py
+++ b/src/sage/schemes/affine/affine_morphism.py
@@ -156,8 +156,8 @@ def __init__(self, parent, polys, check=True):
sage: A. = AffineSpace(QQ, 3)
sage: X = A.subscheme([x - y])
sage: H = Hom(X, X)
- sage: u,v,w = X.coordinate_ring().gens()
- sage: H([u, v, u + v])
+ sage: u,v,w = X.coordinate_ring().gens() # needs sage.libs.singular
+ sage: H([u, v, u + v]) # needs sage.libs.singular
Scheme endomorphism of Closed subscheme of Affine Space of dimension 3
over Rational Field defined by: x - y
Defn: Defined on coordinates by sending (x, y, z) to (y, y, 2*y)
@@ -167,8 +167,8 @@ def __init__(self, parent, polys, check=True):
sage: A. = AffineSpace(QQ, 3)
sage: X = A.subscheme([x^2 - y^2])
sage: H = Hom(X, X)
- sage: u,v,w = X.coordinate_ring().gens()
- sage: H([u, v, (u+1)/v])
+ sage: u,v,w = X.coordinate_ring().gens() # needs sage.libs.singular
+ sage: H([u, v, (u+1)/v]) # needs sage.libs.singular
Traceback (most recent call last):
...
ArithmeticError: Division failed. The numerator is not a multiple of the denominator.
@@ -249,13 +249,14 @@ def __call__(self, x, check=True):
Defn: Defined on coordinates by sending (u, v) to
(u + v, u*v)
- sage: F. = GF(4) # optional - sage.rings.finite_rings
- sage: P = T(F)(1, a) # optional - sage.rings.finite_rings
- sage: h(P) # optional - sage.rings.finite_rings
+ sage: # needs sage.rings.finite_rings
+ sage: F. = GF(4)
+ sage: P = T(F)(1, a)
+ sage: h(P)
(a + 1, a)
- sage: h(P).domain() # optional - sage.rings.finite_rings
+ sage: h(P).domain()
Spectrum of Finite Field in a of size 2^2
- sage: h.change_ring(F)(P) # optional - sage.rings.finite_rings
+ sage: h.change_ring(F)(P)
(a + 1, a)
"""
from sage.schemes.affine.affine_point import SchemeMorphism_point_affine
@@ -298,6 +299,7 @@ def __eq__(self, right):
::
+ sage: # needs sage.rings.real_mpfr
sage: A. = AffineSpace(CC, 3)
sage: H = End(A)
sage: f = H([x^2 - CC.0*x*y + z*x, 1/z^2 - y^2, 5*x])
@@ -324,6 +326,7 @@ def __ne__(self, right):
EXAMPLES::
+ sage: # needs sage.rings.real_mpfr
sage: A. = AffineSpace(RR, 2)
sage: H = End(A)
sage: f = H([x^2 - y, y^2])
@@ -458,6 +461,7 @@ def homogenize(self, n):
::
+ sage: # needs sage.rings.real_mpfr
sage: A. = AffineSpace(CC, 2)
sage: H = Hom(A, A)
sage: f = H([(x^2-2)/(x*y), y^2 - x])
@@ -473,7 +477,7 @@ def homogenize(self, n):
sage: X = A.subscheme([x - y^2])
sage: H = Hom(X, X)
sage: f = H([9*y^2, 3*y])
- sage: f.homogenize(2)
+ sage: f.homogenize(2) # needs sage.libs.singular
Scheme endomorphism of Closed subscheme of Projective Space
of dimension 2 over Integer Ring defined by: x1^2 - x0*x2
Defn: Defined on coordinates by sending (x0 : x1 : x2) to
@@ -503,11 +507,12 @@ def homogenize(self, n):
::
- sage: R. = PolynomialRing(QQbar) # optional - sage.rings.number_field
- sage: A. = AffineSpace(R, 2) # optional - sage.rings.number_field
- sage: H = End(A) # optional - sage.rings.number_field
- sage: f = H([QQbar(sqrt(2))*x*y, a*x^2]) # optional - sage.rings.number_field sage.symbolic
- sage: f.homogenize(2) # optional - sage.rings.number_field sage.symbolic
+ sage: # needs sage.rings.number_field
+ sage: R. = PolynomialRing(QQbar)
+ sage: A. = AffineSpace(R, 2)
+ sage: H = End(A)
+ sage: f = H([QQbar(sqrt(2))*x*y, a*x^2]) # needs sage.symbolic
+ sage: f.homogenize(2) # needs sage.libs.singular sage.symbolic
Scheme endomorphism of Projective Space of dimension 2
over Univariate Polynomial Ring in a over Algebraic Field
Defn: Defined on coordinates by sending (x0 : x1 : x2) to
@@ -534,10 +539,11 @@ def homogenize(self, n):
::
- sage: A. = AffineSpace(QQbar, 1) # optional - sage.rings.number_field
- sage: H = End(A) # optional - sage.rings.number_field
- sage: f = H([2*z / (z^2 + 2*z + 3)]) # optional - sage.rings.number_field
- sage: f.homogenize(1) # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: A. = AffineSpace(QQbar, 1)
+ sage: H = End(A)
+ sage: f = H([2*z / (z^2 + 2*z + 3)])
+ sage: f.homogenize(1)
Scheme endomorphism of Projective Space of dimension 1
over Algebraic Field
Defn: Defined on coordinates by sending (x0 : x1) to
@@ -545,11 +551,12 @@ def homogenize(self, n):
::
- sage: R. = QQbar[] # optional - sage.rings.number_field
- sage: A. = AffineSpace(R, 1) # optional - sage.rings.number_field
- sage: H = Hom(A, A) # optional - sage.rings.number_field
- sage: F = H([d*x^2 + c]) # optional - sage.rings.number_field
- sage: F.homogenize(1) # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: R. = QQbar[]
+ sage: A. = AffineSpace(R, 1)
+ sage: H = Hom(A, A)
+ sage: F = H([d*x^2 + c])
+ sage: F.homogenize(1)
Scheme endomorphism of Projective Space of dimension 1
over Multivariate Polynomial Ring in c, d over Algebraic Field
Defn: Defined on coordinates by sending (x0 : x1) to
@@ -640,7 +647,7 @@ def as_dynamical_system(self):
sage: A. = AffineSpace(ZZ, 3)
sage: H = End(A)
sage: f = H([x^2, y^2, z^2])
- sage: type(f.as_dynamical_system())
+ sage: type(f.as_dynamical_system()) # needs sage.schemes
::
@@ -648,23 +655,23 @@ def as_dynamical_system(self):
sage: A. = AffineSpace(ZZ, 2)
sage: H = End(A)
sage: f = H([x^2 - y^2, y^2])
- sage: type(f.as_dynamical_system())
+ sage: type(f.as_dynamical_system()) # needs sage.schemes
::
- sage: A. = AffineSpace(GF(5), 1) # optional - sage.rings.finite_rings
- sage: H = End(A) # optional - sage.rings.finite_rings
- sage: f = H([x^2]) # optional - sage.rings.finite_rings
- sage: type(f.as_dynamical_system()) # optional - sage.rings.finite_rings
+ sage: A. = AffineSpace(GF(5), 1)
+ sage: H = End(A)
+ sage: f = H([x^2])
+ sage: type(f.as_dynamical_system()) # needs sage.schemes
::
sage: P. = AffineSpace(RR, 2)
- sage: f = DynamicalSystem([x^2 + y^2, y^2], P)
- sage: g = f.as_dynamical_system()
- sage: g is f
+ sage: f = DynamicalSystem([x^2 + y^2, y^2], P) # needs sage.schemes
+ sage: g = f.as_dynamical_system() # needs sage.schemes
+ sage: g is f # needs sage.schemes
True
"""
from sage.dynamics.arithmetic_dynamics.generic_ds import DynamicalSystem
@@ -699,17 +706,18 @@ def global_height(self, prec=None):
sage: A. = AffineSpace(QQ, 1)
sage: H = Hom(A, A)
sage: f = H([1/1331*x^2 + 4000])
- sage: f.global_height()
+ sage: f.global_height() # needs sage.symbolic
15.4877354584971
::
+ sage: # needs sage.rings.number_field
sage: R. = PolynomialRing(QQ)
- sage: k. = NumberField(x^2 + 5) # optional - sage.rings.number_field
- sage: A. = AffineSpace(k, 2) # optional - sage.rings.number_field
- sage: H = Hom(A, A) # optional - sage.rings.number_field
- sage: f = H([13*w*x^2 + 4*y, 1/w*y^2]) # optional - sage.rings.number_field
- sage: f.global_height(prec=2) # optional - sage.rings.number_field
+ sage: k. = NumberField(x^2 + 5)
+ sage: A. = AffineSpace(k, 2)
+ sage: H = Hom(A, A)
+ sage: f = H([13*w*x^2 + 4*y, 1/w*y^2])
+ sage: f.global_height(prec=2)
4.0
::
@@ -717,7 +725,7 @@ def global_height(self, prec=None):
sage: A. = AffineSpace(ZZ, 1)
sage: H = Hom(A, A)
sage: f = H([7*x^2 + 1513])
- sage: f.global_height()
+ sage: f.global_height() # needs sage.symbolic
7.32184971378836
::
@@ -726,7 +734,7 @@ def global_height(self, prec=None):
sage: B. = AffineSpace(QQ, 2)
sage: H = Hom(A, B)
sage: f = H([1/3*x^2 + 10, 7*x^3])
- sage: f.global_height()
+ sage: f.global_height() # needs sage.symbolic
3.40119738166216
::
@@ -735,7 +743,7 @@ def global_height(self, prec=None):
sage: A. = AffineSpace(QQ, 1)
sage: H = Hom(P, A)
sage: f = H([1/1331*x^2 + 4000*y])
- sage: f.global_height()
+ sage: f.global_height() # needs sage.symbolic
15.4877354584971
"""
return self.homogenize(0).global_height(prec=prec)
@@ -761,7 +769,7 @@ def local_height(self, v, prec=None):
sage: P. = AffineSpace(QQ, 2)
sage: H = Hom(P, P)
sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y])
- sage: f.local_height(1331)
+ sage: f.local_height(1331) # needs sage.rings.real_mpfr
7.19368581839511
::
@@ -769,7 +777,7 @@ def local_height(self, v, prec=None):
sage: P. = AffineSpace(QQ, 3)
sage: H = Hom(P, P)
sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2])
- sage: f.local_height(2)
+ sage: f.local_height(2) # needs sage.rings.real_mpfr
2.77258872223978
::
@@ -777,17 +785,18 @@ def local_height(self, v, prec=None):
sage: P. = AffineSpace(QQ, 3)
sage: H = Hom(P, P)
sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2])
- sage: f.local_height(2, prec=2)
+ sage: f.local_height(2, prec=2) # needs sage.rings.real_mpfr
3.0
::
+ sage: # needs sage.rings.number_field
sage: R. = PolynomialRing(QQ)
- sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field
- sage: P. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: H = Hom(P, P) # optional - sage.rings.number_field
- sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field
- sage: f.local_height(K.ideal(3)) # optional - sage.rings.number_field
+ sage: K. = NumberField(z^2 - 2)
+ sage: P. = AffineSpace(K, 2)
+ sage: H = Hom(P, P)
+ sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2])
+ sage: f.local_height(K.ideal(3))
1.09861228866811
"""
K = FractionField(self.domain().base_ring())
@@ -816,7 +825,7 @@ def local_height_arch(self, i, prec=None):
sage: P. = AffineSpace(QQ, 2)
sage: H = Hom(P, P)
sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]);
- sage: f.local_height_arch(0)
+ sage: f.local_height_arch(0) # needs sage.rings.real_mpfr
5.34710753071747
::
@@ -824,17 +833,18 @@ def local_height_arch(self, i, prec=None):
sage: P. = AffineSpace(QQ, 2)
sage: H = Hom(P, P)
sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]);
- sage: f.local_height_arch(0, prec=5)
+ sage: f.local_height_arch(0, prec=5) # needs sage.rings.real_mpfr
5.2
::
+ sage: # needs sage.rings.number_field
sage: R. = PolynomialRing(QQ)
- sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field
- sage: P. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: H = Hom(P, P) # optional - sage.rings.number_field
- sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field
- sage: f.local_height_arch(1) # optional - sage.rings.number_field
+ sage: K. = NumberField(z^2 - 2)
+ sage: P. = AffineSpace(K, 2)
+ sage: H = Hom(P, P)
+ sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2])
+ sage: f.local_height_arch(1)
0.6931471805599453094172321214582
"""
K = FractionField(self.domain().base_ring())
@@ -861,7 +871,7 @@ def jacobian(self):
sage: A. = AffineSpace(QQ, 1)
sage: H = End(A)
sage: f = H([z^2 - 3/4])
- sage: f.jacobian()
+ sage: f.jacobian() # needs sage.modules
[2*z]
::
@@ -869,7 +879,7 @@ def jacobian(self):
sage: A. = AffineSpace(QQ, 2)
sage: H = End(A)
sage: f = H([x^3 - 25*x + 12*y, 5*y^2*x - 53*y + 24])
- sage: f.jacobian()
+ sage: f.jacobian() # needs sage.modules
[ 3*x^2 - 25 12]
[ 5*y^2 10*x*y - 53]
@@ -878,7 +888,7 @@ def jacobian(self):
sage: A. = AffineSpace(ZZ, 2)
sage: H = End(A)
sage: f = H([(x^2 - x*y)/(1+y), (5+y)/(2+x)])
- sage: f.jacobian()
+ sage: f.jacobian() # needs sage.modules
[ (2*x - y)/(y + 1) (-x^2 - x)/(y^2 + 2*y + 1)]
[ (-y - 5)/(x^2 + 4*x + 4) 1/(x + 2)]
"""
@@ -904,7 +914,7 @@ def _matrix_times_polymap_(self, mat, h):
sage: A. = AffineSpace(ZZ, 1)
sage: H = Hom(A, A)
sage: f = H([x^2 + 1])
- sage: matrix([[1,2], [0,1]]) * f
+ sage: matrix([[1,2], [0,1]]) * f # needs sage.modules
Scheme endomorphism of Affine Space of dimension 1 over Integer Ring
Defn: Defined on coordinates by sending (x) to
(x^2 + 3)
@@ -915,7 +925,7 @@ def _matrix_times_polymap_(self, mat, h):
sage: A2 = AffineSpace(ZZ, 2)
sage: H = Hom(A1, A2)
sage: f = H([x^2 + 1, x^2 - 1])
- sage: matrix([[1,2,3], [0,1,2], [0,0,1]]) * f
+ sage: matrix([[1,2,3], [0,1,2], [0,0,1]]) * f # needs sage.modules
Scheme morphism:
From: Affine Space of dimension 1 over Integer Ring
To: Affine Space of dimension 2 over Integer Ring
@@ -948,7 +958,7 @@ def _polymap_times_matrix_(self, mat, h):
sage: A. = AffineSpace(ZZ, 1)
sage: H = Hom(A, A)
sage: f = H([x^2 + 1])
- sage: f * matrix([[1,2], [0,1]])
+ sage: f * matrix([[1,2], [0,1]]) # needs sage.modules
Scheme endomorphism of Affine Space of dimension 1 over Integer Ring
Defn: Defined on coordinates by sending (x) to
(x^2 + 4*x + 5)
@@ -959,7 +969,7 @@ def _polymap_times_matrix_(self, mat, h):
sage: A2 = AffineSpace(ZZ, 2)
sage: H = Hom(A1, A2)
sage: f = H([x^2 + 1, x^2 - 1])
- sage: f * matrix([[1,2], [0,1]])
+ sage: f * matrix([[1,2], [0,1]]) # needs sage.modules
Scheme morphism:
From: Affine Space of dimension 1 over Integer Ring
To: Affine Space of dimension 2 over Integer Ring
@@ -972,8 +982,8 @@ def _polymap_times_matrix_(self, mat, h):
sage: P2. = AffineSpace(QQ, 3)
sage: H = Hom(P2, P)
sage: f = H([u^2 + v^2, w^2])
- sage: m = matrix([[1,1,1], [1,0,1], [0,0,1]])
- sage: m*f
+ sage: m = matrix([[1,1,1], [1,0,1], [0,0,1]]) # needs sage.modules
+ sage: m*f # needs sage.modules
Scheme morphism:
From: Affine Space of dimension 3 over Rational Field
To: Affine Space of dimension 2 over Rational Field
@@ -1053,25 +1063,27 @@ def weil_restriction(self):
EXAMPLES::
- sage: K. = QuadraticField(5) # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: H = End(A) # optional - sage.rings.number_field
- sage: f = H([x^2 - y^2, y^2]) # optional - sage.rings.number_field
- sage: f.weil_restriction() # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: K. = QuadraticField(5)
+ sage: A. = AffineSpace(K, 2)
+ sage: H = End(A)
+ sage: f = H([x^2 - y^2, y^2])
+ sage: f.weil_restriction()
Scheme endomorphism of Affine Space of dimension 4 over Rational Field
Defn: Defined on coordinates by sending (z0, z1, z2, z3) to
(z0^2 + 5*z1^2 - z2^2 - 5*z3^2, 2*z0*z1 - 2*z2*z3, z2^2 + 5*z3^2, 2*z2*z3)
::
- sage: K. = QuadraticField(5) # optional - sage.rings.number_field
- sage: PS. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: H = Hom(PS, PS) # optional - sage.rings.number_field
- sage: f = H([x, y]) # optional - sage.rings.number_field
- sage: F = f.weil_restriction() # optional - sage.rings.number_field
- sage: P = PS(2, 1) # optional - sage.rings.number_field
- sage: Q = P.weil_restriction() # optional - sage.rings.number_field
- sage: f(P).weil_restriction() == F(Q) # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: K. = QuadraticField(5)
+ sage: PS. = AffineSpace(K, 2)
+ sage: H = Hom(PS, PS)
+ sage: f = H([x, y])
+ sage: F = f.weil_restriction()
+ sage: P = PS(2, 1)
+ sage: Q = P.weil_restriction()
+ sage: f(P).weil_restriction() == F(Q)
True
"""
if any(isinstance(f, FractionFieldElement) for f in self):
@@ -1099,25 +1111,26 @@ def reduce_base_field(self):
EXAMPLES::
- sage: K. = GF(5^4) # optional - sage.rings.finite_rings
- sage: A. = AffineSpace(K, 1) # optional - sage.rings.finite_rings
- sage: A2. = AffineSpace(K, 2) # optional - sage.rings.finite_rings
- sage: H = End(A) # optional - sage.rings.finite_rings
- sage: H2 = Hom(A, A2) # optional - sage.rings.finite_rings
- sage: H3 = Hom(A2, A) # optional - sage.rings.finite_rings
- sage: f = H([x^2 + 2*(t^3 + t^2 + t + 3)]) # optional - sage.rings.finite_rings
- sage: f.reduce_base_field() # optional - sage.rings.finite_rings
+ sage: # needs sage.rings.finite_rings
+ sage: K. = GF(5^4)
+ sage: A. = AffineSpace(K, 1)
+ sage: A2. = AffineSpace(K, 2)
+ sage: H = End(A)
+ sage: H2 = Hom(A, A2)
+ sage: H3 = Hom(A2, A)
+ sage: f = H([x^2 + 2*(t^3 + t^2 + t + 3)])
+ sage: f.reduce_base_field()
Scheme endomorphism of Affine Space of dimension 1
over Finite Field in t2 of size 5^2
Defn: Defined on coordinates by sending (x) to (x^2 + (2*t2))
- sage: f2 = H2([x^2 + 4, 2*x]) # optional - sage.rings.finite_rings
- sage: f2.reduce_base_field() # optional - sage.rings.finite_rings
+ sage: f2 = H2([x^2 + 4, 2*x])
+ sage: f2.reduce_base_field()
Scheme morphism:
From: Affine Space of dimension 1 over Finite Field of size 5
To: Affine Space of dimension 2 over Finite Field of size 5
Defn: Defined on coordinates by sending (x) to (x^2 - 1, 2*x)
- sage: f3 = H3([a^2 + t*b]) # optional - sage.rings.finite_rings
- sage: f3.reduce_base_field() # optional - sage.rings.finite_rings
+ sage: f3 = H3([a^2 + t*b])
+ sage: f3.reduce_base_field()
Scheme morphism:
From: Affine Space of dimension 2 over Finite Field in t of size 5^4
To: Affine Space of dimension 1 over Finite Field in t of size 5^4
@@ -1125,23 +1138,25 @@ def reduce_base_field(self):
::
- sage: K. = CyclotomicField(4) # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 1) # optional - sage.rings.number_field
- sage: H = End(A) # optional - sage.rings.number_field
- sage: f = H([x^2 + v]) # optional - sage.rings.number_field
- sage: g = f.reduce_base_field(); g # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: K. = CyclotomicField(4)
+ sage: A. = AffineSpace(K, 1)
+ sage: H = End(A)
+ sage: f = H([x^2 + v])
+ sage: g = f.reduce_base_field(); g
Scheme endomorphism of Affine Space of dimension 1
over Cyclotomic Field of order 4 and degree 2
Defn: Defined on coordinates by sending (x) to (x^2 + v)
- sage: g.base_ring() is K # optional - sage.rings.number_field
+ sage: g.base_ring() is K
True
::
- sage: A. = AffineSpace(QQbar, 1) # optional - sage.rings.number_field
- sage: H = End(A) # optional - sage.rings.number_field
- sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)]) # optional - sage.rings.number_field
- sage: f.reduce_base_field() # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: A. = AffineSpace(QQbar, 1)
+ sage: H = End(A)
+ sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)]) # needs sage.symbolic
+ sage: f.reduce_base_field() # needs sage.symbolic
Scheme endomorphism of Affine Space of dimension 1 over Number Field in a
with defining polynomial y^4 - 4*y^2 + 1 with a = ...?
Defn: Defined on coordinates by sending (x) to
@@ -1149,11 +1164,12 @@ def reduce_base_field(self):
::
+ sage: # needs sage.rings.number_field
sage: R. = PolynomialRing(QQ)
- sage: A. = AffineSpace(QQbar, 1) # optional - sage.rings.number_field
- sage: H = End(A) # optional - sage.rings.number_field
- sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) # optional - sage.rings.number_field
- sage: f.reduce_base_field() # optional - sage.rings.number_field
+ sage: A. = AffineSpace(QQbar, 1)
+ sage: H = End(A)
+ sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) # needs sage.symbolic
+ sage: f.reduce_base_field() # needs sage.symbolic
Scheme endomorphism of Affine Space of dimension 1 over Number
Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17
with a = 1.442249570307409? + 1.414213562373095?*I
@@ -1164,14 +1180,15 @@ def reduce_base_field(self):
::
+ sage: # needs sage.rings.number_field
sage: R. = PolynomialRing(QQ)
- sage: K. = NumberField(x^3 - x + 1, # optional - sage.rings.number_field
- ....: embedding=(x^3+x+1).roots(ring=CC)[0][0])
- sage: A. = AffineSpace(K, 1) # optional - sage.rings.number_field
- sage: A2. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: H = Hom(A, A2) # optional - sage.rings.number_field
- sage: f = H([x^2 + a*x + 3, 5*x]) # optional - sage.rings.number_field
- sage: f.reduce_base_field() # optional - sage.rings.number_field
+ sage: K. = NumberField(x^3 - x + 1,
+ ....: embedding=(x^3 + x + 1).roots(ring=CC)[0][0])
+ sage: A. = AffineSpace(K, 1)
+ sage: A2. = AffineSpace(K, 2)
+ sage: H = Hom(A, A2)
+ sage: f = H([x^2 + a*x + 3, 5*x])
+ sage: f.reduce_base_field()
Scheme morphism:
From: Affine Space of dimension 1 over Number Field in a with
defining polynomial x^3 - x + 1 with a = -1.324717957244746?
@@ -1181,21 +1198,23 @@ def reduce_base_field(self):
::
- sage: K. = QuadraticField(2) # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 1) # optional - sage.rings.number_field
- sage: H = End(A) # optional - sage.rings.number_field
- sage: f = H([3*x^2 + x + 1]) # optional - sage.rings.number_field
- sage: f.reduce_base_field() # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: K. = QuadraticField(2)
+ sage: A. = AffineSpace(K, 1)
+ sage: H = End(A)
+ sage: f = H([3*x^2 + x + 1])
+ sage: f.reduce_base_field()
Scheme endomorphism of Affine Space of dimension 1 over Rational Field
Defn: Defined on coordinates by sending (x) to (3*x^2 + x + 1)
::
- sage: K. = GF(5^6) # optional - sage.rings.finite_rings
- sage: A. = AffineSpace(K, 1) # optional - sage.rings.finite_rings
- sage: H = End(A) # optional - sage.rings.finite_rings
- sage: f = H([x^2 + x*(t^3 + 2*t^2 + 4*t) + (t^5 + 3*t^4 + t^2 + 4*t)]) # optional - sage.rings.finite_rings
- sage: f.reduce_base_field() # optional - sage.rings.finite_rings
+ sage: # needs sage.rings.finite_rings
+ sage: K. = GF(5^6)
+ sage: A. = AffineSpace(K, 1)
+ sage: H = End(A)
+ sage: f = H([x^2 + x*(t^3 + 2*t^2 + 4*t) + (t^5 + 3*t^4 + t^2 + 4*t)])
+ sage: f.reduce_base_field()
Scheme endomorphism of Affine Space of dimension 1
over Finite Field in t of size 5^6
Defn: Defined on coordinates by sending (x) to
@@ -1229,7 +1248,7 @@ def indeterminacy_locus(self):
sage: A. = AffineSpace(QQ, 2)
sage: H = End(A)
sage: f = H([x - y, x^2 - y^2])
- sage: f.indeterminacy_locus()
+ sage: f.indeterminacy_locus() # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
1
@@ -1237,7 +1256,7 @@ def indeterminacy_locus(self):
sage: A. = AffineSpace(QQ, 2)
sage: f = A.hom([x, x/y], A)
- sage: f.indeterminacy_locus()
+ sage: f.indeterminacy_locus() # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
y
"""
@@ -1262,7 +1281,7 @@ def indeterminacy_points(self, F=None):
sage: A. = AffineSpace(QQ, 2)
sage: H = End(A)
sage: f = H([x - y, x^2 - y^2])
- sage: f.indeterminacy_points()
+ sage: f.indeterminacy_points() # needs sage.libs.singular
[]
::
@@ -1270,7 +1289,7 @@ def indeterminacy_points(self, F=None):
sage: A2. = AffineSpace(QQ, 2)
sage: P2. = ProjectiveSpace(QQ, 2)
sage: f = A2.hom([x*y, y, x], P2)
- sage: f.indeterminacy_points()
+ sage: f.indeterminacy_points() # needs sage.libs.singular
[(0, 0)]
"""
@@ -1296,6 +1315,7 @@ def image(self):
EXAMPLES::
+ sage: # needs sage.libs.singular
sage: A1. = AffineSpace(QQ, 1)
sage: A2. = AffineSpace(QQ, 2)
sage: f = A2.hom([x + y], A1)
@@ -1329,18 +1349,18 @@ def _fast_eval(self, x):
EXAMPLES::
- sage: P. = AffineSpace(GF(7), 3) # optional - sage.rings.finite_rings
- sage: H = Hom(P, P) # optional - sage.rings.finite_rings
- sage: f = H([x^2 + y^2,y ^2, z^2 + y*z]) # optional - sage.rings.finite_rings
- sage: f._fast_eval([1, 1, 1]) # optional - sage.rings.finite_rings
+ sage: P. = AffineSpace(GF(7), 3)
+ sage: H = Hom(P, P)
+ sage: f = H([x^2 + y^2,y ^2, z^2 + y*z])
+ sage: f._fast_eval([1, 1, 1])
[2, 1, 2]
::
- sage: P. = AffineSpace(GF(19), 3) # optional - sage.rings.finite_rings
- sage: H = Hom(P, P) # optional - sage.rings.finite_rings
- sage: f = H([x/(y+1), y, (z^2 + y^2)/(x^2 + 1)]) # optional - sage.rings.finite_rings
- sage: f._fast_eval([2, 1, 3]) # optional - sage.rings.finite_rings
+ sage: P. = AffineSpace(GF(19), 3)
+ sage: H = Hom(P, P)
+ sage: f = H([x/(y+1), y, (z^2 + y^2)/(x^2 + 1)])
+ sage: f._fast_eval([2, 1, 3])
[1, 1, 2]
"""
R = self.domain().ambient_space().coordinate_ring()
@@ -1376,7 +1396,7 @@ def representatives(self):
sage: A2. = AffineSpace(QQ, 2)
sage: X = A2.subscheme(0)
sage: f = X.hom([x, x/y], A2)
- sage: f.representatives()
+ sage: f.representatives() # needs sage.libs.singular
[Scheme morphism:
From: Closed subscheme of Affine Space of dimension 2 over Rational Field
defined by: 0
@@ -1385,6 +1405,7 @@ def representatives(self):
::
+ sage: # needs sage.libs.singular
sage: A2. = AffineSpace(QQ, 2)
sage: A1. = AffineSpace(QQ, 1)
sage: X = A2.subscheme([x^2 - y^2 - y])
@@ -1419,7 +1440,7 @@ def representatives(self):
sage: P1. = ProjectiveSpace(QQ, 1)
sage: X = A2.subscheme([x^2 - y^2 - y])
sage: f = X.hom([x, y], P1)
- sage: f.representatives()
+ sage: f.representatives() # needs sage.libs.singular
[Scheme morphism:
From: Closed subscheme of Affine Space of dimension 2 over Rational Field
defined by: x^2 - y^2 - y
@@ -1465,7 +1486,7 @@ def indeterminacy_locus(self):
sage: X = A2.subscheme(0)
sage: A1. = AffineSpace(QQ, 1)
sage: f = X.hom([x1/x2], A1)
- sage: f.indeterminacy_locus()
+ sage: f.indeterminacy_locus() # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
x2
@@ -1475,17 +1496,17 @@ def indeterminacy_locus(self):
sage: X = A2.subscheme(0)
sage: P1. = ProjectiveSpace(QQ, 1)
sage: f = X.hom([x1,x2], P1)
- sage: L = f.indeterminacy_locus()
- sage: L.rational_points()
+ sage: L = f.indeterminacy_locus() # needs sage.libs.singular
+ sage: L.rational_points() # needs sage.libs.singular
[(0, 0)]
::
sage: A2. = AffineSpace(QQ, 2)
sage: X = A2.subscheme([x^2 - y^2 - y])
- sage: A1. = AffineSpace(QQ,1)
+ sage: A1. = AffineSpace(QQ, 1)
sage: f = X.hom([x/y], A1)
- sage: f.indeterminacy_locus()
+ sage: f.indeterminacy_locus() # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
y,
x
@@ -1496,12 +1517,11 @@ def indeterminacy_locus(self):
sage: X = A3.subscheme(x^2 - y*z - x)
sage: A2. = AffineSpace(QQ, 2)
sage: f = X.hom([y, y/x], A2)
- sage: L = f.indeterminacy_locus()
- sage: L
+ sage: L = f.indeterminacy_locus(); L # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 3 over Rational Field defined by:
x,
y*z
- sage: L.dimension()
+ sage: L.dimension() # needs sage.libs.singular
1
"""
@@ -1529,7 +1549,7 @@ def is_morphism(self):
sage: P1. = ProjectiveSpace(QQ,1)
sage: X = P2.subscheme([x^2 - y^2 - y*z])
sage: f = X.hom([x,y], P1)
- sage: f.is_morphism()
+ sage: f.is_morphism() # needs sage.libs.singular
True
"""
return self.indeterminacy_locus().dimension() < 0
@@ -1546,7 +1566,7 @@ def image(self):
sage: A2. = AffineSpace(QQ, 2)
sage: X = A2.subscheme(0)
sage: f = X.hom([x + y], A1)
- sage: f.image()
+ sage: f.image() # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 1 over Rational Field defined by:
(no polynomials)
@@ -1555,7 +1575,7 @@ def image(self):
sage: A2. = AffineSpace(QQ, 2)
sage: X = A2.subscheme([x*y^2 - y^3 - 1])
sage: f = X.hom([y, y/x], A2)
- sage: f.image()
+ sage: f.image() # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
-x^3*y + x^3 - y
"""
diff --git a/src/sage/schemes/affine/affine_point.py b/src/sage/schemes/affine/affine_point.py
index e0cdab543fe..a665ba6881a 100644
--- a/src/sage/schemes/affine/affine_point.py
+++ b/src/sage/schemes/affine/affine_point.py
@@ -115,16 +115,16 @@ def _matrix_times_point_(self, mat, dom):
sage: P = AffineSpace(QQ,2)
sage: Q = P(1,2)
- sage: m = matrix(ZZ, 3, 3, [0,1,1,0,0,1,1,1,1])
- sage: m*Q
+ sage: m = matrix(ZZ, 3, 3, [0,1,1,0,0,1,1,1,1]) # needs sage.modules
+ sage: m*Q # needs sage.modules
(3/4, 1/4)
::
sage: P = AffineSpace(QQ,1)
sage: Q = P(0)
- sage: m = matrix(RR, 2, 2, [0,1,1,0])
- sage: m*Q
+ sage: m = matrix(RR, 2, 2, [0,1,1,0]) # needs sage.modules
+ sage: m*Q # needs sage.modules
Traceback (most recent call last):
...
ValueError: resulting point not affine
@@ -133,8 +133,8 @@ def _matrix_times_point_(self, mat, dom):
sage: P = AffineSpace(QQ,2)
sage: Q = P(1,1)
- sage: m = matrix(RR, 2, 2, [0,1,1,0])
- sage: m*Q
+ sage: m = matrix(RR, 2, 2, [0,1,1,0]) # needs sage.modules
+ sage: m*Q # needs sage.modules
Traceback (most recent call last):
...
ValueError: matrix size is incompatible
@@ -158,9 +158,9 @@ def __hash__(self):
::
- sage: A. = AffineSpace(CC, 3)
- sage: pt = A([1, 2, -i])
- sage: hash(pt) == hash(tuple(pt))
+ sage: A. = AffineSpace(CC, 3) # needs sage.rings.real_mpfr
+ sage: pt = A([1, 2, -i]) # needs sage.rings.real_mpfr sage.symbolic
+ sage: hash(pt) == hash(tuple(pt)) # needs sage.rings.real_mpfr sage.symbolic
True
"""
@@ -183,22 +183,22 @@ def global_height(self, prec=None):
sage: P. = AffineSpace(QQ, 2)
sage: Q = P(41, 1/12)
- sage: Q.global_height()
+ sage: Q.global_height() # needs sage.rings.real_mpfr
3.71357206670431
::
sage: P = AffineSpace(ZZ, 4, 'x')
sage: Q = P(3, 17, -51, 5)
- sage: Q.global_height()
+ sage: Q.global_height() # needs sage.rings.real_mpfr
3.93182563272433
::
sage: R. = PolynomialRing(QQ)
- sage: k. = NumberField(x^2 + 5) # optional - sage.rings.number_field
- sage: A = AffineSpace(k, 2, 'z') # optional - sage.rings.number_field
- sage: A([3, 5*w + 1]).global_height(prec=100) # optional - sage.rings.number_field
+ sage: k. = NumberField(x^2 + 5) # needs sage.rings.number_field
+ sage: A = AffineSpace(k, 2, 'z') # needs sage.rings.number_field
+ sage: A([3, 5*w + 1]).global_height(prec=100) # needs sage.rings.number_field sage.rings.real_mpfr
2.4181409534757389986565376694
.. TODO::
@@ -291,24 +291,26 @@ def weil_restriction(self):
EXAMPLES::
- sage: A. = AffineSpace(GF(5^3, 't'), 3) # optional - sage.rings.finite_rings
- sage: X = A.subscheme([y^2 - x*z, z^2 + y]) # optional - sage.rings.finite_rings
- sage: Y = X.weil_restriction() # optional - sage.rings.finite_rings
- sage: P = X([1, -1, 1]) # optional - sage.rings.finite_rings
- sage: Q = P.weil_restriction();Q # optional - sage.rings.finite_rings
+ sage: # needs sage.libs.singular sage.rings.finite_rings
+ sage: A. = AffineSpace(GF(5^3, 't'), 3)
+ sage: X = A.subscheme([y^2 - x*z, z^2 + y])
+ sage: Y = X.weil_restriction()
+ sage: P = X([1, -1, 1])
+ sage: Q = P.weil_restriction();Q
(1, 0, 0, 4, 0, 0, 1, 0, 0)
- sage: Q.codomain() == Y # optional - sage.rings.finite_rings
+ sage: Q.codomain() == Y
True
::
+ sage: # needs sage.libs.singular sage.rings.number_field
sage: R. = QQ[]
- sage: K. = NumberField(x^5 - 2) # optional - sage.rings.number_field
- sage: R. = K[] # optional - sage.rings.number_field
- sage: L. = K.extension(x^2 + w) # optional - sage.rings.number_field
- sage: A. = AffineSpace(L, 2) # optional - sage.rings.number_field
- sage: P = A([w^3 - v, 1 + w + w*v]) # optional - sage.rings.number_field
- sage: P.weil_restriction() # optional - sage.rings.number_field
+ sage: K. = NumberField(x^5 - 2)
+ sage: R. = K[]
+ sage: L. = K.extension(x^2 + w)
+ sage: A. = AffineSpace(L, 2)
+ sage: P = A([w^3 - v, 1 + w + w*v])
+ sage: P.weil_restriction()
(w^3, -1, w + 1, w)
"""
L = self.codomain().base_ring()
@@ -358,14 +360,15 @@ def intersection_multiplicity(self, X):
EXAMPLES::
- sage: A. = AffineSpace(GF(17), 2) # optional - sage.rings.finite_rings
- sage: X = A.subscheme([y^2 - x^3 + 2*x^2 - x]) # optional - sage.rings.finite_rings
- sage: Y = A.subscheme([y - 2*x + 2]) # optional - sage.rings.finite_rings
- sage: Q1 = Y([1,0]) # optional - sage.rings.finite_rings
- sage: Q1.intersection_multiplicity(X) # optional - sage.rings.finite_rings
+ sage: # needs sage.libs.singular
+ sage: A. = AffineSpace(GF(17), 2)
+ sage: X = A.subscheme([y^2 - x^3 + 2*x^2 - x])
+ sage: Y = A.subscheme([y - 2*x + 2])
+ sage: Q1 = Y([1,0])
+ sage: Q1.intersection_multiplicity(X)
2
- sage: Q2 = X([4,6]) # optional - sage.rings.finite_rings
- sage: Q2.intersection_multiplicity(Y) # optional - sage.rings.finite_rings
+ sage: Q2 = X([4,6])
+ sage: Q2.intersection_multiplicity(Y)
1
::
@@ -397,10 +400,10 @@ def multiplicity(self):
sage: A. = AffineSpace(QQ, 3)
sage: X = A.subscheme([y^2 - x^7*z])
sage: Q1 = X([1,1,1])
- sage: Q1.multiplicity()
+ sage: Q1.multiplicity() # needs sage.libs.singular
1
sage: Q2 = X([0,0,2])
- sage: Q2.multiplicity()
+ sage: Q2.multiplicity() # needs sage.libs.singular
2
"""
from sage.schemes.affine.affine_space import is_AffineSpace
@@ -419,27 +422,27 @@ def __hash__(self):
EXAMPLES::
- sage: P. = AffineSpace(GF(5), 3) # optional - sage.rings.finite_rings
- sage: hash(P(2, 1, 2)) # optional - sage.rings.finite_rings
+ sage: P. = AffineSpace(GF(5), 3)
+ sage: hash(P(2, 1, 2))
57
::
- sage: P. = AffineSpace(GF(7), 3) # optional - sage.rings.finite_rings
- sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings
- sage: hash(X(1, 1, 2)) # optional - sage.rings.finite_rings
+ sage: P. = AffineSpace(GF(7), 3)
+ sage: X = P.subscheme(x^2 - y^2)
+ sage: hash(X(1, 1, 2))
106
::
- sage: P. = AffineSpace(GF(13), 2) # optional - sage.rings.finite_rings
- sage: hash(P(3, 4)) # optional - sage.rings.finite_rings
+ sage: P. = AffineSpace(GF(13), 2)
+ sage: hash(P(3, 4))
55
::
- sage: P. = AffineSpace(GF(13^3, 't'), 2) # optional - sage.rings.finite_rings
- sage: hash(P(3, 4)) # optional - sage.rings.finite_rings
+ sage: P. = AffineSpace(GF(13^3, 't'), 2) # needs sage.rings.finite_rings
+ sage: hash(P(3, 4)) # needs sage.rings.finite_rings
8791
"""
p = self.codomain().base_ring().order()
diff --git a/src/sage/schemes/affine/affine_rational_point.py b/src/sage/schemes/affine/affine_rational_point.py
index 91ec84ffeab..739d1795086 100644
--- a/src/sage/schemes/affine/affine_rational_point.py
+++ b/src/sage/schemes/affine/affine_rational_point.py
@@ -25,8 +25,8 @@
Affine over a finite field::
sage: from sage.schemes.affine.affine_rational_point import enum_affine_finite_field
- sage: A. = AffineSpace(4, GF(2)) # optional - sage.rings.finite_rings
- sage: enum_affine_finite_field(A(GF(2))) # optional - sage.rings.finite_rings
+ sage: A. = AffineSpace(4, GF(2))
+ sage: enum_affine_finite_field(A(GF(2)))
[(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 1, 0), (0, 0, 1, 1), (0, 1, 0, 0),
(0, 1, 0, 1), (0, 1, 1, 0), (0, 1, 1, 1), (1, 0, 0, 0), (1, 0, 0, 1),
(1, 0, 1, 0), (1, 0, 1, 1), (1, 1, 0, 0), (1, 1, 0, 1), (1, 1, 1, 0),
@@ -94,8 +94,8 @@ def enum_affine_rational_field(X, B):
::
sage: A. = AffineSpace(2, QQ)
- sage: C = Curve(x^2 + y - x)
- sage: enum_affine_rational_field(C, 10) # long time (3 s)
+ sage: C = Curve(x^2 + y - x) # needs sage.libs.singular
+ sage: enum_affine_rational_field(C, 10) # long time (3 s) # needs sage.libs.singular
[(-2, -6), (-1, -2), (-2/3, -10/9), (-1/2, -3/4), (-1/3, -4/9),
(0, 0), (1/3, 2/9), (1/2, 1/4), (2/3, 2/9), (1, 0),
(4/3, -4/9), (3/2, -3/4), (5/3, -10/9), (2, -2), (3, -6)]
@@ -188,12 +188,13 @@ def enum_affine_number_field(X, **kwds):
EXAMPLES::
+ sage: # needs sage.rings.number_field
sage: from sage.schemes.affine.affine_rational_point import enum_affine_number_field
sage: u = QQ['u'].0
- sage: K = NumberField(u^2 + 2, 'v') # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field
- sage: X = A.subscheme([y^2 - x]) # optional - sage.rings.number_field
- sage: enum_affine_number_field(X(K), bound=2**0.5) # optional - sage.rings.number_field
+ sage: K = NumberField(u^2 + 2, 'v')
+ sage: A. = AffineSpace(K, 3)
+ sage: X = A.subscheme([y^2 - x])
+ sage: enum_affine_number_field(X(K), bound=2**0.5)
[(0, 0, -1), (0, 0, -v), (0, 0, -1/2*v), (0, 0, 0), (0, 0, 1/2*v),
(0, 0, v), (0, 0, 1), (1, -1, -1), (1, -1, -v), (1, -1, -1/2*v),
(1, -1, 0), (1, -1, 1/2*v), (1, -1, v), (1, -1, 1), (1, 1, -1),
@@ -201,12 +202,13 @@ def enum_affine_number_field(X, **kwds):
::
+ sage: # needs sage.rings.number_field
sage: from sage.schemes.affine.affine_rational_point import enum_affine_number_field
sage: u = QQ['u'].0
- sage: K = NumberField(u^2 + 3, 'v') # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: X = A.subscheme(x - y) # optional - sage.rings.number_field
- sage: enum_affine_number_field(X, bound=3**0.25) # optional - sage.rings.number_field
+ sage: K = NumberField(u^2 + 3, 'v')
+ sage: A. = AffineSpace(K, 2)
+ sage: X = A.subscheme(x - y)
+ sage: enum_affine_number_field(X, bound=3**0.25)
[(-1, -1), (-1/2*v - 1/2, -1/2*v - 1/2), (1/2*v - 1/2, 1/2*v - 1/2),
(0, 0), (-1/2*v + 1/2, -1/2*v + 1/2), (1/2*v + 1/2, 1/2*v + 1/2), (1, 1)]
"""
@@ -250,13 +252,13 @@ def enum_affine_finite_field(X):
EXAMPLES::
sage: from sage.schemes.affine.affine_rational_point import enum_affine_finite_field
- sage: F = GF(7) # optional - sage.rings.finite_rings
- sage: A. = AffineSpace(4, F) # optional - sage.rings.finite_rings
- sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6, z*y + w*x]) # optional - sage.rings.finite_rings
- sage: enum_affine_finite_field(C(F)) # optional - sage.rings.finite_rings
+ sage: F = GF(7)
+ sage: A. = AffineSpace(4, F)
+ sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6, z*y + w*x])
+ sage: enum_affine_finite_field(C(F))
[]
- sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6]) # optional - sage.rings.finite_rings
- sage: enum_affine_finite_field(C(F)) # optional - sage.rings.finite_rings
+ sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6])
+ sage: enum_affine_finite_field(C(F))
[(0, 3, 1, 2), (0, 3, 2, 1), (0, 3, 3, 3), (0, 3, 4, 4), (0, 3, 5, 6),
(0, 3, 6, 5), (1, 2, 1, 3), (1, 2, 2, 5), (1, 2, 3, 1), (1, 2, 4, 6),
(1, 2, 5, 2), (1, 2, 6, 4), (2, 6, 1, 1), (2, 6, 2, 4), (2, 6, 3, 5),
@@ -269,9 +271,9 @@ def enum_affine_finite_field(X):
::
- sage: A. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings
- sage: S = A.subscheme(x + y) # optional - sage.rings.finite_rings
- sage: enum_affine_finite_field(S) # optional - sage.rings.finite_rings
+ sage: A. = AffineSpace(3, GF(3))
+ sage: S = A.subscheme(x + y)
+ sage: enum_affine_finite_field(S)
[(0, 0, 0), (0, 0, 1), (0, 0, 2), (1, 2, 0), (1, 2, 1), (1, 2, 2),
(2, 1, 0), (2, 1, 1), (2, 1, 2)]
diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py
index 2c8ebf0f39a..927a065cf60 100644
--- a/src/sage/schemes/affine/affine_space.py
+++ b/src/sage/schemes/affine/affine_space.py
@@ -49,7 +49,7 @@ def is_AffineSpace(x) -> bool:
sage: from sage.schemes.affine.affine_space import is_AffineSpace
sage: is_AffineSpace(AffineSpace(5, names='x'))
True
- sage: is_AffineSpace(AffineSpace(5, GF(9, 'alpha'), names='x')) # optional - sage.rings.finite_rings
+ sage: is_AffineSpace(AffineSpace(5, GF(9, 'alpha'), names='x')) # needs sage.rings.finite_rings
True
sage: is_AffineSpace(Spec(ZZ))
False
@@ -77,7 +77,7 @@ def AffineSpace(n, R=None, names=None, ambient_projective_space=None,
Use the divide operator for base extension::
- sage: AffineSpace(5, names='x')/GF(17) # optional - sage.rings.finite_rings
+ sage: AffineSpace(5, names='x')/GF(17)
Affine Space of dimension 5 over Finite Field of size 17
The default base ring is `\ZZ`::
@@ -87,10 +87,10 @@ def AffineSpace(n, R=None, names=None, ambient_projective_space=None,
There is also an affine space associated to each polynomial ring::
- sage: R = GF(7)['x, y, z'] # optional - sage.rings.finite_rings
- sage: A = AffineSpace(R); A # optional - sage.rings.finite_rings
+ sage: R = GF(7)['x, y, z']
+ sage: A = AffineSpace(R); A
Affine Space of dimension 3 over Finite Field of size 7
- sage: A.coordinate_ring() is R # optional - sage.rings.finite_rings
+ sage: A.coordinate_ring() is R
True
TESTS::
@@ -170,10 +170,10 @@ class AffineSpace_generic(AmbientSpace, AffineScheme):
sage: AffineSpace(5, PolynomialRing(QQ, 'z'), 'Z')
Affine Space of dimension 5 over Univariate Polynomial Ring in z over Rational Field
- sage: AffineSpace(RealField(), 3, 'Z')
+ sage: AffineSpace(RealField(), 3, 'Z') # needs sage.rings.real_mpfr
Affine Space of dimension 3 over Real Field with 53 bits of precision
- sage: AffineSpace(Qp(7), 2, 'x') # optional - sage.rings.padics
+ sage: AffineSpace(Qp(7), 2, 'x') # needs sage.rings.padics
Affine Space of dimension 2 over 7-adic Field with capped relative precision 20
Even 0-dimensional affine spaces are supported::
@@ -185,7 +185,7 @@ def __init__(self, n, R, names, ambient_projective_space, default_embedding_inde
"""
EXAMPLES::
- sage: AffineSpace(3, Zp(5), 'y') # optional - sage.rings.padics
+ sage: AffineSpace(3, Zp(5), 'y') # needs sage.rings.padics
Affine Space of dimension 3 over 5-adic Ring with capped relative precision 20
"""
AmbientSpace.__init__(self, n, R)
@@ -205,15 +205,15 @@ def __iter__(self):
EXAMPLES::
- sage: FF = FiniteField(3) # optional - sage.rings.finite_rings
- sage: AA = AffineSpace(FF, 0) # optional - sage.rings.finite_rings
- sage: [ x for x in AA ] # optional - sage.rings.finite_rings
+ sage: FF = FiniteField(3)
+ sage: AA = AffineSpace(FF, 0)
+ sage: [ x for x in AA ]
[()]
- sage: AA = AffineSpace(FF, 1, 'Z') # optional - sage.rings.finite_rings
- sage: [ x for x in AA ] # optional - sage.rings.finite_rings
+ sage: AA = AffineSpace(FF, 1, 'Z')
+ sage: [ x for x in AA ]
[(0), (1), (2)]
- sage: AA. = AffineSpace(FF, 2) # optional - sage.rings.finite_rings
- sage: [ x for x in AA ] # optional - sage.rings.finite_rings
+ sage: AA. = AffineSpace(FF, 2)
+ sage: [ x for x in AA ]
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]
AUTHOR:
@@ -249,13 +249,13 @@ def rational_points(self, F=None):
EXAMPLES::
- sage: A = AffineSpace(1, GF(3)) # optional - sage.rings.finite_rings
- sage: A.rational_points() # optional - sage.rings.finite_rings
+ sage: A = AffineSpace(1, GF(3))
+ sage: A.rational_points()
[(0), (1), (2)]
- sage: A.rational_points(GF(3^2, 'b')) # optional - sage.rings.finite_rings
+ sage: A.rational_points(GF(3^2, 'b')) # needs sage.rings.finite_rings
[(0), (b), (b + 1), (2*b + 1), (2), (2*b), (2*b + 2), (b + 2), (1)]
- sage: AffineSpace(2, ZZ).rational_points(GF(2)) # optional - sage.rings.finite_rings
+ sage: AffineSpace(2, ZZ).rational_points(GF(2))
[(0, 0), (0, 1), (1, 0), (1, 1)]
TESTS::
@@ -264,7 +264,7 @@ def rational_points(self, F=None):
Traceback (most recent call last):
...
TypeError: base ring (= Rational Field) must be a finite field
- sage: AffineSpace(1, GF(3)).rational_points(ZZ) # optional - sage.rings.finite_rings
+ sage: AffineSpace(1, GF(3)).rational_points(ZZ)
Traceback (most recent call last):
...
TypeError: second argument (= Integer Ring) must be a finite field
@@ -333,7 +333,7 @@ def _latex_(self):
TESTS::
- sage: AffineSpace(3, Zp(5), 'y')._latex_() # optional - sage.rings.padics
+ sage: AffineSpace(3, Zp(5), 'y')._latex_() # needs sage.rings.padics
'\\mathbf{A}_{\\Bold{Z}_{5}}^3'
"""
return "\\mathbf{A}_{%s}^%s" % (latex(self.base_ring()), self.dimension_relative())
@@ -434,7 +434,7 @@ def _repr_(self):
TESTS::
- sage: AffineSpace(3, Zp(5), 'y')._repr_() # optional - sage.rings.padics
+ sage: AffineSpace(3, Zp(5), 'y')._repr_() # needs sage.rings.padics
'Affine Space of dimension 3 over 5-adic Ring with capped relative precision 20'
"""
return "Affine Space of dimension %s over %s" % (self.dimension_relative(), self.base_ring())
@@ -633,14 +633,14 @@ def change_ring(self, R):
sage: A. = AffineSpace(3, ZZ)
sage: AQ = A.change_ring(QQ); AQ
Affine Space of dimension 3 over Rational Field
- sage: AQ.change_ring(GF(5)) # optional - sage.rings.finite_rings
+ sage: AQ.change_ring(GF(5))
Affine Space of dimension 3 over Finite Field of size 5
::
- sage: K. = QuadraticField(5) # optional - sage.rings.number_field
- sage: A = AffineSpace(K, 2, 't') # optional - sage.rings.number_field
- sage: A.change_ring(K.embeddings(CC)[1]) # optional - sage.rings.number_field
+ sage: K. = QuadraticField(5) # needs sage.rings.number_field
+ sage: A = AffineSpace(K, 2, 't') # needs sage.rings.number_field
+ sage: A.change_ring(K.embeddings(CC)[1]) # needs sage.rings.number_field
Affine Space of dimension 2 over Complex Field with 53 bits of precision
"""
if isinstance(R, Map):
@@ -654,9 +654,9 @@ def coordinate_ring(self):
EXAMPLES::
- sage: R = AffineSpace(2, GF(9,'alpha'), 'z').coordinate_ring(); R # optional - sage.rings.finite_rings
+ sage: R = AffineSpace(2, GF(9,'alpha'), 'z').coordinate_ring(); R # needs sage.rings.finite_rings
Multivariate Polynomial Ring in z0, z1 over Finite Field in alpha of size 3^2
- sage: AffineSpace(3, R, 'x').coordinate_ring() # optional - sage.rings.finite_rings
+ sage: AffineSpace(3, R, 'x').coordinate_ring() # needs sage.rings.finite_rings
Multivariate Polynomial Ring in x0, x1, x2 over Multivariate Polynomial Ring
in z0, z1 over Finite Field in alpha of size 3^2
"""
@@ -810,6 +810,7 @@ def subscheme(self, X, **kwds):
::
+ sage: # needs sage.libs.singular
sage: X.defining_polynomials ()
(x, y^2, x*y^2)
sage: I = X.defining_ideal(); I
@@ -851,7 +852,7 @@ def _an_element_(self):
sage: AffineSpace(ZZ, 2, 'x').an_element()
(5, 4)
- sage: AffineSpace(Qp(5), 2, 'x').an_element() # optional - sage.rings.padics
+ sage: AffineSpace(Qp(5), 2, 'x').an_element() # needs sage.rings.padics
(5^2 + O(5^22), 4*5 + O(5^21))
"""
n = self.dimension_relative()
@@ -883,21 +884,21 @@ def chebyshev_polynomial(self, n, kind='first', monic=False):
EXAMPLES::
sage: A. = AffineSpace(QQ, 1)
- sage: A.chebyshev_polynomial(5, 'first')
+ sage: A.chebyshev_polynomial(5, 'first') # needs sage.schemes
Dynamical System of Affine Space of dimension 1 over Rational Field
Defn: Defined on coordinates by sending (x) to (16*x^5 - 20*x^3 + 5*x)
::
sage: A. = AffineSpace(QQ, 1)
- sage: A.chebyshev_polynomial(3, 'second')
+ sage: A.chebyshev_polynomial(3, 'second') # needs sage.schemes
Dynamical System of Affine Space of dimension 1 over Rational Field
Defn: Defined on coordinates by sending (x) to (8*x^3 - 4*x)
::
sage: A. = AffineSpace(QQ, 1)
- sage: A.chebyshev_polynomial(3, 2)
+ sage: A.chebyshev_polynomial(3, 2) # needs sage.schemes
Traceback (most recent call last):
...
ValueError: keyword 'kind' must have a value of either 'first' or 'second'
@@ -921,15 +922,15 @@ def chebyshev_polynomial(self, n, kind='first', monic=False):
::
sage: A. = AffineSpace(QQ, 1)
- sage: A.chebyshev_polynomial(7, monic=True)
+ sage: A.chebyshev_polynomial(7, monic=True) # needs sage.schemes
Dynamical System of Affine Space of dimension 1 over Rational Field
Defn: Defined on coordinates by sending (x) to (x^7 - 7*x^5 + 14*x^3 - 7*x)
::
sage: F. = FunctionField(QQ)
- sage: A. = AffineSpace(F,1)
- sage: A.chebyshev_polynomial(4, monic=True)
+ sage: A. = AffineSpace(F, 1)
+ sage: A.chebyshev_polynomial(4, monic=True) # needs sage.schemes
Dynamical System of Affine Space of dimension 1
over Rational function field in t over Rational Field
Defn: Defined on coordinates by sending (x) to (x^4 + (-4)*x^2 + 2)
@@ -983,9 +984,9 @@ def _point(self, *args, **kwds):
TESTS::
- sage: P2. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings
- sage: point_homset = P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings
- sage: P2._point(point_homset, [1, 2, 3]) # optional - sage.rings.finite_rings
+ sage: P2. = AffineSpace(3, GF(3))
+ sage: point_homset = P2._point_homset(Spec(GF(3)), P2)
+ sage: P2._point(point_homset, [1, 2, 3])
(1, 2, 0)
"""
return SchemeMorphism_point_affine_field(*args, **kwds)
@@ -998,8 +999,8 @@ def _morphism(self, *args, **kwds):
TESTS::
- sage: P2. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings
- sage: P2._morphism(P2.Hom(P2), [x, y, z]) # optional - sage.rings.finite_rings
+ sage: P2. = AffineSpace(3, GF(3))
+ sage: P2._morphism(P2.Hom(P2), [x, y, z])
Scheme endomorphism of Affine Space of dimension 3 over Finite Field of size 3
Defn: Defined on coordinates by sending (x, y, z) to
(x, y, z)
@@ -1051,8 +1052,8 @@ def points_of_bounded_height(self, **kwds):
::
sage: u = QQ['u'].0
- sage: A. = AffineSpace(NumberField(u^2 - 2, 'v'), 2) # optional - sage.rings.number_field
- sage: len(list(A.points_of_bounded_height(bound=2, tolerance=0.1))) # optional - sage.rings.number_field
+ sage: A. = AffineSpace(NumberField(u^2 - 2, 'v'), 2) # needs sage.rings.number_field
+ sage: len(list(A.points_of_bounded_height(bound=2, tolerance=0.1))) # needs sage.rings.number_field
529
"""
if is_RationalField(self.base_ring()):
@@ -1105,15 +1106,16 @@ def weil_restriction(self):
EXAMPLES::
+ sage: # needs sage.rings.number_field
sage: R. = QQ[]
- sage: K. = NumberField(x^5 - 2) # optional - sage.rings.number_field
- sage: AK. = AffineSpace(K, 2) # optional - sage.rings.number_field
- sage: AK.weil_restriction() # optional - sage.rings.number_field
+ sage: K. = NumberField(x^5 - 2)
+ sage: AK. = AffineSpace(K, 2)
+ sage: AK.weil_restriction()
Affine Space of dimension 10 over Rational Field
- sage: R. = K[] # optional - sage.rings.number_field
- sage: L. = K.extension(x^2 + 1) # optional - sage.rings.number_field
- sage: AL. = AffineSpace(L, 2) # optional - sage.rings.number_field
- sage: AL.weil_restriction() # optional - sage.rings.number_field
+ sage: R. = K[]
+ sage: L. = K.extension(x^2 + 1)
+ sage: AL. = AffineSpace(L, 2)
+ sage: AL.weil_restriction()
Affine Space of dimension 4 over Number Field in w
with defining polynomial x^5 - 2
"""
@@ -1147,7 +1149,7 @@ def curve(self, F):
EXAMPLES::
sage: A. = AffineSpace(QQ, 3)
- sage: A.curve([y - x^4, z - y^5])
+ sage: A.curve([y - x^4, z - y^5]) # needs sage.libs.pari
Affine Curve over Rational Field defined by -x^4 + y, -y^5 + z
"""
from sage.schemes.curves.constructor import Curve
@@ -1163,13 +1165,13 @@ def line_through(self, p, q):
EXAMPLES::
+ sage: # needs sage.libs.singular sage.schemes
sage: A3. = AffineSpace(3, QQ)
sage: p1 = A3(1, 2, 3)
sage: p2 = A3(4, 5, 6)
- sage: A3.line_through(p1, p2)
+ sage: L = A3.line_through(p1, p2); L
Affine Curve over Rational Field defined by -1/6*x + 1/6*y - 1/6,
-1/6*x + 1/6*z - 1/3, -1/6*y + 1/6*z - 1/6, -1/6*x + 1/3*y - 1/6*z
- sage: L = _
sage: L(p1)
(1, 2, 3)
sage: L(p2)
@@ -1236,9 +1238,9 @@ def _point(self, *args, **kwds):
TESTS::
- sage: P2. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings
- sage: point_homset = P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings
- sage: P2._point(point_homset, [1, 2, 3]) # optional - sage.rings.finite_rings
+ sage: P2. = AffineSpace(3, GF(3))
+ sage: point_homset = P2._point_homset(Spec(GF(3)), P2)
+ sage: P2._point(point_homset, [1, 2, 3])
(1, 2, 0)
"""
return SchemeMorphism_point_affine_finite_field(*args, **kwds)
@@ -1251,8 +1253,8 @@ def _morphism(self, *args, **kwds):
TESTS::
- sage: P2. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings
- sage: P2._morphism(P2.Hom(P2), [x, y, z]) # optional - sage.rings.finite_rings
+ sage: P2. = AffineSpace(3, GF(3))
+ sage: P2._morphism(P2.Hom(P2), [x, y, z])
Scheme endomorphism of Affine Space of dimension 3 over Finite Field of size 3
Defn: Defined on coordinates by sending (x, y, z) to
(x, y, z)
diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py
index a5a1c661c74..ed125a60193 100644
--- a/src/sage/schemes/affine/affine_subscheme.py
+++ b/src/sage/schemes/affine/affine_subscheme.py
@@ -59,7 +59,7 @@ def __init__(self, A, polynomials, embedding_center=None,
EXAMPLES::
sage: A. = AffineSpace(QQ, 3)
- sage: A.subscheme([y^2-x*z-x*y])
+ sage: A.subscheme([y^2 - x*z - x*y])
Closed subscheme of Affine Space of dimension 3 over Rational Field defined by:
-x*y + y^2 - x*z
"""
@@ -98,6 +98,7 @@ def dimension(self):
EXAMPLES::
+ sage: # needs sage.libs.singular
sage: A. = AffineSpace(2, QQ)
sage: A.subscheme([]).dimension()
2
@@ -120,7 +121,7 @@ def dimension(self):
x^2*y^2 + z^2,
z^2 - w^2,
10*x^2 - z^2 + w^2
- sage: X.dimension()
+ sage: X.dimension() # needs sage.libs.singular
1
"""
try:
@@ -152,7 +153,7 @@ def projective_embedding(self, i=None, PP=None):
sage: A. = AffineSpace(3, ZZ)
sage: S = A.subscheme([x*y - z])
- sage: S.projective_embedding()
+ sage: S.projective_embedding() # needs sage.libs.singular
Scheme morphism:
From: Closed subscheme of Affine Space of dimension 3 over Integer Ring
defined by: x*y - z
@@ -165,7 +166,7 @@ def projective_embedding(self, i=None, PP=None):
sage: A. = AffineSpace(3, ZZ)
sage: P = ProjectiveSpace(3, ZZ, 'u')
sage: S = A.subscheme([x^2 - y*z])
- sage: S.projective_embedding(1, P)
+ sage: S.projective_embedding(1, P) # needs sage.libs.singular
Scheme morphism:
From: Closed subscheme of Affine Space of dimension 3 over Integer Ring
defined by: x^2 - y*z
@@ -177,7 +178,7 @@ def projective_embedding(self, i=None, PP=None):
sage: A. = AffineSpace(QQ, 3)
sage: X = A.subscheme([y - x^2, z - x^3])
- sage: X.projective_embedding()
+ sage: X.projective_embedding() # needs sage.libs.singular
Scheme morphism:
From: Closed subscheme of Affine Space of dimension 3 over Rational Field
defined by: -x^2 + y, -x^3 + z
@@ -189,17 +190,17 @@ def projective_embedding(self, i=None, PP=None):
projective embedding, the subscheme inherits the embedding::
sage: A. = AffineSpace(2, QQ, default_embedding_index=1)
- sage: X = A.subscheme(u - v)
- sage: X.projective_embedding()
+ sage: X = A.subscheme(u - v) # needs sage.libs.singular
+ sage: X.projective_embedding() # needs sage.libs.singular
Scheme morphism:
From: Closed subscheme of Affine Space of dimension 2 over Rational Field
defined by: u - v
To: Closed subscheme of Projective Space of dimension 2 over Rational Field
defined by: x0 - x2
Defn: Defined on coordinates by sending (u, v) to (u : 1 : v)
- sage: phi = X.projective_embedding()
+ sage: phi = X.projective_embedding() # needs sage.libs.singular
sage: psi = A.projective_embedding()
- sage: phi(X(2, 2)) == psi(A(X(2, 2)))
+ sage: phi(X(2, 2)) == psi(A(X(2, 2))) # needs sage.libs.singular
True
"""
AA = self.ambient_space()
@@ -261,8 +262,9 @@ def projective_closure(self, i=None, PP=None):
EXAMPLES::
sage: A. = AffineSpace(QQ, 4)
- sage: X = A.subscheme([x^2 - y, x*y - z, y^2 - w, x*z - w, y*z - x*w, z^2 - y*w])
- sage: X.projective_closure()
+ sage: X = A.subscheme([x^2 - y, x*y - z, y^2 - w,
+ ....: x*z - w, y*z - x*w, z^2 - y*w])
+ sage: X.projective_closure() # needs sage.libs.singular
Closed subscheme of Projective Space of dimension 4 over Rational Field
defined by:
x0^2 - x1*x4,
@@ -277,7 +279,7 @@ def projective_closure(self, i=None, PP=None):
sage: A. = AffineSpace(QQ, 3)
sage: P. = ProjectiveSpace(QQ, 3)
sage: X = A.subscheme([z - x^2 - y^2])
- sage: X.projective_closure(1, P).ambient_space() == P
+ sage: X.projective_closure(1, P).ambient_space() == P # needs sage.libs.singular
True
"""
return self.projective_embedding(i, PP).codomain()
@@ -310,11 +312,11 @@ def is_smooth(self, point=None):
sage: singular_point = cuspidal_curve.point([0,0])
sage: singular_point in cuspidal_curve
True
- sage: cuspidal_curve.is_smooth(smooth_point)
+ sage: cuspidal_curve.is_smooth(smooth_point) # needs sage.libs.singular
True
- sage: cuspidal_curve.is_smooth(singular_point)
+ sage: cuspidal_curve.is_smooth(singular_point) # needs sage.libs.singular
False
- sage: cuspidal_curve.is_smooth()
+ sage: cuspidal_curve.is_smooth() # needs sage.libs.singular
False
"""
R = self.ambient_space().coordinate_ring()
@@ -354,24 +356,25 @@ def intersection_multiplicity(self, X, P):
EXAMPLES::
sage: A. = AffineSpace(QQ, 2)
- sage: C = Curve([y^2 - x^3 - x^2], A)
- sage: D = Curve([y^2 + x^3], A)
+ sage: C = Curve([y^2 - x^3 - x^2], A) # needs sage.libs.singular
+ sage: D = Curve([y^2 + x^3], A) # needs sage.libs.singular
sage: Q = A([0,0])
- sage: C.intersection_multiplicity(D, Q)
+ sage: C.intersection_multiplicity(D, Q) # needs sage.libs.singular
4
::
+ sage: # needs sage.rings.number_field
sage: R. = QQ[]
- sage: K. = NumberField(a^6 - 3*a^5 + 5*a^4 - 5*a^3 + 5*a^2 - 3*a + 1) # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 4) # optional - sage.rings.number_field
- sage: X = A.subscheme([x*y, y*z + 7, w^3 - x^3]) # optional - sage.rings.number_field
- sage: Y = A.subscheme([x - z^3 + z + 1]) # optional - sage.rings.number_field
- sage: Q = A([0, # optional - sage.rings.number_field
+ sage: K. = NumberField(a^6 - 3*a^5 + 5*a^4 - 5*a^3 + 5*a^2 - 3*a + 1)
+ sage: A. = AffineSpace(K, 4)
+ sage: X = A.subscheme([x*y, y*z + 7, w^3 - x^3])
+ sage: Y = A.subscheme([x - z^3 + z + 1])
+ sage: Q = A([0,
....: -7*b^5 + 21*b^4 - 28*b^3 + 21*b^2 - 21*b + 14,
....: -b^5 + 2*b^4 - 3*b^3 + 2*b^2 - 2*b,
....: 0])
- sage: X.intersection_multiplicity(Y, Q) # optional - sage.rings.number_field
+ sage: X.intersection_multiplicity(Y, Q)
3
::
@@ -380,7 +383,7 @@ def intersection_multiplicity(self, X, P):
sage: X = A.subscheme([z^2 - 1])
sage: Y = A.subscheme([z - 1, y - x^2])
sage: Q = A([1,1,1])
- sage: X.intersection_multiplicity(Y, Q)
+ sage: X.intersection_multiplicity(Y, Q) # needs sage.libs.singular
Traceback (most recent call last):
...
TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 3
@@ -392,7 +395,7 @@ def intersection_multiplicity(self, X, P):
sage: X = A.subscheme([x*y, t^2*w, w^3*z])
sage: Y = A.subscheme([y*w + z])
sage: Q = A([0,0,0,0,0])
- sage: X.intersection_multiplicity(Y, Q)
+ sage: X.intersection_multiplicity(Y, Q) # needs sage.libs.singular
Traceback (most recent call last):
...
TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 5
@@ -446,30 +449,31 @@ def multiplicity(self, P):
sage: A. = AffineSpace(QQ, 4)
sage: X = A.subscheme([z*y - x^7, w - 2*z])
sage: Q1 = A([1,1/3,3,6])
- sage: X.multiplicity(Q1)
+ sage: X.multiplicity(Q1) # needs sage.libs.singular
1
sage: Q2 = A([0,0,0,0])
- sage: X.multiplicity(Q2)
+ sage: X.multiplicity(Q2) # needs sage.libs.singular
2
::
- sage: A. = AffineSpace(GF(23), 5) # optional - sage.rings.finite_rings
- sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3]) # optional - sage.rings.finite_rings
- sage: Q = A([22,1,1,0,0]) # optional - sage.rings.finite_rings
- sage: C.multiplicity(Q) # optional - sage.rings.finite_rings
+ sage: A. = AffineSpace(GF(23), 5)
+ sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3]) # needs sage.libs.singular sage.schemes
+ sage: Q = A([22,1,1,0,0])
+ sage: C.multiplicity(Q) # needs sage.libs.singular sage.schemes
3
::
- sage: K. = QuadraticField(-1) # optional - sage.rings.number_field
- sage: A. = AffineSpace(K, 5) # optional - sage.rings.number_field
- sage: X = A.subscheme([y^7 - x^2*z^5 + z^3*t^8 - x^2*y^4*z - t^8]) # optional - sage.rings.number_field
- sage: Q1 = A([1,1,0,1,-1]) # optional - sage.rings.number_field
- sage: X.multiplicity(Q1) # optional - sage.rings.number_field
+ sage: # needs sage.rings.number_field
+ sage: K. = QuadraticField(-1)
+ sage: A. = AffineSpace(K, 5)
+ sage: X = A.subscheme([y^7 - x^2*z^5 + z^3*t^8 - x^2*y^4*z - t^8])
+ sage: Q1 = A([1,1,0,1,-1])
+ sage: X.multiplicity(Q1)
1
- sage: Q2 = A([0,0,0,-a,0]) # optional - sage.rings.number_field
- sage: X.multiplicity(Q2) # optional - sage.rings.number_field
+ sage: Q2 = A([0,0,0,-a,0])
+ sage: X.multiplicity(Q2)
7
Check that :trac:`27479` is fixed::
@@ -477,7 +481,7 @@ def multiplicity(self, P):
sage: A1. = AffineSpace(QQ, 1)
sage: X = A1.subscheme([x^1789 + x])
sage: Q = X([0])
- sage: X.multiplicity(Q)
+ sage: X.multiplicity(Q) # needs sage.libs.singular
1
"""
if not self.base_ring() in Fields():
@@ -543,11 +547,11 @@ def tangent_space(self, p):
sage: A3. = AffineSpace(3, QQ)
sage: X = A3.subscheme(z - x*y)
- sage: X.tangent_space(A3.origin())
+ sage: X.tangent_space(A3.origin()) # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 3 over Rational Field
defined by:
z
- sage: X.tangent_space(X(1,1,1))
+ sage: X.tangent_space(X(1,1,1)) # needs sage.libs.singular
Closed subscheme of Affine Space of dimension 3 over Rational Field
defined by:
-x - y + z
@@ -555,6 +559,7 @@ def tangent_space(self, p):
Tangent space at a point may have higher dimension than the dimension
of the point. ::
+ sage: # needs sage.libs.singular
sage: C = Curve([x + y + z, x^2 - y^2*z^2 + z^3])
sage: C.singular_points()
[(0, 0, 0)]
diff --git a/src/sage/schemes/berkovich/berkovich_cp_element.py b/src/sage/schemes/berkovich/berkovich_cp_element.py
index 4611d396fce..bc8307f29e5 100644
--- a/src/sage/schemes/berkovich/berkovich_cp_element.py
+++ b/src/sage/schemes/berkovich/berkovich_cp_element.py
@@ -1,3 +1,4 @@
+# sage.doctest: needs sage.rings.padics
r"""
Elements of Berkovich space.
@@ -62,13 +63,13 @@ class Berkovich_Element_Cp(Berkovich_Element):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: B(2) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: B(2)
Type I point centered at 2 + O(3^20)
::
- sage: B(0, 1) # optional - sage.rings.padics
+ sage: B(0, 1)
Type II point centered at 0 of radius 3^0
"""
@@ -78,8 +79,8 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, space_type=
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(5) # optional - sage.rings.padics
- sage: B(4) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(5)
+ sage: B(4)
Type I point centered at 4 + O(5^20)
"""
from sage.rings.function_field.element import is_FunctionFieldElement
@@ -426,9 +427,9 @@ def _custom_abs(self, x):
::
- sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics
- sage: Q1 = B(9) # optional - sage.rings.padics
- sage: Q1._custom_abs(Q1.center()) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(Qp(3))
+ sage: Q1 = B(9)
+ sage: Q1._custom_abs(Q1.center())
1/9
"""
if self._base_type == 'padic field':
@@ -450,15 +451,15 @@ def center_function(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Projective(5) # optional - sage.rings.padics
- sage: L. = PolynomialRing(Qp(5)) # optional - sage.rings.padics
- sage: T = FractionField(L) # optional - sage.rings.padics
- sage: f = T(1/t) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(5)
+ sage: L. = PolynomialRing(Qp(5))
+ sage: T = FractionField(L)
+ sage: f = T(1/t)
sage: R. = RR[]
sage: Y = FractionField(R)
- sage: g = (40*pi)/x # optional - sage.symbolic
- sage: Q1 = B(f, g) # optional - sage.rings.padics sage.symbolic
- sage: Q1.center_function() # optional - sage.rings.padics sage.symbolic
+ sage: g = (40*pi)/x # needs sage.symbolic
+ sage: Q1 = B(f, g) # needs sage.symbolic
+ sage: Q1.center_function() # needs sage.symbolic
(1 + O(5^20))/((1 + O(5^20))*t)
"""
if self.type_of_point() != 4:
@@ -478,15 +479,15 @@ def radius_function(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Projective(5) # optional - sage.rings.padics
- sage: L. = PolynomialRing(Qp(5)) # optional - sage.rings.padics
- sage: T = FractionField(L) # optional - sage.rings.padics
- sage: f = T(1/t) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(5)
+ sage: L. = PolynomialRing(Qp(5))
+ sage: T = FractionField(L)
+ sage: f = T(1/t)
sage: R. = RR[]
sage: Y = FractionField(R)
- sage: g = (40*pi)/x # optional - sage.symbolic
- sage: Q1 = B(f, g) # optional - sage.rings.padics sage.symbolic
- sage: Q1.radius_function() # optional - sage.rings.padics sage.symbolic
+ sage: g = (40*pi)/x # needs sage.symbolic
+ sage: Q1 = B(f, g) # needs sage.symbolic
+ sage: Q1.radius_function() # needs sage.symbolic
40.0000000000000*pi/x
"""
if self.type_of_point() != 4:
@@ -506,14 +507,14 @@ def precision(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics
- sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # optional - sage.rings.padics
- sage: d.precision() # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(Qp(3))
+ sage: d = B([2, 2, 2], [1.761, 1.123, 1.112])
+ sage: d.precision()
3
TESTS::
- sage: d.precision == d.prec # optional - sage.rings.padics
+ sage: d.precision == d.prec
True
"""
if self._type in [1, 2, 3]:
@@ -537,8 +538,8 @@ def ideal(self):
::
- sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics
- sage: B(0).ideal() # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(3)
+ sage: B(0).ideal()
"""
return self.parent().ideal()
@@ -557,15 +558,15 @@ def power(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = B(1, 9) # optional - sage.rings.padics
- sage: Q1.power() # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: Q1 = B(1, 9)
+ sage: Q1.power()
2
::
- sage: Q2 = B(1, 4) # optional - sage.rings.padics
- sage: Q2.power() # optional - sage.rings.padics
+ sage: Q2 = B(1, 4)
+ sage: Q2.power()
1.26185950714291
"""
if self._type in [1, 4]:
@@ -583,15 +584,15 @@ def radius(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = B(1, 2/5) # optional - sage.rings.padics
- sage: Q1.radius() # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: Q1 = B(1, 2/5)
+ sage: Q1.radius()
0.400000000000000
::
- sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # optional - sage.rings.padics
- sage: d.radius() # optional - sage.rings.padics
+ sage: d = B([2, 2, 2], [1.761, 1.123, 1.112])
+ sage: d.radius()
[1.76100000000000, 1.12300000000000, 1.11200000000000]
"""
if self._type == 4:
@@ -618,38 +619,38 @@ def diameter(self, basepoint=Infinity):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = B(3) # optional - sage.rings.padics
- sage: Q1.diameter() # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: Q1 = B(3)
+ sage: Q1.diameter()
0
::
- sage: Q2 = B(1/2, 9) # optional - sage.rings.padics
- sage: Q2.diameter() # optional - sage.rings.padics
+ sage: Q2 = B(1/2, 9)
+ sage: Q2.diameter()
9.00000000000000
The diameter of a type IV point is the limit of the radii::
- sage: R. = PolynomialRing(Qp(3)) # optional - sage.rings.padics
- sage: f = R(2) # optional - sage.rings.padics
- sage: S. = PolynomialRing(RR) # optional - sage.rings.padics
- sage: S = FractionField(S) # optional - sage.rings.padics
- sage: g = (y+1)/y # optional - sage.rings.padics
- sage: B(f,g).diameter() # optional - sage.rings.padics
+ sage: R. = PolynomialRing(Qp(3))
+ sage: f = R(2)
+ sage: S. = PolynomialRing(RR)
+ sage: S = FractionField(S)
+ sage: g = (y+1)/y
+ sage: B(f,g).diameter()
1.0
::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = B(1/81, 1) # optional - sage.rings.padics
- sage: Q2 = B(1/3) # optional - sage.rings.padics
- sage: Q1.diameter(Q2) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: Q1 = B(1/81, 1)
+ sage: Q2 = B(1/3)
+ sage: Q1.diameter(Q2)
0.00137174211248285
::
- sage: Q2.diameter(Q2) # optional - sage.rings.padics
+ sage: Q2.diameter(Q2)
+infinity
"""
if basepoint == Infinity:
@@ -693,21 +694,21 @@ def path_distance_metric(self, other):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = B(1/4, 4) # optional - sage.rings.padics
- sage: Q2 = B(1/4, 6) # optional - sage.rings.padics
- sage: Q1.path_distance_metric(Q2) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: Q1 = B(1/4, 4)
+ sage: Q2 = B(1/4, 6)
+ sage: Q1.path_distance_metric(Q2)
0.369070246428542
::
- sage: Q3 = B(1) # optional - sage.rings.padics
- sage: Q3.path_distance_metric(Q1) # optional - sage.rings.padics
+ sage: Q3 = B(1)
+ sage: Q3.path_distance_metric(Q1)
+infinity
::
- sage: Q3.path_distance_metric(Q3) # optional - sage.rings.padics
+ sage: Q3.path_distance_metric(Q3)
0
"""
if not isinstance(other, type(self)):
@@ -744,20 +745,20 @@ def Hsia_kernel(self, other, basepoint):
EXAMPLES::
- sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics
- sage: Q1 = B(2, 9) # optional - sage.rings.padics
- sage: Q2 = B(1/27, 1/27) # optional - sage.rings.padics
- sage: Q3 = B(1, 1/3) # optional - sage.rings.padics
- sage: Q1.Hsia_kernel(Q2, Q3) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(3)
+ sage: Q1 = B(2, 9)
+ sage: Q2 = B(1/27, 1/27)
+ sage: Q3 = B(1, 1/3)
+ sage: Q1.Hsia_kernel(Q2, Q3)
0.111111111111111
::
- sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics
- sage: Q1 = B(2, 9) # optional - sage.rings.padics
- sage: Q2 = B(1/2) # optional - sage.rings.padics
- sage: Q3 = B(1/2) # optional - sage.rings.padics
- sage: Q1.Hsia_kernel(Q2, Q3) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(3)
+ sage: Q1 = B(2, 9)
+ sage: Q2 = B(1/2)
+ sage: Q3 = B(1/2)
+ sage: Q1.Hsia_kernel(Q2, Q3)
+infinity
"""
@@ -790,10 +791,10 @@ def small_metric(self, other):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = B(1/4, 4) # optional - sage.rings.padics
- sage: Q2 = B(1/4, 6) # optional - sage.rings.padics
- sage: Q1.small_metric(Q2) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: Q1 = B(1/4, 4)
+ sage: Q2 = B(1/4, 6)
+ sage: Q1.small_metric(Q2)
0.0833333333333333
::
@@ -853,20 +854,20 @@ def potential_kernel(self, other, basepoint):
EXAMPLES::
- sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics
- sage: Q1 = B(27, 1) # optional - sage.rings.padics
- sage: Q2 = B(1/3, 2) # optional - sage.rings.padics
- sage: Q3 = B(1/9, 1/2) # optional - sage.rings.padics
- sage: Q3.potential_kernel(Q1, Q2) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(3)
+ sage: Q1 = B(27, 1)
+ sage: Q2 = B(1/3, 2)
+ sage: Q3 = B(1/9, 1/2)
+ sage: Q3.potential_kernel(Q1, Q2)
0.369070246428543
::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = B(27, 1) # optional - sage.rings.padics
- sage: Q2 = B(1/3, 2) # optional - sage.rings.padics
- sage: Q3 = B(1/9, 1/2) # optional - sage.rings.padics
- sage: Q3.potential_kernel(Q1, Q2) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: Q1 = B(27, 1)
+ sage: Q2 = B(1/3, 2)
+ sage: Q3 = B(1/9, 1/2)
+ sage: Q3.potential_kernel(Q1, Q2)
0.369070246428543
"""
if not isinstance(other, type(self)):
@@ -895,16 +896,16 @@ def spherical_kernel(self, other):
EXAMPLES::
- sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics
- sage: Q1 = B(2, 2) # optional - sage.rings.padics
- sage: Q2 = B(1/9, 1) # optional - sage.rings.padics
- sage: Q1.spherical_kernel(Q2) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(3)
+ sage: Q1 = B(2, 2)
+ sage: Q2 = B(1/9, 1)
+ sage: Q1.spherical_kernel(Q2)
0.500000000000000
::
- sage: Q3 = B(2) # optional - sage.rings.padics
- sage: Q3.spherical_kernel(Q3) # optional - sage.rings.padics
+ sage: Q3 = B(2)
+ sage: Q3.spherical_kernel(Q3)
0
"""
if not isinstance(other, type(self)):
@@ -933,21 +934,22 @@ def Hsia_kernel_infinity(self, other):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics
- sage: Q1 = B(1/4, 4) # optional - sage.rings.padics
- sage: Q2 = B(1/4, 6) # optional - sage.rings.padics
- sage: Q1.Hsia_kernel_infinity(Q2) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(Qp(3))
+ sage: Q1 = B(1/4, 4)
+ sage: Q2 = B(1/4, 6)
+ sage: Q1.Hsia_kernel_infinity(Q2)
6.00000000000000
::
+ sage: # needs sage.rings.number_field
sage: R. = QQ[]
- sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field
- sage: ideal = A.ideal(-1/2*a^2 + a - 3) # optional - sage.rings.number_field
- sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field
- sage: Q1 = B(4) # optional - sage.rings.number_field
- sage: Q2 = B(0, 1.5) # optional - sage.rings.number_field
- sage: Q1.Hsia_kernel_infinity(Q2) # optional - sage.rings.number_field
+ sage: A. = NumberField(x^3 + 20)
+ sage: ideal = A.ideal(-1/2*a^2 + a - 3)
+ sage: B = Berkovich_Cp_Projective(A, ideal)
+ sage: Q1 = B(4)
+ sage: Q2 = B(0, 1.5)
+ sage: Q1.Hsia_kernel_infinity(Q2)
1.50000000000000
"""
return self.join(other).diameter()
@@ -961,23 +963,24 @@ def center(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: B(3, 1).center() # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: B(3, 1).center()
3 + O(3^21)
::
- sage: C = Berkovich_Cp_Projective(3) # optional - sage.rings.padics
- sage: C(3, 1).center() # optional - sage.rings.padics
+ sage: C = Berkovich_Cp_Projective(3)
+ sage: C(3, 1).center()
(3 + O(3^21) : 1 + O(3^20))
::
+ sage: # needs sage.rings.number_field
sage: R. = QQ[]
- sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field
- sage: ideal = A.ideal(-1/2*a^2 + a - 3) # optional - sage.rings.number_field
- sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field
- sage: B(a^2 + 4).center() # optional - sage.rings.number_field
+ sage: A. = NumberField(x^3 + 20)
+ sage: ideal = A.ideal(-1/2*a^2 + a - 3)
+ sage: B = Berkovich_Cp_Projective(A, ideal)
+ sage: B(a^2 + 4).center()
(a^2 + 4 : 1)
"""
if self._type == 4:
@@ -992,13 +995,13 @@ def type_of_point(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: B(1).type_of_point() # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: B(1).type_of_point()
1
::
- sage: B(0, 1).type_of_point() # optional - sage.rings.padics
+ sage: B(0, 1).type_of_point()
2
"""
return ZZ(self._type)
@@ -1011,8 +1014,8 @@ def prime(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: B(1).prime() # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: B(1).prime()
3
"""
return ZZ(self._p)
@@ -1023,10 +1026,11 @@ def __ne__(self, other):
EXAMPLES::
- sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = B(3, 3**(1/2)) # optional - sage.rings.padics sage.symbolic
- sage: Q2 = B(3, RR(3**(1/2))) # optional - sage.rings.padics sage.symbolic
- sage: Q1 != Q2 # optional - sage.rings.padics sage.symbolic
+ sage: # needs sage.symbolic
+ sage: B = Berkovich_Cp_Affine(3)
+ sage: Q1 = B(3, 3**(1/2))
+ sage: Q2 = B(3, RR(3**(1/2)))
+ sage: Q1 != Q2
False
"""
return not (self == other)
@@ -1037,8 +1041,8 @@ def _repr_(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics
- sage: B(2, 1) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(3)
+ sage: B(2, 1)
Type II point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 3^0
"""
if self._type == 1:
@@ -1067,8 +1071,8 @@ def _latex_(self):
EXAMPLES::
- sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics
- sage: latex(B(2, 1)) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Projective(3)
+ sage: latex(B(2, 1))
\text{type 2 Point of } \text{Projective Berkovich line over }
\Bold{C}_{3} \text{equivalent to the disk centered at
(2 + O(3^20) : 1 + O(3^20)) of radius 1.00000000000000 in } \Bold{C}_3
@@ -1132,122 +1136,113 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp):
Type I points can be created by specifying the corresponding point of ``Cp``::
- sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics
- sage: B(4) # optional - sage.rings.padics
+ sage: B = Berkovich_Cp_Affine(Qp(3))
+ sage: B(4)
Type I point centered at 1 + 3 + O(3^20)
The center of a point can be an element of a finite extension of ``Qp``::
- sage: A. = Qq(27) # optional - sage.rings.padics
- sage: B(1 + t) # optional - sage.rings.padics
+ sage: A. = Qq(27)
+ sage: B(1 + t)
Type I point centered at (t + 1) + O(3^20)
Type II and III points can be created by specifying a center and a radius::
- sage: B(2, 3**(1/2)) # optional - sage.rings.padics sage.symbolic
+ sage: B(2, 3**(1/2)) # needs sage.symbolic
Type II point centered at 2 + O(3^20) of radius 3^1/2
::
- sage: B(2, 1.6) # optional - sage.rings.padics
+ sage: B(2, 1.6)
Type III point centered at 2 + O(3^20) of radius 1.60000000000000
Some type II points may be mistaken for type III points::
- sage: B(3, 3**0.5) #not tested # optional - sage.rings.padics
+ sage: B(3, 3**0.5) # not tested
Type III point centered at 3 + O(3^21) of radius 1.73205080756888
To avoid these errors, specify the power instead of the radius::
- sage: B(3, power=RR(1/100000)) # optional - sage.rings.padics
+ sage: B(3, power=RR(1/100000))
Type II point centered at 3 + O(3^21) of radius 3^1/100000
Type IV points can be constructed in a number of ways, the first being
from a list of centers and radii used to approximate the point::
- sage: B([Qp(3)(2), Qp(3)(2), Qp(3)(2)], [1.761, 1.123, 1.112]) # optional - sage.rings.padics
+ sage: B([Qp(3)(2), Qp(3)(2), Qp(3)(2)], [1.761, 1.123, 1.112])
Type IV point of precision 3, approximated by disks centered at
[2 + O(3^20), 2 + O(3^20)] ... with radii [1.76100000000000, 1.12300000000000] ...
Type IV points can be constructed from univariate functions, with arbitrary precision::
- sage: A. = Qq(27) # optional - sage.rings.padics
- sage: R. = PolynomialRing(A) # optional - sage.rings.padics
- sage: f = (1 + t)^2*x # optional - sage.rings.padics
- sage: S. = PolynomialRing(RR) # optional - sage.rings.padics
- sage: S = FractionField(S) # optional - sage.rings.padics
- sage: g = (y + 1)/y # optional - sage.rings.padics
- sage: d = B(f, g, prec=100); d # optional - sage.rings.padics
+ sage: A. = Qq(27)
+ sage: R. = PolynomialRing(A)
+ sage: f = (1 + t)^2*x
+ sage: S. = PolynomialRing(RR)
+ sage: S = FractionField(S)
+ sage: g = (y + 1)/y
+ sage: d = B(f, g, prec=100); d
Type IV point of precision 100 with centers given by
((t^2 + 2*t + 1) + O(3^20))*x and radii given by (y + 1.00000000000000)/y
For increased performance, ``error_check`` can be set to ``False``. WARNING: with error check set
to ``False``, any error in the input will lead to incorrect results::
- sage: B(f, g, prec=100, error_check=False) # optional - sage.rings.padics
+ sage: B(f, g, prec=100, error_check=False)
Type IV point of precision 100 with centers given by
((t^2 + 2*t + 1) + O(3^20))*x and radii given by (y + 1.00000000000000)/y
When creating a Berkovich space backed by a number field, points can be created similarly::
+ sage: # needs sage.rings.number_field
sage: R. = QQ[]
- sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field
- sage: ideal = A.prime_above(3) # optional - sage.rings.number_field
- sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field
- sage: Q1 = B(a); Q1 # optional - sage.rings.number_field
+ sage: A. = NumberField(x^3 + 20)
+ sage: ideal = A.prime_above(3)
+ sage: B = Berkovich_Cp_Projective(A, ideal)
+ sage: Q1 = B(a); Q1
Type I point centered at (a : 1)
::
- sage: B(a + 1, 3) # optional - sage.rings.number_field
+ sage: B(a + 1, 3) # needs sage.rings.number_field
Type II point centered at (a + 1 : 1) of radius 3^1
TESTS::
- sage: A = Berkovich_Cp_Affine(3) # optional - sage.rings.padics
- sage: Q1 = A(3, 1); Q1 # optional - sage.rings.padics
+ sage: A = Berkovich_Cp_Affine(3)
+ sage: Q1 = A(3, 1); Q1
Type II point centered at 3 + O(3^21) of radius 3^0
-
- sage: Q2 = A(2.5, 1); Q2 # optional - sage.rings.padics
+ sage: Q2 = A(2.5, 1); Q2
Type II point centered at 1 + 2*3 + 3^2 + 3^3 + 3^4 + 3^5 + 3^6 + 3^7 +
3^8 + 3^9 + 3^10 + 3^11 + 3^12 + 3^13 + 3^14 + 3^15 + 3^16 + 3^17 +
3^18 + 3^19 + O(3^20) of radius 3^0
-
- sage: Q5 = A(3, 0); Q5 # optional - sage.rings.padics
+ sage: Q5 = A(3, 0); Q5
Type I point centered at 3 + O(3^21)
-
- sage: A(Zp(3)(2), 2).center().parent() == A(Qp(3)(2), 2).center().parent() # optional - sage.rings.padics
+ sage: A(Zp(3)(2), 2).center().parent() == A(Qp(3)(2), 2).center().parent()
True
-
- sage: Q1 == Q2 # optional - sage.rings.padics
+ sage: Q1 == Q2
True
-
- sage: Q1 == Q5 # optional - sage.rings.padics
+ sage: Q1 == Q5
False
-
- sage: Q3 = A(Qp(3)(3), power=0, error_check=False); Q3 # optional - sage.rings.padics
+ sage: Q3 = A(Qp(3)(3), power=0, error_check=False); Q3
Type II point centered at 3 + O(3^21) of radius 3^0
-
- sage: Q4 = A(3, 3**0); Q4 # optional - sage.rings.padics
+ sage: Q4 = A(3, 3**0); Q4
Type II point centered at 3 + O(3^21) of radius 3^0
-
- sage: Q5 = A(3, power=1/2); Q5 # optional - sage.rings.padics
+ sage: Q5 = A(3, power=1/2); Q5
Type II point centered at 3 + O(3^21) of radius 3^1/2
-
- sage: Q6 = A(3, RR(3**(1/2))); Q6 # optional - sage.rings.padics sage.symbolic
+ sage: Q6 = A(3, RR(3**(1/2))); Q6 # needs sage.symbolic
Type III point centered at 3 + O(3^21) of radius 1.73205080756888
-
- sage: Q5 == Q6 # optional - sage.rings.padics sage.symbolic
+ sage: Q5 == Q6 # needs sage.symbolic
True
- sage: k = Qp(5) # optional - sage.rings.padics
- sage: R. = k[] # optional - sage.rings.padics
- sage: l. = k.extension(x^2 - 5) # optional - sage.rings.padics
- sage: B = Berkovich_Cp_Affine(5) # optional - sage.rings.padics
- sage: B(w, power=1) # optional - sage.rings.padics
+ sage: k = Qp(5)
+ sage: R.