diff --git a/.gitignore b/.gitignore index 2faf325a44c..cdb9c373c37 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ /config.status /configure /conftest* +/confdefs.h /m4/sage_spkg_configures.m4 diff --git a/.zenodo.json b/.zenodo.json index 165f5ccb2d1..91f308b7b75 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,10 +1,10 @@ { "description": "Mirror of the Sage https://sagemath.org/ source tree", "license": "other-open", - "title": "sagemath/sage: 10.0.beta2", - "version": "10.0.beta2", + "title": "sagemath/sage: 10.0.beta3", + "version": "10.0.beta3", "upload_type": "software", - "publication_date": "2023-02-23", + "publication_date": "2023-03-02", "creators": [ { "affiliation": "SageMath.org", @@ -15,7 +15,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "https://github.com/sagemath/sage/tree/10.0.beta2", + "identifier": "https://github.com/sagemath/sage/tree/10.0.beta3", "relation": "isSupplementTo" }, { diff --git a/VERSION.txt b/VERSION.txt index ef59effc672..d3cf4ce44c4 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 10.0.beta2, Release Date: 2023-02-23 +SageMath version 10.0.beta3, Release Date: 2023-03-02 diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index ea09e0a4167..c08ada17ba4 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=a9dd38e83511f7f7911c94366c1c7b9e213cea3e -md5=e341828a3c4d17b37887cd93c298286f -cksum=2811082803 +sha1=b9a6c30f4f1c828ca611527d104643d8c0b89ed9 +md5=37a7a99a528efa8a4eea1beff33985db +cksum=1112286999 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index 96ad398eab6..82496e60715 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -bbd91d34c346cbb308e6bfac72ac414b365f190c +a822a2132aa0e85069ec8b6efa48ad6db08cc044 diff --git a/build/pkgs/giac/checksums.ini b/build/pkgs/giac/checksums.ini index 2fb1d3fdf31..089c15f34b4 100644 --- a/build/pkgs/giac/checksums.ini +++ b/build/pkgs/giac/checksums.ini @@ -2,4 +2,3 @@ tarball=giac-VERSION.tar.bz2 sha1=78c15badd19b49b7d111ac204b611a4378ce3d15 md5=8fbd43a5c60848b6813b7fc8698a0199 cksum=1923149665 -upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31563/giac-VERSION.tar.bz2 diff --git a/build/pkgs/iml/checksums.ini b/build/pkgs/iml/checksums.ini index d876ccb5b53..628d5461e70 100644 --- a/build/pkgs/iml/checksums.ini +++ b/build/pkgs/iml/checksums.ini @@ -2,4 +2,3 @@ tarball=iml-VERSION.tar.bz2 sha1=8aba468a62e6fb0584be9b014350b734663c0670 md5=a8083e70c0c4378f69eb772c1eeed6f0 cksum=2793221462 -upstream_url=https://trac.sagemath.org/raw-attachment/ticket/33195/iml-1.0.4p2.tar.bz2 diff --git a/build/pkgs/mathjax/checksums.ini b/build/pkgs/mathjax/checksums.ini index 76e362f6b28..6a6b233b2ae 100644 --- a/build/pkgs/mathjax/checksums.ini +++ b/build/pkgs/mathjax/checksums.ini @@ -2,4 +2,3 @@ tarball=mathjax-VERSION.tar.gz sha1=3f7abecf8cacd7f5d7f9ae6c3baca7739101c17d md5=ba1a65ab58aaad6c84f39735c619bc34 cksum=1142131398 -upstream_url=https://trac.sagemath.org/raw-attachment/ticket/25833/mathjax-3.2.0.tar.gz diff --git a/build/pkgs/msolve/checksums.ini b/build/pkgs/msolve/checksums.ini index 0b7558afd2b..e357a86bae4 100644 --- a/build/pkgs/msolve/checksums.ini +++ b/build/pkgs/msolve/checksums.ini @@ -2,4 +2,3 @@ tarball=msolve-VERSION.tar.gz sha1=5b227de8b222bfe8d143e1d7ea77ad71cd209dc8 md5=2f34bd9ccb089688ae169201281108dc cksum=941373315 -upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31664/msolve-VERSION.tar.gz diff --git a/build/pkgs/sage_conf/install-requires.txt b/build/pkgs/sage_conf/install-requires.txt index 460c9d389f2..c1acbf5a6b3 100644 --- a/build/pkgs/sage_conf/install-requires.txt +++ b/build/pkgs/sage_conf/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-conf ~= 10.0b2 +sage-conf ~= 10.0b3 diff --git a/build/pkgs/sage_docbuild/install-requires.txt b/build/pkgs/sage_docbuild/install-requires.txt index f7a958d2a26..4c0503af358 100644 --- a/build/pkgs/sage_docbuild/install-requires.txt +++ b/build/pkgs/sage_docbuild/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-docbuild ~= 10.0b2 +sage-docbuild ~= 10.0b3 diff --git a/build/pkgs/sage_setup/install-requires.txt b/build/pkgs/sage_setup/install-requires.txt index 4fe90492ae9..be67a744301 100644 --- a/build/pkgs/sage_setup/install-requires.txt +++ b/build/pkgs/sage_setup/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-setup ~= 10.0b2 +sage-setup ~= 10.0b3 diff --git a/build/pkgs/sage_sws2rst/install-requires.txt b/build/pkgs/sage_sws2rst/install-requires.txt index 2c538e2d974..b30f48ea38a 100644 --- a/build/pkgs/sage_sws2rst/install-requires.txt +++ b/build/pkgs/sage_sws2rst/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-sws2rst ~= 10.0b2 +sage-sws2rst ~= 10.0b3 diff --git a/build/pkgs/sagelib/install-requires.txt b/build/pkgs/sagelib/install-requires.txt index 1992637fb55..70aefd13369 100644 --- a/build/pkgs/sagelib/install-requires.txt +++ b/build/pkgs/sagelib/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagelib ~= 10.0b2 +sagelib ~= 10.0b3 diff --git a/build/pkgs/sagemath_categories/install-requires.txt b/build/pkgs/sagemath_categories/install-requires.txt index 02b1c5bbdb2..31553eaef51 100644 --- a/build/pkgs/sagemath_categories/install-requires.txt +++ b/build/pkgs/sagemath_categories/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-categories ~= 10.0b2 +sagemath-categories ~= 10.0b3 diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index 6c258939a07..bcd541eea0b 100644 --- a/build/pkgs/sagemath_environment/install-requires.txt +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-environment ~= 10.0b2 +sagemath-environment ~= 10.0b3 diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index 0ecdca99435..1da2fc997e0 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-objects ~= 10.0b2 +sagemath-objects ~= 10.0b3 diff --git a/build/pkgs/sagemath_repl/install-requires.txt b/build/pkgs/sagemath_repl/install-requires.txt index d0525ea50ea..798c25aee10 100644 --- a/build/pkgs/sagemath_repl/install-requires.txt +++ b/build/pkgs/sagemath_repl/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-repl ~= 10.0b2 +sagemath-repl ~= 10.0b3 diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/src/VERSION.txt b/src/VERSION.txt index a29f7140ff6..b3001ec9281 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -10.0.beta2 +10.0.beta3 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index 4d2a5124035..9aab0c0fcc8 100644 --- a/src/bin/sage-version.sh +++ b/src/bin/sage-version.sh @@ -4,6 +4,6 @@ # which stops "setup.py develop" from rewriting it as a Python file. : # This file is auto-generated by the sage-update-version script, do not edit! -SAGE_VERSION='10.0.beta2' -SAGE_RELEASE_DATE='2023-02-23' -SAGE_VERSION_BANNER='SageMath version 10.0.beta2, Release Date: 2023-02-23' +SAGE_VERSION='10.0.beta3' +SAGE_RELEASE_DATE='2023-03-02' +SAGE_VERSION_BANNER='SageMath version 10.0.beta3, Release Date: 2023-03-02' diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index dde11dc4ee4..19d4f7c95fa 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -803,6 +803,10 @@ REFERENCES: Stein. strassen_window_multiply_c. strassen.pyx, Sage 3.0, 2008. http://www.sagemath.org +.. [BrHu2019] Petter Brändén, June Huh. *Lorentzian polynomials*. + Ann. Math. (2) 192, No. 3, 821-891 (2020). + :arxiv:`1902.03719`, :doi:`10.4007/annals.2020.192.3.4`. + .. [BHNR2004] \S. Brlek, S. Hamel, M. Nivat, C. Reutenauer, On the Palindromic Complexity of Infinite Words, in J. Berstel, J. Karhumaki, D. Perrin, Eds, @@ -3257,6 +3261,11 @@ REFERENCES: Designs, Codes and Cryptography 8 (1996) 145-157. :doi:`10.1023/A:1018037025910`. +.. [HMMS2019] June Huh, Jacob P. Matherne, Karola Mészáros, Avery St. Dizier. + *Logarithmic concavity of Schur and related polynomials*. + Trans. Am. Math. Soc. 375, No. 6, 4411-4427 (2022). + :arxiv:`1906.09633`, :doi:`10.1090/tran/8606`. + .. [Hutz2007] \B. Hutz. Arithmetic Dynamics on Varieties of dimension greater than one. PhD Thesis, Brown University 2007 diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py index a7e45c3c294..6dd359d9e36 100644 --- a/src/sage/interfaces/tachyon.py +++ b/src/sage/interfaces/tachyon.py @@ -683,12 +683,14 @@ #***************************************************************************** import os +import re from sage.cpython.string import bytes_to_str from sage.misc.pager import pager from sage.misc.superseded import deprecation from sage.misc.temporary_file import tmp_filename from sage.structure.sage_object import SageObject +from sage.misc.cachefunc import cached_method class TachyonRT(SageObject): @@ -799,6 +801,11 @@ def __call__(self, model, outfile='sage.png', verbose=1, extra_opts=''): Parser failed due to an input file syntax error. Aborting render. """ + if self.version() >= '0.99.2': + # this keyword was changed in 0.99.2 + model = model.replace( + " focallength ", + " focaldist ") modelfile = tmp_filename(ext='.dat') with open(modelfile, 'w') as file: file.write(model) @@ -851,6 +858,25 @@ def usage(self, use_pager=True): else: print(r) + @cached_method + def version(self): + """ + Returns the version of the Tachyon raytracer being used. + + TESTS:: + + sage: tachyon_rt.version() # random + 0.98.9 + sage: tachyon_rt.version() >= '0.98.9' + True + """ + with os.popen('tachyon') as f: + r = f.readline() + res = re.search(r"Version ([\d.]*)", r) + # debian patches tachyon so it won't report the version + # we hardcode '0.99' since that's indeed the version they ship + return res[1] if res else '0.99' + def help(self, use_pager=True): """ Deprecated: type 'sage.interfaces.tachyon?' for help diff --git a/src/sage/modular/quasimodform/element.py b/src/sage/modular/quasimodform/element.py index e8e2e7909d0..24a6b7ebfad 100644 --- a/src/sage/modular/quasimodform/element.py +++ b/src/sage/modular/quasimodform/element.py @@ -24,6 +24,7 @@ from sage.structure.element import ModuleElement from sage.structure.richcmp import richcmp, op_NE, op_EQ +from sage.rings.integer import Integer from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.integer_ring import ZZ @@ -506,7 +507,8 @@ def weight(self): r""" Return the weight of the given quasimodular form. - Note that the given form must be homogeneous. + Note that the given form must be homogeneous. An alias of this method is + ``degree``. EXAMPLES:: @@ -517,6 +519,8 @@ def weight(self): 6 sage: QM(1/2).weight() 0 + sage: (QM.0).degree() + 2 sage: (QM.0 + QM.1).weight() Traceback (most recent call last): ... @@ -529,6 +533,8 @@ def weight(self): raise ValueError("the given graded quasiform is not an homogeneous \ element") + degree = weight # alias + def homogeneous_components(self): r""" Return a dictionary where the values are the homogeneous components of @@ -574,6 +580,49 @@ def homogeneous_components(self): components[ZZ(k + 2*i)] = QM(forms[k]*(E2**i)) return components + def __getitem__(self, weight): + r""" + Return the homogeneous component of the given quasimodular form ring + element. + + An alias of this method is ``homogeneous_component``. + + EXAMPLES:: + + sage: QM = QuasiModularForms(1) + sage: E2, E4, E6 = QM.gens() + sage: F = E2 + E4*E6 + E2^3*E6 + sage: F[2] + 1 - 24*q - 72*q^2 - 96*q^3 - 168*q^4 - 144*q^5 + O(q^6) + sage: F[10] + 1 - 264*q - 135432*q^2 - 5196576*q^3 - 69341448*q^4 - 515625264*q^5 + O(q^6) + sage: F[12] + 1 - 576*q + 21168*q^2 + 308736*q^3 - 15034608*q^4 - 39208320*q^5 + O(q^6) + sage: F[4] + 0 + sage: F.homogeneous_component(2) + 1 - 24*q - 72*q^2 - 96*q^3 - 168*q^4 - 144*q^5 + O(q^6) + + TESTS:: + + sage: F[x] + Traceback (most recent call last): + ... + KeyError: 'the weight must be an integer' + sage: F[-1] + Traceback (most recent call last): + ... + ValueError: the weight must be nonnegative + """ + if not isinstance(weight, (int, Integer)): + raise KeyError("the weight must be an integer") + if weight < 0: + raise ValueError("the weight must be nonnegative") + return self.homogeneous_components().get(weight, self.parent().zero()) + + homogeneous_component = __getitem__ # alias + + def serre_derivative(self): r""" Return the Serre derivative of the given quasimodular form. diff --git a/src/sage/quadratic_forms/quadratic_form.py b/src/sage/quadratic_forms/quadratic_form.py index c4e97d97c50..f53602f49f3 100644 --- a/src/sage/quadratic_forms/quadratic_form.py +++ b/src/sage/quadratic_forms/quadratic_form.py @@ -30,13 +30,15 @@ from sage.arith.all import GCD, LCM from sage.rings.all import Ideal, QQ from sage.rings.ring import is_Ring, PrincipalIdealDomain -from sage.structure.sage_object import SageObject from sage.structure.element import is_Vector from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.rings.polynomial.polynomial_element import is_Polynomial +from sage.rings.polynomial.multi_polynomial_element import is_MPolynomial from sage.modules.free_module_element import vector from sage.quadratic_forms.genera.genus import genera from sage.quadratic_forms.quadratic_form__evaluate import QFEvaluateVector, QFEvaluateMatrix - +from sage.structure.sage_object import SageObject +from sage.combinat.integer_lists.invlex import IntegerListsLex def QuadraticForm__constructor(R, n=None, entries=None): """ @@ -206,6 +208,10 @@ class QuadraticForm(SageObject): in `R` (given lexicographically, or equivalently, by rows of the matrix) + #. ``QuadraticForm(p)``, where + + - `p` -- a homogeneous polynomial of degree `2` + #. ``QuadraticForm(R, n)``, where - `R` -- a ring @@ -284,6 +290,16 @@ class QuadraticForm(SageObject): [ 1 5 ] [ * 4 ] + :: + + sage: P. = QQ[] + sage: p = x^2 + 2*x*y + x*z/2 + y^2 + y*z/3 + sage: QuadraticForm(p) + Quadratic form in 3 variables over Rational Field with coefficients: + [ 1 2 1/2 ] + [ * 1 1/3 ] + [ * * 0 ] + :: sage: QuadraticForm(ZZ, m + m.transpose()) @@ -499,6 +515,25 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ sage: s.dim() 4 + sage: P. = QQ[] + sage: p = x^2 + y^2 + 2*x*z + sage: QuadraticForm(p) + Quadratic form in 3 variables over Rational Field with coefficients: + [ 1 0 2 ] + [ * 1 0 ] + [ * * 0 ] + sage: z = P.zero() + sage: QuadraticForm(z) + Quadratic form in 3 variables over Rational Field with coefficients: + [ 0 0 0 ] + [ * 0 0 ] + [ * * 0 ] + sage: q = x^2 + 3*y - z + sage: QuadraticForm(q) + Traceback (most recent call last): + ... + ValueError: polynomial is neither zero nor homogeneous of degree 2 + TESTS:: sage: s == loads(dumps(s)) @@ -510,6 +545,10 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ sage: x = polygen(ZZ, 'x') sage: QuadraticForm(x**2) + Quadratic form in 1 variables over Integer Ring with coefficients: + [ 1 ] + + sage: QuadraticForm(1) Traceback (most recent call last): .... TypeError: wrong input for QuadraticForm @@ -527,20 +566,39 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ M_ring = R matrix_init_flag = True - elif not is_Matrix(R): - # first argument, if not a ring, must be a matrix - raise TypeError('wrong input for QuadraticForm') - else: - # Deal with: QuadraticForm(matrix) + elif is_Matrix(R): + M = R + # Test if R is symmetric and has even diagonal - if not self._is_even_symmetric_matrix_(R): + if not self._is_even_symmetric_matrix_(M): raise TypeError("the matrix is not a symmetric with even diagonal") - # Rename the matrix and ring - M = R - M_ring = R.base_ring() + M_ring = M.base_ring() matrix_init_flag = True + elif is_Polynomial(R) or is_MPolynomial(R): + p = R + + if not p.is_zero() and not (p.is_homogeneous() and p.degree() == 2): + raise ValueError("polynomial is neither zero nor homogeneous of degree 2") + + P = p.parent() + R, n = P.base_ring(), P.ngens() + + # Extract quadratic form coefficients + entries = [] + if n == 0: + exponents = [] + elif n == 1: + exponents = [2] + else: + exponents = IntegerListsLex(2, length=n) + for alpha in exponents: + entries.append(p[alpha]) + + else: + raise TypeError('wrong input for QuadraticForm') + # Perform the quadratic form initialization if matrix_init_flag: self.__n = ZZ(M.nrows()) diff --git a/src/sage/rings/polynomial/multi_polynomial.pyx b/src/sage/rings/polynomial/multi_polynomial.pyx index 7bb03631661..4f8e47049a2 100644 --- a/src/sage/rings/polynomial/multi_polynomial.pyx +++ b/src/sage/rings/polynomial/multi_polynomial.pyx @@ -14,6 +14,8 @@ from sage.rings.integer cimport Integer from sage.rings.integer_ring import ZZ from sage.structure.coerce cimport coercion_model from sage.misc.derivative import multi_derivative +from sage.combinat.integer_lists.invlex import IntegerListsLex +from itertools import chain, islice from sage.misc.misc_c import prod @@ -25,7 +27,7 @@ from sage.categories.map cimport Map from sage.modules.free_module_element import vector from sage.rings.rational_field import QQ from sage.rings.complex_interval_field import ComplexIntervalField -from sage.rings.real_mpfr import RealField_class,RealField +from sage.rings.real_mpfr import RealField_class, RealField from sage.rings.polynomial.polydict cimport ETuple from sage.rings.polynomial.polynomial_element cimport Polynomial @@ -2613,6 +2615,236 @@ cdef class MPolynomial(CommutativeRingElement): with tester.assertRaises((ValueError, TypeError)): self.subs(**d) + def is_lorentzian(self, explain=False): + r""" + Return whether this is a Lorentzian polynomial. + + INPUT: + + - ``explain`` -- boolean (default: ``False``); if ``True`` + return a tuple whose first element is the boolean result of the test, + and the second element is a string describing the reason the test failed, + or ``None`` if the test succeeded. + + Lorentzian polynomials are a class of polynomials connected with the area + of discrete convex analysis. A polynomial `f` with positive real coefficients + is Lorentzian if: + + - `f` is homogeneous; + + - the support of `f` is `M`-convex + + - `f` has degree less than `2`, or if its degree is at least two, + the collection of sequential partial derivatives of `f` which are + quadratic forms have Gram matrices with at most one positive eigenvalue. + + Note in particular that the zero polynomial is Lorentzian. Examples of + Lorentzian polynomials include homogeneous stable polynomials, volume + polynomials of convex bodies and projective varieties, and Schur polynomials + after renormalizing the coefficient of each monomial `x^\alpha` by `1/\alpha!`. + + EXAMPLES: + + Renormalized Schur polynomials are Lorentzian, but not in general if the + renormalization is skipped:: + + sage: P. = QQ[] + sage: p = (x^2 / 2) + x*y + (y^2 / 2) + sage: p.is_lorentzian() + True + sage: p = x^2 + x*y + y^2 + sage: p.is_lorentzian() + False + + Homogeneous linear forms and constant polynomials with positive + coefficients are Lorentzian, as well as the zero polynomial:: + + sage: p = x + 2*y + sage: p.is_lorentzian() + True + sage: p = P(5) + sage: p.is_lorentzian() + True + sage: P.zero().is_lorentzian() + True + + Inhomogeneous polynomials and polynomials with negative coefficients + are not Lorentzian:: + + sage: p = x^2 + 2*x + y^2 + sage: p.is_lorentzian() + False + sage: p = 2*x^2 - y^2 + sage: p.is_lorentzian() + False + + It is an error to check if a polynomial is Lorentzian if its base ring + is not a subring of the real numbers, as the notion is not defined in + this case:: + + sage: Q. = CC[] + sage: q = z^2 + w^2 + sage: q.is_lorentzian() + Traceback (most recent call last): + ... + NotImplementedError: is_lorentzian only implemented for real polynomials + + The method can give a reason for a polynomial failing to be Lorentzian:: + + sage: p = x^2 + 2*x + y^2 + sage: p.is_lorentzian(explain=True) + (False, 'inhomogeneous') + + REFERENCES: + + For full definitions and related discussion, see [BrHu2019]_ and + [HMMS2019]_. The second reference gives the characterization of + Lorentzian polynomials applied in this implementation explicitly. + """ + from sage.rings.imaginary_unit import I + + # function to handle return value when reason requested + def result(val, explanation=None): + return (val, explanation) if explain else val + + try: + # this would better be handled by a category of RealFields() + self.base_ring()(I) + except (ValueError, TypeError): + pass + else: + raise NotImplementedError("is_lorentzian only implemented for real polynomials") + + if self.is_zero(): + return result(True) + + if not self.is_homogeneous(): + return result(False, "inhomogeneous") + + if any(coeff < 0 for coeff in self.coefficients()): + return result(False, "negative coefficient") + + # for degree <= 1, homogeneous with positive coefficients is sufficient + if self.degree() <= 1: + return result(True) + + # check support is M-convex + if not _is_M_convex_(self.exponents()): + return result(False, "not M-convex") + + # compute quadratic forms coming from a sequence of partial derivatives + if self.degree() == 2: + quadratic_derivs = set([self]) + else: + gens = self.parent().gens() + quadratic_derivs = set() + multi_exponents = IntegerListsLex(self.degree() - 2, length=len(gens)) + for alpha in multi_exponents: + # construct list [gen_1, exp_1, ..., gen_n, exp_n] for derivative function + d_list = chain(*zip(gens, alpha)) + d = self.derivative(*d_list) + quadratic_derivs.add(d) + + # check derivative quadratic forms have at most one positive eigenvalue + for deriv in quadratic_derivs: + from sage.quadratic_forms.quadratic_form import QuadraticForm + G = QuadraticForm(deriv).Gram_matrix() + spectrum = sorted(G.eigenvalues(), reverse=True) + if len(spectrum) > 1 and spectrum[1] > 0: + return result(False, "multiple positive eigenvalues") + + return result(True) + + +def _is_M_convex_(points): + r""" + Return whether ``points`` represents a set of integer lattice points + which are M-convex. + + Utility function for method ``is_lorentzian``, which would more properly + fit with code related to discrete convex geometry, generalized permutahedra, + or polymatroids, which are not currently implemented in Sage. + + INPUT: + + - ``points`` -- iterable for a list of integer lattice points of the + same dimension + + Examples of M-convex sets include the vertices of a matroid polytope, and the + support sets of Schur polynomials. + + EXAMPLES: + + The following points represent the vertices of a matroid polytope (indicator + vectors of the bases) of rank `2` on five elements:: + + sage: from sage.rings.polynomial.multi_polynomial import _is_M_convex_ + sage: P = [[1,1,0,0], [1,0,1,0], [0,1,1,0], [0,1,0,1], [0,0,1,1]] + sage: _is_M_convex_(P) + True + + These points are the support of the Schur polynomial in three variables for + the partition `(2,2)`:: + + sage: P = [[2,2,0], [2,0,2], [0,2,2], [2,1,1], [1,2,1], [1,1,2]] + sage: _is_M_convex_(P) + True + + The following are not examples of `M`-convex sets of points:: + + sage: P = [[1, 0, 0], [1, 1, 0], [1, 1, 1]] + sage: _is_M_convex_(P) + False + + sage: P = [[0, 1, 2], [2, 1]] + sage: _is_M_convex_(P) + Traceback (most recent call last): + ... + ValueError: input points are not the same dimension + + sage: P = [[0, 0.5, 1], [1, 1.5, 2]] + sage: _is_M_convex_(P) + Traceback (most recent call last): + ... + ValueError: input points are not integer lattice points + + REFERENCES: + + See [BrHu2019]_ for a definition of M-convexity. + """ + points_set = set(map(tuple, points)) + if not points_set: + return True + dim = len(next(iter(points_set))) + if any(len(p) != dim for p in points_set): + raise ValueError("input points are not the same dimension") + if any(entry not in ZZ for p in points_set for entry in p): + raise ValueError("input points are not integer lattice points") + for p1 in points_set: + list_p1 = list(p1) + for p2 in points_set: + if p2 == p1: + continue + delta = list(x2 - x1 for x1, x2 in zip(p1, p2)) + for i in xrange(dim): + if p2[i] > p1[i]: + # modify list_p1 to represent point p1 + e_i - e_j for various i, j + list_p1[i] += 1 # add e_i + # check exchange condition is satisfied by some index j + for j in xrange(dim): + if p2[j] < p1[j]: + list_p1[j] -= 1 # subtract e_j + exch = tuple(list_p1) # p1 + e_i - e_j + list_p1[j] += 1 # add e_j again + if tuple(exch) in points_set: + break + else: + return False + list_p1[i] -= 1 # subtract e_i + # list_p1 should now have same entries as p1 again + return True + + cdef remove_from_tuple(e, int ind): w = list(e) del w[ind] diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index e8acc5a65b1..ceb36976126 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -8856,6 +8856,61 @@ cdef class Polynomial(CommutativeAlgebraElement): else: return b + def is_lorentzian(self, explain=False): + r""" + Return ``True`` if this is a Lorentzian polynomial. + + A univariate real polynomial is Lorentzian if and only if it is a + monomial with positive coefficient, or zero. The definition is more + involved for multivariate real polynomials. + + INPUT: + + - ``explain`` -- boolean (default: ``False``); if ``True`` + return a tuple whose first element is the boolean result of the test, + and the second element is a string describing the reason the test failed, + or ``None`` if the test succeeded + + EXAMPLES:: + + sage: P. = QQ[] + sage: p1 = x^2 + sage: p1.is_lorentzian() + True + sage: p2 = 1 + x^2 + sage: p2.is_lorentzian() + False + sage: p3 = P.zero() + sage: p3.is_lorentzian() + True + sage: p4 = -2*x^3 + sage: p4.is_lorentzian() + False + + It is an error to check if a polynomial is Lorentzian if its base ring + is not a subring of the real numbers, as the notion is not defined in + this case:: + + sage: Q. = CC[] + sage: q = y^2 + sage: q.is_lorentzian() + Traceback (most recent call last): + ... + NotImplementedError: is_lorentzian only implemented for real polynomials + + The method can give a reason for a polynomial failing to be Lorentzian:: + + sage: p = x^2 + 2*x + sage: p.is_lorentzian(explain=True) + (False, 'inhomogeneous') + + REFERENCES: + + For full definitions and related discussion, see [BrHu2019]_ and + [HMMS2019]_. + """ + R = PolynomialRing(self.base_ring(), 1, [self.variable_name()]) + return R(self).is_lorentzian(explain=explain) def variable_name(self): """ diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index d9eee8fd318..1e21659d504 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -2230,30 +2230,76 @@ def clear_denominators(poly): (2, x + 3) sage: clear_denominators(x^2 + x/2 + 1/4) (2, x^2 + x + 1) - """ - # This algorithm factors the polynomial denominators. - # We should check the size of the denominators and switch to - # an alternate, less precise algorithm if we decide factoring - # would be too slow. + TESTS:: + + sage: R. = QQ[] + sage: coefficients_as_integer_ratios = [ + ....: (-2774600080567517563395913264491323241652779066919616441429094563840, + ....: 4143301981494946291120265789013000494010735992517219217956448435626412078440663802209333), + ....: (-24216324060414384566983400245979288839929814383090701293489050615808, + ....: 4143301981494946291120265789013000494010735992517219217956448435626412078440663802209333), + ....: (325579773864372490083706670433410006284520887405882567940047555526656, + ....: 180143564412823751787837643000565238870031999674661705128541236331583133845246252269971), + ....: (-86736048492777879473586471630941922517134071457946320753641122078523392, + ....: 4143301981494946291120265789013000494010735992517219217956448435626412078440663802209333), + ....: (-2338058278498910195688689352766977573607428722429118859280880481590329344, + ....: 4143301981494946291120265789013000494010735992517219217956448435626412078440663802209333), + ....: (105830270645785996318880019945503938356315302592627229453391693256551317504, + ....: 1381100660498315430373421929671000164670245330839073072652149478542137359480221267403111), + ....: (1110926147990548796149597141538460730252912439930561079348611699181798425600, + ....: 4143301981494946291120265789013000494010735992517219217956448435626412078440663802209333), + ....: (-89705438380888704653335165590083767769953879654958783855317882966200828559360, + ....: 4143301981494946291120265789013000494010735992517219217956448435626412078440663802209333), + ....: (1151092895747371986483047191334923516591005329489629755485810229546333821625856, + ....: 1381100660498315430373421929671000164670245330839073072652149478542137359480221267403111), + ....: (24725641793859400310483886670136079788266826658111372723121573233077840328938576, + ....: 4143301981494946291120265789013000494010735992517219217956448435626412078440663802209333), + ....: (-31051495080139473677925068000403254349133134904365702868216464107777210775457136, + ....: 153455628944257270041491325519000018296693925648785896961349942060237484386691251933679), + ....: (9431591461895130351865642769482226964622378075329823505708119342634182162193000560, + ....: 4143301981494946291120265789013000494010735992517219217956448435626412078440663802209333), + ....: (1721694880863483428337378731387732043714427651970488363462560317808769716807148992, + ....: 153455628944257270041491325519000018296693925648785896961349942060237484386691251933679), + ....: (255327752077837584624694974814916395144764296822788813014081161094149724325120096, + ....: 27080405107810106477910233915117650287651869232138687699061754481218379597651397400061), + ....: (238105337335596176836773151768694069523377650990453522899627157538495252117232992338, + ....: 27080405107810106477910233915117650287651869232138687699061754481218379597651397400061), + ....: (1255826892296350234297164500548658984205287902407560187136301197703464130999349114638, + ....: 14336685057075938723599535602121108975815695475838128781856222960645024492874269211797), + ....: (1, 1)] + sage: p = R(coefficients_as_integer_ratios) + sage: a = QQbar.polynomial_root( + ....: AA.common_polynomial(p), + ....: CIF(RIF(-RR(0.036151142425748496), -RR(0.036151142425748489)), + ....: RIF(-RR(0.011298617187916445), -RR(0.011298617187916443)))) + sage: a.exactify() + sage: a + -0.03615114242574849? - 0.011298617187916444?*I + """ d = poly.denominator() if d == 1: return d, poly deg = poly.degree() - factors = {} - for i in range(deg): - d = poly[i].denominator() - df = factor(d) - for f, e in df: - oe = 0 - if f in factors: - oe = factors[f] - min_e = (e + (deg - i) - 1) // (deg - i) - factors[f] = max(oe, min_e) - change = 1 - for f, e in factors.items(): - change = change * f**e + denoms = [c.denominator() for c in poly] + if all(d.nbits() < 128 for d in denoms): + # Factor the polynomial denominators. + factors = {} + for i, d in enumerate(denoms): + df = factor(d) + for f, e in df: + oe = 0 + if f in factors: + oe = factors[f] + min_e = (e + (deg - i) - 1) // (deg - i) + factors[f] = max(oe, min_e) + change = 1 + for f, e in factors.items(): + change = change * f**e + else: + # Factoring would be too slow. + change = poly.monic().denominator() poly = poly * (change**deg) poly = poly(poly.parent().gen() / change) return change, poly diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 32c2e47e494..9efef46cda3 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -59,7 +59,7 @@ from sage.misc.cachefunc import cached_method from sage.misc.lazy_attribute import lazy_attribute -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd from sage.rings.integer import Integer from sage.rings.finite_rings.finite_field_constructor import is_PrimeFiniteField diff --git a/src/sage/schemes/elliptic_curves/BSD.py b/src/sage/schemes/elliptic_curves/BSD.py index a9a42ebd84b..b44ef5d9c16 100644 --- a/src/sage/schemes/elliptic_curves/BSD.py +++ b/src/sage/schemes/elliptic_curves/BSD.py @@ -2,7 +2,9 @@ "Birch and Swinnerton-Dyer formulas" from sage.arith.misc import prime_divisors -from sage.rings.all import ZZ, Infinity, QuadraticField +from sage.rings.integer_ring import ZZ +from sage.rings.infinity import Infinity +from sage.rings.number_field.number_field import QuadraticField from sage.functions.other import ceil @@ -480,7 +482,7 @@ def prove_BSD(E, verbosity=0, two_desc='mwrank', proof=None, secs_hi=5, # We do not know BSD(E,p) for even a single p, since it's # an open problem to show that L^r(E,1)/(Reg*Omega) is # rational for any curve with r >= 2. - from sage.sets.all import Primes + from sage.sets.primes import Primes BSD.primes = Primes() if return_BSD: BSD.rank = rank_lower_bd diff --git a/src/sage/schemes/elliptic_curves/cardinality.py b/src/sage/schemes/elliptic_curves/cardinality.py index cc93b9ecf74..345b0e761d4 100644 --- a/src/sage/schemes/elliptic_curves/cardinality.py +++ b/src/sage/schemes/elliptic_curves/cardinality.py @@ -21,7 +21,10 @@ # **************************************************************************** from .constructor import EllipticCurve, EllipticCurve_from_j from sage.schemes.curves.projective_curve import Hasse_bounds -from sage.rings.all import Integer, ZZ, GF, polygen +from sage.rings.integer import Integer +from sage.rings.integer_ring import ZZ +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.rings.polynomial.polynomial_ring import polygen from sage.groups.generic import order_from_bounds diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index 6d56371ce93..9bb1552b68e 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -34,12 +34,12 @@ # **************************************************************************** from sage.interfaces.magma import magma -from sage.rings.all import (Integer, - QQ, - ZZ, - IntegerRing, - is_fundamental_discriminant, - PolynomialRing) +from sage.rings.integer import Integer +from sage.rings.rational_field import QQ +from sage.rings.integer_ring import ZZ +from sage.rings.integer_ring import IntegerRing +from sage.rings.number_field.number_field import is_fundamental_discriminant +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.misc.cachefunc import cached_function @@ -124,7 +124,8 @@ def hilbert_class_polynomial(D, algorithm=None): raise ValueError("%s is not a valid algorithm" % algorithm) from sage.quadratic_forms.binary_qf import BinaryQF_reduced_representatives - from sage.rings.all import RR, ComplexField + from sage.rings.real_mpfr import RR + from sage.rings.complex_mpfr import ComplexField from sage.functions.all import elliptic_j # get all primitive reduced quadratic forms, (necessary to exclude @@ -623,7 +624,8 @@ def is_cm_j_invariant(j, method='new'): True """ # First we check that j is an algebraic number: - from sage.rings.all import NumberFieldElement, NumberField + from sage.rings.number_field.number_field_element import NumberFieldElement + from sage.rings.number_field.number_field import NumberField if not isinstance(j, NumberFieldElement) and j not in QQ: raise NotImplementedError("is_cm_j_invariant() is only implemented for number field elements") diff --git a/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx b/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx index 5a265b40c85..4550db78cbd 100644 --- a/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx +++ b/src/sage/schemes/elliptic_curves/descent_two_isogeny.pyx @@ -19,8 +19,8 @@ from sage.rings.integer_ring import ZZ from sage.rings.polynomial.polynomial_ring import polygen cdef object x_ZZ = polygen(ZZ) from sage.rings.polynomial.real_roots import real_roots -from sage.arith.all import prime_divisors -from sage.all import ntl +from sage.arith.misc import prime_divisors +import sage.libs.ntl.all as ntl from sage.rings.integer cimport Integer from sage.libs.gmp.mpz cimport * diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 68194f600c2..441f45c2e12 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -2486,7 +2486,7 @@ def __compute_omega_general(self, E, psi, psi_pr, phi, phi_pr): # thesis are wrong, the correct formulas # are coded below - from sage.arith.all import binomial + from sage.arith.misc import binomial for j in range(n - 1): psi_prpr += binomial(j+2, 2) * psi[j+2] * cur_x_pow diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index b70939eb64e..107e0669da2 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -1434,7 +1434,7 @@ def isogenies_prime_degree(self, l=None, max_l=31): raise NotImplementedError("This code could be implemented for QQbar, but has not been yet.") if l is None: - from sage.rings.all import prime_range + from sage.rings.fast_arith import prime_range L = prime_range(max_l + 1) else: try: diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index ff69f92f6ca..a379bc469e8 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -25,18 +25,24 @@ # https://www.gnu.org/licenses/ # **************************************************************************** +import sage.groups.generic as generic +from sage.arith.functions import lcm +from sage.arith.misc import binomial, GCD as gcd +from sage.groups.additive_abelian.additive_abelian_wrapper import AdditiveAbelianGroupWrapper +from sage.misc.cachefunc import cached_method +from sage.rings.finite_rings.element_base import is_FiniteFieldElement +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.rings.integer import Integer +from sage.rings.integer_ring import ZZ +from sage.rings.polynomial.polynomial_ring import polygen +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.schemes.curves.projective_curve import Hasse_bounds -from .ell_field import EllipticCurve_field -from .constructor import EllipticCurve from sage.schemes.hyperelliptic_curves.hyperelliptic_finite_field import HyperellipticCurve_finite_field -from sage.rings.all import Integer, ZZ, PolynomialRing, GF, polygen -from sage.rings.finite_rings.element_base import is_FiniteFieldElement -import sage.groups.generic as generic + from . import ell_point -from sage.arith.all import gcd, lcm, binomial -from sage.misc.cachefunc import cached_method -from sage.groups.additive_abelian.additive_abelian_wrapper import AdditiveAbelianGroupWrapper +from .constructor import EllipticCurve +from .ell_field import EllipticCurve_field class EllipticCurve_finite_field(EllipticCurve_field, HyperellipticCurve_finite_field): diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index d3ca4896b01..e9d42c7e487 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -62,7 +62,7 @@ import sage.groups.additive_abelian.additive_abelian_group as groups import sage.groups.generic as generic -from sage.arith.all import lcm +from sage.arith.functions import lcm import sage.rings.all as rings from sage.misc.cachefunc import cached_method from sage.misc.fast_methods import WithEqualityById @@ -1991,6 +1991,14 @@ def _multiple_x_numerator(self, n, x=None): EXAMPLES:: + sage: E = EllipticCurve([1,2]) + sage: E._multiple_x_numerator(3) + x^9 - 12*x^7 - 192*x^6 + 30*x^5 - 48*x^4 + 228*x^3 + 96*x^2 + 393*x + 528 + sage: E._multiple_x_numerator(-3) + x^9 - 12*x^7 - 192*x^6 + 30*x^5 - 48*x^4 + 228*x^3 + 96*x^2 + 393*x + 528 + + :: + sage: E = EllipticCurve("37a") sage: P = E.gens()[0] sage: x = P[0] @@ -2043,9 +2051,9 @@ def _multiple_x_numerator(self, n, x=None): sage: E._multiple_x_numerator(5) x^25 + 65037*x^23 + 55137*x^22 + ... + 813*x^2 + 10220*x + 42539 """ - n = rings.Integer(n) - if n < 2: - raise ValueError("n must be at least 2") + n = rings.Integer(n).abs() + if not n: + raise ValueError("n must be nonzero") if x is None: try: @@ -2061,6 +2069,9 @@ def _multiple_x_numerator(self, n, x=None): cache = None xx = x + if n == 1: + return xx + polys = self.division_polynomial_0([-2,-1,n-1,n,n+1], x) if n % 2 == 0: @@ -2101,6 +2112,14 @@ def _multiple_x_denominator(self, n, x=None): EXAMPLES:: + sage: E = EllipticCurve([1,2]) + sage: E._multiple_x_denominator(3) + 9*x^8 + 36*x^6 + 144*x^5 + 30*x^4 + 288*x^3 + 564*x^2 - 48*x + 1 + sage: E._multiple_x_denominator(-3) + 9*x^8 + 36*x^6 + 144*x^5 + 30*x^4 + 288*x^3 + 564*x^2 - 48*x + 1 + + :: + sage: E = EllipticCurve("43a") sage: P = E.gens()[0] sage: x = P[0] @@ -2128,9 +2147,9 @@ def _multiple_x_denominator(self, n, x=None): sage: E._multiple_x_denominator(5) 25*x^24 + 3100*x^22 + 19000*x^21 + ... + 24111*x^2 + 52039*x + 56726 """ - n = rings.Integer(n) - if n < 2: - raise ValueError("n must be at least 2") + n = rings.Integer(n).abs() + if not n: + raise ValueError("n must be nonzero") if x is None: try: diff --git a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py index c91a54fdc27..b31f7dfe46c 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -87,19 +87,22 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.structure.sage_object import SageObject -from sage.modular.modsym.all import ModularSymbols +from sage.arith.misc import (kronecker as kronecker_symbol, + next_prime, + prime_divisors, + valuation) from sage.databases.cremona import parse_cremona_label - -from sage.arith.all import next_prime, kronecker_symbol, prime_divisors, valuation +from sage.misc.verbose import verbose +from sage.modular.cusps import Cusps +from sage.modular.modsym.all import ModularSymbols from sage.rings.infinity import unsigned_infinity as infinity from sage.rings.integer import Integer -from sage.modular.cusps import Cusps from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.misc.verbose import verbose +from sage.structure.sage_object import SageObject + +from .constructor import EllipticCurve -from sage.schemes.elliptic_curves.constructor import EllipticCurve oo = Cusps(infinity) zero = Integer(0) diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index 3b31f9cf43f..acb392a0773 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -388,7 +388,7 @@ def height_pairing_matrix(self, points=None, precision=None, normalised=True): RR = RealField() else: RR = RealField(precision) - from sage.matrix.all import MatrixSpace + from sage.matrix.matrix_space import MatrixSpace M = MatrixSpace(RR, r) mat = M() for j in range(r): @@ -3897,7 +3897,7 @@ def saturation(self, points, verbose=False, raise ValueError("points not linearly independent in saturation()") sat_reg = reg - from sage.rings.all import prime_range + from sage.rings.fast_arith import prime_range if full_saturation: if lower_ht_bound is None: # TODO (robertwb): verify this for rank > 1 diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 9f0c3799f36..d49bcccd279 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -2833,7 +2833,9 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): 4.0000000000000000000000000000000000000000000000000000000000 """ from sage.rings.number_field.number_field import refine_embedding - from sage.all import RealField, ComplexField, Infinity + from sage.rings.real_mpfr import RealField + from sage.rings.complex_mpfr import ComplexField + from sage.rings.infinity import Infinity E = self.curve() K = E.base_ring() @@ -3254,7 +3256,9 @@ def elliptic_logarithm(self, embedding=None, precision=100, 0.70448375537782208460499649302 - 0.79246725643650979858266018068*I """ from sage.rings.number_field.number_field import refine_embedding - from sage.rings.all import RealField, ComplexField, QQ + from sage.rings.real_mpfr import RealField + from sage.rings.complex_mpfr import ComplexField + from sage.rings.rational_field import QQ # Check the trivial case: diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index c2b8436f2a1..f1b7d937748 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -74,13 +74,14 @@ import sage.arith.all as arith import sage.rings.all as rings -from sage.rings.all import ( - PowerSeriesRing, - infinity as oo, - ZZ, QQ, - Integer, - IntegerRing, RealField, - ComplexField, RationalField) +from sage.rings.power_series_ring import PowerSeriesRing +from sage.rings.infinity import Infinity as oo +from sage.rings.integer_ring import ZZ, IntegerRing +from sage.rings.rational_field import QQ +from sage.rings.integer import Integer +from sage.rings.real_mpfr import RealField +from sage.rings.complex_mpfr import ComplexField +from sage.rings.rational_field import RationalField from sage.structure.coerce import py_scalar_to_element from sage.structure.element import Element @@ -3436,7 +3437,7 @@ def Lambda(self, s, prec): sage: E.Lambda(1.4+0.5*I, 50) -0.354172680517... + 0.874518681720...*I """ - from sage.all import pi + from sage.symbolic.constants import pi s = C(s) N = self.conductor() @@ -6013,7 +6014,7 @@ def point_preprocessing(free,tor): roots.remove(e3) e1,e2 = roots - from sage.all import pi + from sage.symbolic.constants import pi e = R(1).exp() pi = R(pi) @@ -7054,7 +7055,7 @@ def elliptic_curve_congruence_graph(curves): Graph on 12 vertices """ from sage.graphs.graph import Graph - from sage.arith.all import lcm + from sage.arith.functions import lcm from sage.rings.fast_arith import prime_range from sage.misc.misc_c import prod G = Graph() diff --git a/src/sage/schemes/elliptic_curves/ell_tate_curve.py b/src/sage/schemes/elliptic_curves/ell_tate_curve.py index 22a4f0a29d0..4b7cd3e82c5 100644 --- a/src/sage/schemes/elliptic_curves/ell_tate_curve.py +++ b/src/sage/schemes/elliptic_curves/ell_tate_curve.py @@ -44,7 +44,7 @@ from sage.rings.padics.factory import Qp from sage.structure.sage_object import SageObject from sage.structure.richcmp import richcmp, richcmp_method -from sage.arith.all import LCM +from sage.arith.functions import lcm as LCM from sage.modular.modform.constructor import EisensteinForms, CuspForms from sage.schemes.elliptic_curves.constructor import EllipticCurve from sage.functions.log import log diff --git a/src/sage/schemes/elliptic_curves/ell_torsion.py b/src/sage/schemes/elliptic_curves/ell_torsion.py index 8a1208569f2..7bfda81486a 100644 --- a/src/sage/schemes/elliptic_curves/ell_torsion.py +++ b/src/sage/schemes/elliptic_curves/ell_torsion.py @@ -26,7 +26,7 @@ # **************************************************************************** from sage.misc.cachefunc import cached_method -from sage.rings.all import RationalField +from sage.rings.rational_field import RationalField import sage.groups.additive_abelian.additive_abelian_wrapper as groups from sage.structure.richcmp import richcmp_method, richcmp diff --git a/src/sage/schemes/elliptic_curves/formal_group.py b/src/sage/schemes/elliptic_curves/formal_group.py index 17019a5794e..591ce2d6f29 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -16,7 +16,7 @@ import sage.misc.misc as misc import sage.rings.all as rings -from sage.rings.all import O +from sage.rings.big_oh import O class EllipticCurveFormalGroup(SageObject): diff --git a/src/sage/schemes/elliptic_curves/gal_reps.py b/src/sage/schemes/elliptic_curves/gal_reps.py index 55d0ac2d352..056268eb230 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps.py +++ b/src/sage/schemes/elliptic_curves/gal_reps.py @@ -121,7 +121,8 @@ import sage.misc.all as misc from sage.misc.verbose import verbose import sage.rings.all as rings -from sage.rings.all import RealField, GF +from sage.rings.real_mpfr import RealField +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF from math import sqrt from sage.libs.pari.all import pari @@ -916,14 +917,14 @@ def image_type(self, p): a_ell = self._E.ap(ell) u = k(a_ell)**2 * k(ell)**(-1) if u == 3: - verbose("found an element of order 6",2) + verbose("found an element of order 6", level=2) # found an element of order 6: self.__image_type[p] = non_split_str return self.__image_type[p] if u == 2 and not has_an_el_order_4: # found an element of order 4 - verbose("found an element of order 4",2) + verbose("found an element of order 4", level=2) has_an_el_order_4 = True if has_an_el_order_3: self.__image_type[p] = s4_str @@ -931,13 +932,13 @@ def image_type(self, p): if u == 1 and not has_an_el_order_3: # found an element of order 3 - verbose("found an element of order 3",2) + verbose("found an element of order 3", level=2) has_an_el_order_3 = True if has_an_el_order_4: self.__image_type[p] = s4_str return self.__image_type[p] - verbose("p=5 and we could not determine the image, yet", 2) + verbose("p=5 and we could not determine the image, yet", level=2) # we have not yet determined the image, there are only the following possible subgroups of PGL_2 # (unless we were unlucky and none of the elements of order 6 showed up above, for instance) # A_4 of order 12 with elements of order 2 and 3 @@ -995,15 +996,15 @@ def image_type(self, p): u = k(a_ell)**2 * k(ell)**(-1) if (u not in ex_setp) and could_be_exc == 1: # it can not be in the exceptional - verbose("the image cannot be exceptional, found u=%s"%u,2) + verbose("the image cannot be exceptional, found u=%s"%u, level=2) could_be_exc = 0 if a_ell != 0 and arith.kronecker(a_ell**2 - 4*ell,p) == 1 and could_be_non_split == 1: # it can not be in the normalizer of the non-split Cartan - verbose("the image cannot be non-split, found u=%s"%u,2) + verbose("the image cannot be non-split, found u=%s"%u, level=2) could_be_non_split = 0 if a_ell != 0 and arith.kronecker(a_ell**2 - 4*ell,p) == -1 and could_be_split == 1: # it can not be in the normalizer of the split Cartan - verbose("the image cannot be split, found u=%s"%u,2) + verbose("the image cannot be split, found u=%s"%u, level=2) could_be_split = 0 assert could_be_exc + could_be_split + could_be_non_split > 0, "bug in image_type." @@ -1064,7 +1065,7 @@ def image_type(self, p): K = self._E.division_field(p, 'z') d = K.absolute_degree() - verbose("field of degree %s. try to compute Galois group"%(d),2) + verbose("field of degree %s. try to compute Galois group"%(d), level=2) # If the degree is too big, we have no chance at the Galois # group. K.galois_group calls is_galois which used to rely on # pari's Galois group computations, so degree < 12 diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py index d484a4a18bd..82127860fd3 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py @@ -45,14 +45,17 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.structure.sage_object import SageObject -from sage.rings.number_field.number_field import NumberField +from sage.arith.misc import legendre_symbol, primes +from sage.misc.functional import cyclotomic_polynomial from sage.modules.free_module import VectorSpace from sage.rings.finite_rings.finite_field_constructor import GF -from sage.misc.functional import cyclotomic_polynomial -from sage.arith.all import legendre_symbol, primes +from sage.rings.infinity import Infinity +from sage.rings.integer import Integer +from sage.rings.integer_ring import ZZ +from sage.rings.number_field.number_field import NumberField +from sage.rings.rational_field import QQ from sage.sets.set import Set -from sage.rings.all import Integer, ZZ, QQ, Infinity +from sage.structure.sage_object import SageObject class GaloisRepresentation(SageObject): diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index 298f44fedc6..f9b752f9533 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -92,30 +92,34 @@ # https://www.gnu.org/licenses/ # **************************************************************************** - -from sage.misc.misc_c import prod -from sage.misc.verbose import verbose -from sage.misc.cachefunc import cached_method - -from sage.structure.sage_object import SageObject -from sage.structure.richcmp import (richcmp_method, richcmp, - richcmp_not_equal, rich_to_bool) - import sage.rings.abc import sage.rings.number_field.number_field_element import sage.rings.number_field.number_field as number_field import sage.rings.all as rings -from sage.rings.all import (ZZ, GF, QQ, CDF, - Integers, RealField, ComplexField, QuadraticField) -from sage.arith.all import (gcd, xgcd, lcm, prime_divisors, factorial, - binomial) + +from sage.arith.functions import lcm +from sage.arith.misc import (binomial, factorial, prime_divisors, + GCD as gcd, XGCD as xgcd) +from sage.matrix.constructor import Matrix as matrix +from sage.matrix.matrix_space import MatrixSpace +from sage.misc.cachefunc import cached_method +from sage.misc.misc_c import prod +from sage.misc.verbose import verbose +from sage.modular.modsym.p1list import P1List +from sage.rings.complex_double import CDF +from sage.rings.complex_mpfr import ComplexField from sage.rings.factorint import factor_trial_division +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Integers +from sage.rings.integer_ring import ZZ +from sage.rings.number_field.number_field import QuadraticField +from sage.rings.rational_field import QQ +from sage.rings.real_mpfr import RealField from sage.quadratic_forms.all import (BinaryQF, BinaryQF_reduced_representatives) -from sage.matrix.all import MatrixSpace, matrix - -from sage.modular.modsym.p1list import P1List - +from sage.structure.sage_object import SageObject +from sage.structure.richcmp import (richcmp_method, richcmp, + richcmp_not_equal, rich_to_bool) ############################################################################### # @@ -6822,7 +6826,7 @@ def heegner_index_bound(self, D=0, prec=5, max_height=None): else: H = 4*h p = 3 - from sage.all import next_prime + from sage.arith.misc import next_prime while True: c = H/(2*p**2) + B if c < max_height: diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 06d83bc7759..019dd555941 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -42,7 +42,8 @@ from sage.misc.cachefunc import cached_method from sage.misc.mrange import cartesian_product_iterator -from sage.arith.all import lcm, factorial +from sage.arith.functions import lcm +from sage.arith.misc import factorial from sage.ext.fast_callable import fast_callable from sage.functions.log import log, exp from sage.symbolic.ring import SR diff --git a/src/sage/schemes/elliptic_curves/hom_velusqrt.py b/src/sage/schemes/elliptic_curves/hom_velusqrt.py index 22ae56018a3..0f1101e57d2 100644 --- a/src/sage/schemes/elliptic_curves/hom_velusqrt.py +++ b/src/sage/schemes/elliptic_curves/hom_velusqrt.py @@ -122,21 +122,17 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.structure.sequence import Sequence -from sage.structure.all import coercion_model as cm - from sage.misc.cachefunc import cached_method - from sage.misc.misc_c import prod from sage.rings.generic import ProductTree, prod_with_derivative - -from sage.structure.richcmp import op_EQ - from sage.rings.integer import Integer +from sage.structure.all import coercion_model as cm +from sage.structure.richcmp import op_EQ +from sage.structure.sequence import Sequence -from sage.schemes.elliptic_curves.constructor import EllipticCurve -from sage.schemes.elliptic_curves.ell_finite_field import EllipticCurve_finite_field -from sage.schemes.elliptic_curves.hom import EllipticCurveHom, compare_via_evaluation +from .constructor import EllipticCurve +from .ell_finite_field import EllipticCurve_finite_field +from .hom import EllipticCurveHom, compare_via_evaluation def _choose_IJK(n): @@ -1213,7 +1209,12 @@ def _random_example_for_testing(): sage: 5 <= K.order() True """ - from sage.all import prime_range, choice, randrange, GF, lcm, Mod + from sage.rings.fast_arith import prime_range + from sage.misc.prandom import choice, randrange + from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF + from sage.arith.functions import lcm + from sage.rings.finite_rings.integer_mod import Mod + while True: p = choice(prime_range(2, 100)) e = randrange(1,5) diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py index e635c77a458..0d50a9863ef 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_class.py +++ b/src/sage/schemes/elliptic_curves/isogeny_class.py @@ -770,7 +770,7 @@ def _compute(self, verbose=False): True """ from sage.schemes.elliptic_curves.ell_curve_isogeny import fill_isogeny_matrix - from sage.matrix.all import MatrixSpace + from sage.matrix.matrix_space import MatrixSpace from sage.sets.set import Set self._maps = None @@ -1055,7 +1055,7 @@ def _compute(self): [0 2 0 0 0 0] """ algorithm = self._algorithm - from sage.matrix.all import MatrixSpace + from sage.matrix.matrix_space import MatrixSpace self._maps = None if algorithm == "database": try: @@ -1183,8 +1183,8 @@ def isogeny_degrees_cm(E, verbose=False): print("CM case, discriminant = %s" % d) from sage.libs.pari.all import pari - from sage.sets.all import Set - from sage.arith.all import kronecker_symbol + from sage.sets.set import Set + from sage.arith.misc import kronecker as kronecker_symbol n = E.base_field().absolute_degree() if not E.has_rational_cm(): diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index f5657f2cf19..65cbbc29a35 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -536,7 +536,7 @@ def _sporadic_Q_data(j): ....: g = E.division_polynomial(ell) ....: assert g % f == 0 """ - from sage.rings.all import RealField + from sage.rings.real_mpfr import RealField from sage.misc.misc_c import prod ell = sporadic_j[j] E = EllipticCurve(j=j).short_weierstrass_model() diff --git a/src/sage/schemes/elliptic_curves/lseries_ell.py b/src/sage/schemes/elliptic_curves/lseries_ell.py index 94b381a2f0c..e1506b17910 100644 --- a/src/sage/schemes/elliptic_curves/lseries_ell.py +++ b/src/sage/schemes/elliptic_curves/lseries_ell.py @@ -23,7 +23,8 @@ #***************************************************************************** from sage.structure.sage_object import SageObject -from sage.rings.all import RealField, RationalField +from sage.rings.real_mpfr import RealField +from sage.rings.rational_field import RationalField from math import sqrt, log, ceil import sage.functions.exp_integral as exp_integral from sage.misc.verbose import verbose diff --git a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx index ea646b7fbe3..369cd98a293 100644 --- a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx +++ b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx @@ -164,18 +164,16 @@ AUTHORS: from cysignals.memory cimport sig_malloc, sig_free, sig_realloc from cysignals.signals cimport sig_check +from sage.arith.misc import euler_phi, kronecker as kronecker_symbol from sage.misc.cachefunc import cached_method - +from sage.misc.misc_c import prod +from sage.misc.verbose import verbose from sage.rings.complex_mpfr cimport ComplexNumber from sage.rings.complex_mpfr import ComplexField -from sage.rings.real_mpfr cimport RealNumber, RealField -from sage.rings.rational cimport Rational from sage.rings.integer cimport Integer +from sage.rings.rational cimport Rational +from sage.rings.real_mpfr cimport RealNumber, RealField -from sage.misc.misc_c import prod -from sage.misc.verbose import verbose -from sage.arith.all import kronecker_symbol -from sage.arith.misc import euler_phi cdef extern from "": double log(double) diff --git a/src/sage/schemes/elliptic_curves/modular_parametrization.py b/src/sage/schemes/elliptic_curves/modular_parametrization.py index dca43dcd191..57a90190fe5 100644 --- a/src/sage/schemes/elliptic_curves/modular_parametrization.py +++ b/src/sage/schemes/elliptic_curves/modular_parametrization.py @@ -44,7 +44,10 @@ from . import heegner -from sage.rings.all import (LaurentSeriesRing, RationalField, ComplexField, QQ) +from sage.rings.laurent_series_ring import LaurentSeriesRing +from sage.rings.rational_field import RationalField +from sage.rings.complex_mpfr import ComplexField +from sage.rings.rational_field import QQ class ModularParameterization: diff --git a/src/sage/schemes/elliptic_curves/padic_lseries.py b/src/sage/schemes/elliptic_curves/padic_lseries.py index ccdc0dcc941..875a4113464 100644 --- a/src/sage/schemes/elliptic_curves/padic_lseries.py +++ b/src/sage/schemes/elliptic_curves/padic_lseries.py @@ -61,27 +61,33 @@ # https://www.gnu.org/licenses/ ###################################################################### -from sage.rings.integer_ring import ZZ -from sage.rings.rational_field import QQ -from sage.rings.padics.factory import Qp -from sage.rings.infinity import infinity -from sage.rings.all import LaurentSeriesRing, PowerSeriesRing, PolynomialRing, Integers - -from sage.rings.integer import Integer -from sage.arith.all import valuation, binomial, kronecker_symbol, gcd, prime_divisors, LCM - -from sage.structure.sage_object import SageObject -from sage.structure.richcmp import richcmp_method, richcmp - -from sage.misc.functional import denominator -from sage.misc.verbose import verbose, get_verbose - -from sage.modules.free_module_element import vector import sage.matrix.all as matrix import sage.schemes.hyperelliptic_curves.monsky_washnitzer + +from sage.arith.functions import lcm as LCM +from sage.arith.misc import (binomial, + GCD as gcd, + prime_divisors, + kronecker as kronecker_symbol, + valuation) from sage.functions.log import log from sage.functions.other import floor from sage.misc.cachefunc import cached_method +from sage.misc.functional import denominator +from sage.misc.verbose import get_verbose, verbose +from sage.modules.free_module_element import vector +from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Integers +from sage.rings.infinity import infinity +from sage.rings.integer import Integer +from sage.rings.integer_ring import ZZ +from sage.rings.laurent_series_ring import LaurentSeriesRing +from sage.rings.padics.factory import Qp +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.rings.power_series_ring import PowerSeriesRing +from sage.rings.rational_field import QQ +from sage.structure.richcmp import richcmp_method, richcmp +from sage.structure.sage_object import SageObject + @richcmp_method class pAdicLseries(SageObject): diff --git a/src/sage/schemes/elliptic_curves/padics.py b/src/sage/schemes/elliptic_curves/padics.py index 96fb8510c12..e4d88113716 100644 --- a/src/sage/schemes/elliptic_curves/padics.py +++ b/src/sage/schemes/elliptic_curves/padics.py @@ -21,25 +21,28 @@ # https://www.gnu.org/licenses/ ###################################################################### +import math -import sage.rings.all as rings -from . import padic_lseries as plseries import sage.arith.all as arith -from sage.rings.all import ( - Qp, Zp, - Integers, - Integer, - O, - PowerSeriesRing, - LaurentSeriesRing, - RationalField) -import math -import sage.misc.misc as misc import sage.matrix.all as matrix -sqrt = math.sqrt -import sage.schemes.hyperelliptic_curves.monsky_washnitzer +import sage.misc.misc as misc +import sage.rings.all as rings import sage.schemes.hyperelliptic_curves.hypellfrob +import sage.schemes.hyperelliptic_curves.monsky_washnitzer + from sage.misc.cachefunc import cached_method +from sage.rings.big_oh import O +from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Integers +from sage.rings.integer import Integer +from sage.rings.laurent_series_ring import LaurentSeriesRing +from sage.rings.padics.factory import Qp, Zp +from sage.rings.power_series_ring import PowerSeriesRing +from sage.rings.rational_field import RationalField + +from . import padic_lseries as plseries + +sqrt = math.sqrt + def __check_padic_hypotheses(self, p): r""" diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 7206ea74a7a..7224988fc27 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -96,17 +96,22 @@ """ -from sage.modules.free_module import FreeModule_generic_pid -from sage.rings.all import ZZ, QQ, RealField, ComplexField, QQbar, AA import sage.rings.abc + +from sage.libs.pari.all import pari +from sage.misc.cachefunc import cached_method +from sage.modules.free_module import FreeModule_generic_pid +from sage.rings.complex_mpfr import ComplexField from sage.rings.complex_mpfr import ComplexNumber -from sage.rings.real_mpfr import RealNumber as RealNumber -from sage.rings.number_field.number_field import refine_embedding from sage.rings.infinity import Infinity +from sage.rings.integer_ring import ZZ +from sage.rings.number_field.number_field import refine_embedding +from sage.rings.qqbar import AA, QQbar +from sage.rings.rational_field import QQ +from sage.rings.real_mpfr import RealField +from sage.rings.real_mpfr import RealNumber as RealNumber from sage.schemes.elliptic_curves.constructor import EllipticCurve -from sage.misc.cachefunc import cached_method from sage.structure.richcmp import richcmp_method, richcmp, richcmp_not_equal -from sage.libs.pari.all import pari class PeriodLattice(FreeModule_generic_pid): diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index 9f5b59ac404..57367c515d4 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -52,7 +52,7 @@ from sage.rings.finite_rings.finite_field_constructor import GF from sage.rings.integer_ring import ZZ -from sage.arith.all import kronecker_symbol as kro +from sage.arith.misc import kronecker as kro from sage.structure.sage_object import SageObject def reduce_mod_q(x,amodq): diff --git a/src/sage/schemes/elliptic_curves/sha_tate.py b/src/sage/schemes/elliptic_curves/sha_tate.py index bf8eb3e060e..1e4fe251ff6 100644 --- a/src/sage/schemes/elliptic_curves/sha_tate.py +++ b/src/sage/schemes/elliptic_curves/sha_tate.py @@ -80,12 +80,11 @@ # **************************************************************************** from sage.structure.sage_object import SageObject -from sage.rings.all import ( - Integer, - RealField, - RationalField, - RIF, - ZZ) +from sage.rings.integer import Integer +from sage.rings.real_mpfr import RealField +from sage.rings.rational_field import RationalField +from sage.rings.real_mpfi import RIF +from sage.rings.integer_ring import ZZ from sage.functions.log import log from math import sqrt from sage.misc.verbose import verbose diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 6b56e94eba8..4db88f1f7f2 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -29,7 +29,8 @@ from sage.schemes.elliptic_curves.hom import EllipticCurveHom from sage.structure.richcmp import (richcmp, richcmp_not_equal, op_EQ, op_NE) from sage.structure.sequence import Sequence -from sage.rings.all import Integer, PolynomialRing +from sage.rings.integer import Integer +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing class baseWI(): r""" diff --git a/src/sage/schemes/generic/spec.py b/src/sage/schemes/generic/spec.py index 261bb899d68..fcbda338c59 100644 --- a/src/sage/schemes/generic/spec.py +++ b/src/sage/schemes/generic/spec.py @@ -98,7 +98,8 @@ def __init__(self, base_ring=None): Spec functor from Category of commutative rings to Category of schemes over Rational Field """ - from sage.categories.all import CommutativeRings, Schemes + from sage.categories.commutative_rings import CommutativeRings + from sage.categories.schemes import Schemes if base_ring is None: domain = CommutativeRings() diff --git a/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx b/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx index c08bb3cfb53..50730d1081f 100644 --- a/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx +++ b/src/sage/schemes/hyperelliptic_curves/hypellfrob.pyx @@ -38,8 +38,9 @@ from libcpp.vector cimport vector from sage.libs.ntl.ntl_ZZ_pContext import ZZ_pContext_factory from sage.libs.ntl.all import ZZ, ZZX from sage.matrix.constructor import Matrix -from sage.rings.all import Qp, O as big_oh -from sage.arith.all import is_prime +from sage.rings.padics.factory import Qp +from sage.rings.big_oh import O as big_oh +from sage.arith.misc import is_prime from sage.libs.ntl.ntl_ZZ_p cimport ntl_ZZ_p from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py index 9f9227cbcf3..ab883076d33 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py @@ -48,8 +48,11 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.rings.all import ZZ, RR, QQ, GF -from sage.arith.all import binomial +from sage.rings.integer_ring import ZZ +from sage.rings.real_mpfr import RR +from sage.rings.rational_field import QQ +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.arith.misc import binomial from sage.rings.power_series_ring import PowerSeriesRing from . import hyperelliptic_generic from sage.schemes.hyperelliptic_curves.hypellfrob import hypellfrob diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py index a79843c0e99..030d8dab2e7 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py @@ -12,8 +12,15 @@ # **************************************************************************** -from sage.rings.all import (PowerSeriesRing, PolynomialRing, ZZ, QQ, - pAdicField, GF, RR, RationalField, Infinity) +from sage.rings.power_series_ring import PowerSeriesRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ +from sage.rings.padics.factory import Qp as pAdicField +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.rings.real_mpfr import RR +from sage.rings.rational_field import RationalField +from sage.rings.infinity import Infinity from sage.functions.log import log from sage.modules.free_module import VectorSpace from sage.matrix.constructor import matrix diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py b/src/sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py index e75a071657f..5c7c4b22c5c 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py @@ -90,10 +90,14 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.rings.all import QQ, ZZ, PolynomialRing, FiniteField, NumberField +from sage.rings.rational_field import QQ +from sage.rings.integer_ring import ZZ +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.rings.finite_rings.finite_field_constructor import FiniteField +from sage.rings.number_field.number_field import NumberField from sage.misc.lazy_import import lazy_import from sage.rings.fast_arith import prime_range -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd lazy_import('sage.interfaces.genus2reduction', ['genus2reduction', 'Genus2reduction']) diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py index c7cdf99a83f..21de152a878 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py @@ -8,7 +8,8 @@ # http://www.gnu.org/licenses/ # **************************************************************************** -from sage.rings.all import Integer, QQ +from sage.rings.integer import Integer +from sage.rings.rational_field import QQ from sage.misc.lazy_attribute import lazy_attribute from sage.schemes.jacobians.abstract_jacobian import Jacobian_generic from . import jacobian_homset diff --git a/src/sage/schemes/hyperelliptic_curves/kummer_surface.py b/src/sage/schemes/hyperelliptic_curves/kummer_surface.py index 987099f8d4b..dadf1200f01 100644 --- a/src/sage/schemes/hyperelliptic_curves/kummer_surface.py +++ b/src/sage/schemes/hyperelliptic_curves/kummer_surface.py @@ -12,7 +12,7 @@ from sage.schemes.projective.projective_subscheme\ import AlgebraicScheme_subscheme_projective from sage.categories.homset import Hom -from sage.categories.all import Schemes +from sage.categories.schemes import Schemes # The generic genus 2 curve in Weierstrass form: # diff --git a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py index 8118089acdb..6d0d2403ba8 100644 --- a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py @@ -46,7 +46,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.arith.all import integer_ceil as ceil +from sage.arith.misc import integer_ceil as ceil from sage.arith.misc import binomial from sage.functions.log import log from sage.matrix.constructor import matrix @@ -58,9 +58,16 @@ from sage.modules.free_module import FreeModule from sage.modules.free_module_element import is_FreeModuleElement from sage.modules.module import Module -from sage.rings.all import (Integers, Integer, PolynomialRing, PowerSeriesRing, - Rationals, Rational, LaurentSeriesRing, QQ, ZZ, - IntegralDomain) +from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Integers +from sage.rings.integer import Integer +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.rings.power_series_ring import PowerSeriesRing +from sage.rings.rational_field import RationalField as Rationals +from sage.rings.rational import Rational +from sage.rings.laurent_series_ring import LaurentSeriesRing +from sage.rings.rational_field import QQ +from sage.rings.integer_ring import ZZ +from sage.rings.ring import IntegralDomain from sage.rings.infinity import Infinity from sage.rings.laurent_series_ring import is_LaurentSeriesRing from sage.rings.padics.all import pAdicField diff --git a/src/sage/schemes/plane_conics/con_rational_field.py b/src/sage/schemes/plane_conics/con_rational_field.py index 9a75336901f..8e14d1e2ba7 100644 --- a/src/sage/schemes/plane_conics/con_rational_field.py +++ b/src/sage/schemes/plane_conics/con_rational_field.py @@ -24,7 +24,9 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.rings.all import (PolynomialRing, ZZ, QQ) +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.rings.integer_ring import ZZ +from sage.rings.rational_field import QQ import sage.rings.abc @@ -38,7 +40,8 @@ from sage.structure.element import InfinityElement -from sage.arith.all import lcm, hilbert_symbol +from sage.arith.functions import lcm +from sage.arith.misc import hilbert_symbol class ProjectiveConic_rational_field(ProjectiveConic_number_field): diff --git a/src/sage/schemes/plane_conics/con_rational_function_field.py b/src/sage/schemes/plane_conics/con_rational_function_field.py index 0d1d457f085..d90909145e3 100644 --- a/src/sage/schemes/plane_conics/con_rational_function_field.py +++ b/src/sage/schemes/plane_conics/con_rational_function_field.py @@ -42,7 +42,8 @@ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.matrix.constructor import diagonal_matrix, matrix, block_matrix from sage.schemes.plane_conics.con_field import ProjectiveConic_field -from sage.arith.all import lcm, gcd +from sage.arith.functions import lcm +from sage.arith.misc import GCD as gcd from sage.modules.free_module_element import vector from sage.rings.fraction_field import is_FractionField diff --git a/src/sage/schemes/projective/proj_bdd_height.py b/src/sage/schemes/projective/proj_bdd_height.py index 9034f2d5352..2f90e1cc1f9 100644 --- a/src/sage/schemes/projective/proj_bdd_height.py +++ b/src/sage/schemes/projective/proj_bdd_height.py @@ -23,9 +23,9 @@ from sage.schemes.projective.projective_space import ProjectiveSpace from sage.rings.rational_field import QQ -from sage.rings.all import RealField +from sage.rings.real_mpfr import RealField from sage.rings.number_field.unit_group import UnitGroup -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd from sage.matrix.constructor import matrix, column_matrix from sage.libs.pari.all import pari from sage.modules.free_module_element import vector diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 87ad986bb06..facc90bb53d 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -62,7 +62,8 @@ # **************************************************************************** import sys -from sage.arith.all import gcd, lcm +from sage.arith.misc import GCD as gcd +from sage.arith.functions import lcm from sage.interfaces.singular import singular from sage.misc.misc_c import prod from sage.misc.cachefunc import cached_method diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index d94d108e5d6..84e8741f739 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -40,7 +40,8 @@ from sage.rings.qqbar import number_field_elements_from_algebraics from sage.rings.quotient_ring import QuotientRing_generic from sage.rings.rational_field import QQ -from sage.arith.all import gcd, lcm +from sage.arith.misc import GCD as gcd +from sage.arith.functions import lcm from sage.misc.misc_c import prod from copy import copy diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index c8ecbf6a587..6f3617f22b6 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -40,11 +40,12 @@ from sage.structure.sage_object import SageObject -from sage.matrix.all import matrix, identity_matrix +from sage.matrix.constructor import Matrix as matrix +from sage.matrix.special import identity_matrix from sage.geometry.all import Fan, LatticePolytope, ToricLattice from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd from sage.schemes.toric.variety import (DEFAULT_PREFIX, ToricVariety, normalize_names) diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index c86503bd699..d41c35c5a7b 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -370,7 +370,7 @@ from sage.structure.sequence import Sequence from sage.rings.integer_ring import ZZ -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd from sage.misc.cachefunc import cached_method from sage.matrix.constructor import matrix, identity_matrix from sage.modules.free_module_element import vector diff --git a/src/sage/schemes/toric/points.py b/src/sage/schemes/toric/points.py index 5da8f26a9c5..1815c4fa6f0 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -39,7 +39,7 @@ from sage.misc.misc_c import prod from sage.misc.cachefunc import cached_method -from sage.arith.all import gcd +from sage.arith.misc import GCD as gcd from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.parallel.decorate import Parallel diff --git a/src/sage/version.py b/src/sage/version.py index 5eba7e03759..6c86cab5b29 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,5 +1,5 @@ # Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! -version = '10.0.beta2' -date = '2023-02-23' -banner = 'SageMath version 10.0.beta2, Release Date: 2023-02-23' +version = '10.0.beta3' +date = '2023-03-02' +banner = 'SageMath version 10.0.beta3, Release Date: 2023-03-02'