From 636af13e3d0033e944f4afc3f8ab665d2f6f87d1 Mon Sep 17 00:00:00 2001 From: Lorenz Panny Date: Wed, 30 Nov 2022 16:22:38 +0800 Subject: [PATCH] fix some more doctest failures --- src/sage/modular/dirichlet.py | 1 + src/sage/rings/number_field/bdd_height.py | 3 +-- src/sage/rings/padics/padic_valuation.py | 2 +- src/sage/rings/polynomial/polynomial_element.pyx | 7 +++++-- src/sage/schemes/elliptic_curves/heegner.py | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/sage/modular/dirichlet.py b/src/sage/modular/dirichlet.py index 491664102a8..5e4ce2cdce1 100644 --- a/src/sage/modular/dirichlet.py +++ b/src/sage/modular/dirichlet.py @@ -2339,6 +2339,7 @@ class DirichletGroupFactory(UniqueFactory): sage: parent(val) Gaussian Integers in Cyclotomic Field of order 4 and degree 2 sage: r4.residue_field(r4.ideal(29).factor()[0][0])(val) + doctest:warning ... DeprecationWarning: ... 17 sage: r4.residue_field(r4.ideal(29).factor()[0][0])(val) * GF(29)(3) 22 diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py index beb047ae026..f3972a7552f 100644 --- a/src/sage/rings/number_field/bdd_height.py +++ b/src/sage/rings/number_field/bdd_height.py @@ -430,7 +430,6 @@ def bdd_height(K, height_bound, tolerance=1e-2, precision=53): if B < 1: return embeddings = K.places(prec=precision) - O_K = K.ring_of_integers() r1, r2 = K.signature() r = r1 + r2 - 1 RF = RealField(precision) @@ -486,7 +485,7 @@ def log_height_for_generators_approx(alpha, beta, Lambda): Return a lambda approximation h_K(alpha/beta) """ delta = Lambda / (r + 2) - norm_log = delta_approximation(RR(O_K.ideal(alpha, beta).norm()).log(), delta) + norm_log = delta_approximation(RR(K.ideal(alpha, beta).norm()).log(), delta) log_ga = vector_delta_approximation(log_map(alpha), delta) log_gb = vector_delta_approximation(log_map(beta), delta) arch_sum = sum([max(log_ga[k], log_gb[k]) for k in range(r + 1)]) diff --git a/src/sage/rings/padics/padic_valuation.py b/src/sage/rings/padics/padic_valuation.py index 883e36f5c96..faaff67aa9d 100644 --- a/src/sage/rings/padics/padic_valuation.py +++ b/src/sage/rings/padics/padic_valuation.py @@ -283,7 +283,7 @@ def create_key_and_extra_args_for_number_field_from_ideal(self, R, I, prime): EXAMPLES:: - sage: GaussianIntegers().valuation(GaussianIntegers().ideal(2)) # indirect doctest + sage: GaussianIntegers().valuation(GaussianIntegers().number_field().fractional_ideal(2)) # indirect doctest 2-adic valuation TESTS: diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index dc915077cf2..b1589f283a3 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -134,7 +134,7 @@ from sage.categories.morphism cimport Morphism from sage.misc.superseded import deprecation_cython as deprecation, deprecated_function_alias from sage.misc.cachefunc import cached_method -from sage.rings.number_field.order import is_NumberFieldOrder +from sage.rings.number_field.order import is_NumberFieldOrder, Order as NumberFieldOrder from sage.categories.number_fields import NumberFields @@ -5104,8 +5104,11 @@ cdef class Polynomial(CommutativeAlgebraElement): y = self._parent.quo(self).gen() from sage.groups.generic import order_from_multiple return n == order_from_multiple(y, n, n_prime_divs, operation="*") + elif isinstance(R, NumberFieldOrder): + K = R.number_field() + return K.fractional_ideal(self.coefficients()) == K.fractional_ideal(1) else: - return R.ideal(self.coefficients())==R.ideal(1) + return R.ideal(self.coefficients()) == R.ideal(1) def is_constant(self): """ diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index 298f44fedc6..54c2f5ca1f7 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -1657,7 +1657,7 @@ def ideal(self): (A,B,C) = f if A%c == 0: A, C = C, A - return K.maximal_order().ideal([A, (-B+c*sqrtD)/2]) + return K.fractional_ideal([A, (-B+c*sqrtD)/2]) ## def __call__(self, z): ## """