passagemath-database-jones-numfield 10.6.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-database-jones-numfield might be problematic. Click here for more details.

@@ -0,0 +1,20 @@
1
+ include VERSION.txt
2
+
3
+ include sage/databases/jones.p*
4
+
5
+ global-exclude all__*.py
6
+ global-include all__sagemath_database_jones_numfield.py
7
+
8
+ global-exclude *.c
9
+ global-exclude *.cpp
10
+
11
+ include repair_wheel.py
12
+
13
+ global-exclude __pycache__
14
+ global-exclude *.py[co]
15
+ global-exclude *.bak
16
+ global-exclude *.so
17
+ global-exclude *~
18
+ prune .tox
19
+ prune build
20
+ prune dist
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: passagemath-database-jones-numfield
3
+ Version: 10.6.5
4
+ Summary: passagemath: Table of number fields
5
+ Author-email: The Sage Developers <sage-support@googlegroups.com>
6
+ Maintainer: Matthias Köppe, passagemath contributors
7
+ License-Expression: GPL-2.0-or-later
8
+ Project-URL: release notes, https://github.com/passagemath/passagemath/releases
9
+ Project-URL: repo (upstream), https://github.com/sagemath/sage
10
+ Project-URL: repo, https://github.com/passagemath/passagemath
11
+ Project-URL: documentation, https://passagemath.org/docs/latest
12
+ Project-URL: homepage (upstream), https://www.sagemath.org
13
+ Project-URL: discourse, https://passagemath.discourse.group
14
+ Project-URL: tracker (upstream), https://github.com/sagemath/sage/issues
15
+ Project-URL: tracker, https://github.com/passagemath/passagemath/issues
16
+ Classifier: Development Status :: 6 - Mature
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: Implementation :: CPython
28
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
29
+ Requires-Python: <3.14,>=3.10
30
+ Description-Content-Type: text/x-rst
31
+ Requires-Dist: passagemath-conf~=10.6.5.0; sys_platform != "win32"
32
+ Requires-Dist: passagemath-environment~=10.6.5.0
33
+
34
+ =====================================
35
+ passagemath: Table of number fields
36
+ =====================================
37
+
38
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
39
+ source mathematical software in Python, released under the GNU General
40
+ Public Licence GPLv2+.
41
+
42
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
43
+ developed 2005-2025 under the motto “Creating a Viable Open Source
44
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
45
+
46
+ The passagemath fork uses the motto "Creating a Free Passage Between the
47
+ Scientific Python Ecosystem and Mathematical Software Communities."
48
+ It was created in October 2024 with the following goals:
49
+
50
+ - providing modularized installation with pip,
51
+ - establishing first-class membership in the scientific Python
52
+ ecosystem,
53
+ - giving `clear attribution of upstream
54
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
55
+ - providing independently usable Python interfaces to upstream
56
+ libraries,
57
+ - offering `platform portability and integration testing
58
+ services <https://github.com/passagemath/passagemath/issues/704>`__
59
+ to upstream projects,
60
+ - inviting collaborations with upstream projects,
61
+ - `building a professional, respectful, inclusive
62
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
63
+ - `empowering Sage users to participate in the scientific Python ecosystem
64
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
65
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
66
+ serverless deployment with Javascript,
67
+ - developing a native Windows port.
68
+
69
+ `Full documentation <https://doc.sagemath.org/html/en/index.html>`__ is
70
+ available online.
71
+
72
+ passagemath attempts to support and provides binary wheels suitable for
73
+ all major Linux distributions and recent versions of macOS.
74
+
75
+ For the Linux aarch64 (ARM) platform, some third-party packages are still missing
76
+ wheels; see the `instructions for building them from source <https://github.com/passagemath/passagemath?tab=readme-ov-file#full-installation-of-passagemath-from-binary-wheels-on-pypi>`__.
77
+
78
+ Binary wheels for native Windows (x86_64) are are available for a subset of
79
+ the passagemath distributions. Use of the full functionality of passagemath
80
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
81
+ or virtualization.
82
+
83
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.13.x.
84
+
85
+
86
+ About this pip-installable distribution package
87
+ -----------------------------------------------
88
+
89
+ This pip-installable distribution ``passagemath-database-jones-numfield`` is a
90
+ distribution of a table of number fields with bounded ramification and degree
91
+ at most 6.
92
+
93
+
94
+ What is included
95
+ ----------------
96
+
97
+ - Wheels on PyPI include the database_jones_numfield files
@@ -0,0 +1,64 @@
1
+ =====================================
2
+ passagemath: Table of number fields
3
+ =====================================
4
+
5
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
6
+ source mathematical software in Python, released under the GNU General
7
+ Public Licence GPLv2+.
8
+
9
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
10
+ developed 2005-2025 under the motto “Creating a Viable Open Source
11
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
12
+
13
+ The passagemath fork uses the motto "Creating a Free Passage Between the
14
+ Scientific Python Ecosystem and Mathematical Software Communities."
15
+ It was created in October 2024 with the following goals:
16
+
17
+ - providing modularized installation with pip,
18
+ - establishing first-class membership in the scientific Python
19
+ ecosystem,
20
+ - giving `clear attribution of upstream
21
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
22
+ - providing independently usable Python interfaces to upstream
23
+ libraries,
24
+ - offering `platform portability and integration testing
25
+ services <https://github.com/passagemath/passagemath/issues/704>`__
26
+ to upstream projects,
27
+ - inviting collaborations with upstream projects,
28
+ - `building a professional, respectful, inclusive
29
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
30
+ - `empowering Sage users to participate in the scientific Python ecosystem
31
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
32
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
33
+ serverless deployment with Javascript,
34
+ - developing a native Windows port.
35
+
36
+ `Full documentation <https://doc.sagemath.org/html/en/index.html>`__ is
37
+ available online.
38
+
39
+ passagemath attempts to support and provides binary wheels suitable for
40
+ all major Linux distributions and recent versions of macOS.
41
+
42
+ For the Linux aarch64 (ARM) platform, some third-party packages are still missing
43
+ wheels; see the `instructions for building them from source <https://github.com/passagemath/passagemath?tab=readme-ov-file#full-installation-of-passagemath-from-binary-wheels-on-pypi>`__.
44
+
45
+ Binary wheels for native Windows (x86_64) are are available for a subset of
46
+ the passagemath distributions. Use of the full functionality of passagemath
47
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
48
+ or virtualization.
49
+
50
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.13.x.
51
+
52
+
53
+ About this pip-installable distribution package
54
+ -----------------------------------------------
55
+
56
+ This pip-installable distribution ``passagemath-database-jones-numfield`` is a
57
+ distribution of a table of number fields with bounded ramification and degree
58
+ at most 6.
59
+
60
+
61
+ What is included
62
+ ----------------
63
+
64
+ - Wheels on PyPI include the database_jones_numfield files
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: passagemath-database-jones-numfield
3
+ Version: 10.6.5
4
+ Summary: passagemath: Table of number fields
5
+ Author-email: The Sage Developers <sage-support@googlegroups.com>
6
+ Maintainer: Matthias Köppe, passagemath contributors
7
+ License-Expression: GPL-2.0-or-later
8
+ Project-URL: release notes, https://github.com/passagemath/passagemath/releases
9
+ Project-URL: repo (upstream), https://github.com/sagemath/sage
10
+ Project-URL: repo, https://github.com/passagemath/passagemath
11
+ Project-URL: documentation, https://passagemath.org/docs/latest
12
+ Project-URL: homepage (upstream), https://www.sagemath.org
13
+ Project-URL: discourse, https://passagemath.discourse.group
14
+ Project-URL: tracker (upstream), https://github.com/sagemath/sage/issues
15
+ Project-URL: tracker, https://github.com/passagemath/passagemath/issues
16
+ Classifier: Development Status :: 6 - Mature
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: Implementation :: CPython
28
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
29
+ Requires-Python: <3.14,>=3.10
30
+ Description-Content-Type: text/x-rst
31
+ Requires-Dist: passagemath-conf~=10.6.5.0; sys_platform != "win32"
32
+ Requires-Dist: passagemath-environment~=10.6.5.0
33
+
34
+ =====================================
35
+ passagemath: Table of number fields
36
+ =====================================
37
+
38
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
39
+ source mathematical software in Python, released under the GNU General
40
+ Public Licence GPLv2+.
41
+
42
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
43
+ developed 2005-2025 under the motto “Creating a Viable Open Source
44
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
45
+
46
+ The passagemath fork uses the motto "Creating a Free Passage Between the
47
+ Scientific Python Ecosystem and Mathematical Software Communities."
48
+ It was created in October 2024 with the following goals:
49
+
50
+ - providing modularized installation with pip,
51
+ - establishing first-class membership in the scientific Python
52
+ ecosystem,
53
+ - giving `clear attribution of upstream
54
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
55
+ - providing independently usable Python interfaces to upstream
56
+ libraries,
57
+ - offering `platform portability and integration testing
58
+ services <https://github.com/passagemath/passagemath/issues/704>`__
59
+ to upstream projects,
60
+ - inviting collaborations with upstream projects,
61
+ - `building a professional, respectful, inclusive
62
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
63
+ - `empowering Sage users to participate in the scientific Python ecosystem
64
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
65
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
66
+ serverless deployment with Javascript,
67
+ - developing a native Windows port.
68
+
69
+ `Full documentation <https://doc.sagemath.org/html/en/index.html>`__ is
70
+ available online.
71
+
72
+ passagemath attempts to support and provides binary wheels suitable for
73
+ all major Linux distributions and recent versions of macOS.
74
+
75
+ For the Linux aarch64 (ARM) platform, some third-party packages are still missing
76
+ wheels; see the `instructions for building them from source <https://github.com/passagemath/passagemath?tab=readme-ov-file#full-installation-of-passagemath-from-binary-wheels-on-pypi>`__.
77
+
78
+ Binary wheels for native Windows (x86_64) are are available for a subset of
79
+ the passagemath distributions. Use of the full functionality of passagemath
80
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
81
+ or virtualization.
82
+
83
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.13.x.
84
+
85
+
86
+ About this pip-installable distribution package
87
+ -----------------------------------------------
88
+
89
+ This pip-installable distribution ``passagemath-database-jones-numfield`` is a
90
+ distribution of a table of number fields with bounded ramification and degree
91
+ at most 6.
92
+
93
+
94
+ What is included
95
+ ----------------
96
+
97
+ - Wheels on PyPI include the database_jones_numfield files
@@ -0,0 +1,14 @@
1
+ MANIFEST.in
2
+ README.rst
3
+ VERSION.txt
4
+ pyproject.toml
5
+ repair_wheel.py
6
+ setup.py
7
+ passagemath_database_jones_numfield.egg-info/PKG-INFO
8
+ passagemath_database_jones_numfield.egg-info/SOURCES.txt
9
+ passagemath_database_jones_numfield.egg-info/dependency_links.txt
10
+ passagemath_database_jones_numfield.egg-info/requires.txt
11
+ passagemath_database_jones_numfield.egg-info/top_level.txt
12
+ sage/all__sagemath_database_jones_numfield.py
13
+ sage/databases/all__sagemath_database_jones_numfield.py
14
+ sage/databases/jones.py
@@ -0,0 +1,4 @@
1
+ passagemath-environment~=10.6.5.0
2
+
3
+ [:sys_platform != "win32"]
4
+ passagemath-conf~=10.6.5.0
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ # Minimum requirements for the build system to execute.
3
+ requires = [
4
+ 'setuptools >= 77.0.0',
5
+ 'passagemath-setup ~= 10.6.5.0',
6
+ 'passagemath-conf ~= 10.6.5.0 ; sys_platform != "win32"',
7
+ 'passagemath-environment ~= 10.6.5.0',
8
+ ]
9
+ build-backend = "setuptools.build_meta"
10
+
11
+ [project]
12
+ name = "passagemath-database-jones-numfield"
13
+ description = "passagemath: Table of number fields"
14
+ dependencies = [
15
+ 'passagemath-conf ~= 10.6.5.0 ; sys_platform != "win32"',
16
+ 'passagemath-environment ~= 10.6.5.0',
17
+ ]
18
+ dynamic = ["version"]
19
+ license = "GPL-2.0-or-later"
20
+ authors = [{name = "The Sage Developers", email = "sage-support@googlegroups.com"}]
21
+ maintainers = [
22
+ {name = "Matthias Köppe"},
23
+ {name = "passagemath contributors"},
24
+ ]
25
+ classifiers = [
26
+ "Development Status :: 6 - Mature",
27
+ "Intended Audience :: Education",
28
+ "Intended Audience :: Science/Research",
29
+ "Operating System :: POSIX",
30
+ "Operating System :: POSIX :: Linux",
31
+ "Operating System :: MacOS :: MacOS X",
32
+ "Programming Language :: Python :: 3 :: Only",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Programming Language :: Python :: 3.13",
37
+ "Programming Language :: Python :: Implementation :: CPython",
38
+ "Topic :: Scientific/Engineering :: Mathematics",
39
+ ]
40
+ requires-python = ">=3.10, <3.14"
41
+
42
+ [project.urls]
43
+ "release notes" = "https://github.com/passagemath/passagemath/releases"
44
+ "repo (upstream)" = "https://github.com/sagemath/sage"
45
+ "repo" = "https://github.com/passagemath/passagemath"
46
+ documentation = "https://passagemath.org/docs/latest"
47
+ "homepage (upstream)" = "https://www.sagemath.org"
48
+ "discourse" = "https://passagemath.discourse.group"
49
+ "tracker (upstream)" = "https://github.com/sagemath/sage/issues"
50
+ "tracker" = "https://github.com/passagemath/passagemath/issues"
51
+
52
+ [project.readme]
53
+ file = "README.rst"
54
+ content-type = "text/x-rst"
55
+
56
+ [tool.setuptools]
57
+ include-package-data = false
58
+
59
+ [tool.setuptools.dynamic]
60
+ version = {file = ["VERSION.txt"]}
@@ -0,0 +1,31 @@
1
+ # Add data to the wheel
2
+
3
+ import os
4
+ import shlex
5
+ import sys
6
+
7
+ from pathlib import Path
8
+
9
+ from auditwheel.wheeltools import InWheel
10
+
11
+ from sage_conf import SAGE_LOCAL
12
+
13
+ if "TMPDIR" in os.environ:
14
+ os.environ["TMPDIR"] = str(Path(os.environ["TMPDIR"]).resolve())
15
+
16
+ wheel = Path(sys.argv[1])
17
+
18
+ with InWheel(wheel, wheel):
19
+ command = f'set -o pipefail; (cd {shlex.quote(SAGE_LOCAL)} && tar cf - --dereference share/jones) | (mkdir -p sage_wheels && cd sage_wheels && tar xvf -)'
20
+ print(f'Running {command}')
21
+ sys.stdout.flush()
22
+ if os.system(f"bash -c {shlex.quote(command)}") != 0:
23
+ sys.exit(1)
24
+
25
+ # Remove the sage-conf dependency; it is not needed because our wheels ship what is needed.
26
+
27
+ command = 'sed -i.bak "/^Requires-Dist: passagemath-conf/d" *.dist-info/METADATA'
28
+ print(f'Running {command}')
29
+ sys.stdout.flush()
30
+ if os.system(f"bash -c {shlex.quote(command)}") != 0:
31
+ sys.exit(1)
@@ -0,0 +1,3 @@
1
+ # sage_setup: distribution = sagemath-database-jones-numfield
2
+
3
+ from sage.databases.all__sagemath_database_jones_numfield import *
@@ -0,0 +1,6 @@
1
+ # sage_setup: distribution = sagemath-database-jones-numfield
2
+ from sage.misc.lazy_import import lazy_import
3
+
4
+ lazy_import('sage.databases.jones', 'JonesDatabase')
5
+
6
+ del lazy_import
@@ -0,0 +1,282 @@
1
+ # sage_setup: distribution = sagemath-database-jones-numfield
2
+ r"""
3
+ John Jones's tables of number fields
4
+
5
+ In order to use the Jones database, the optional :ref:`database_jones_numfield
6
+ <spkg_database_jones_numfield>` package must be installed using the Sage command ::
7
+
8
+ sage -i database_jones_numfield
9
+
10
+ This is a table of number fields with bounded ramification and
11
+ degree `\leq 6`. You can query the database for all number
12
+ fields in Jones's tables with bounded ramification and degree.
13
+
14
+ EXAMPLES: First load the database::
15
+
16
+ sage: J = JonesDatabase()
17
+ sage: J
18
+ John Jones's table of number fields with bounded ramification and degree <= 6
19
+
20
+ List the degree and discriminant of all fields in the database that
21
+ have ramification at most at 2::
22
+
23
+ sage: [(k.degree(), k.disc()) for k in J.unramified_outside([2])] # optional - database_jones_numfield
24
+ [(1, 1), (2, -4), (2, -8), (2, 8), (4, 256), (4, 512), (4, -1024), (4, -2048), (4, 2048), (4, 2048), (4, 2048)]
25
+
26
+ List the discriminants of the fields of degree exactly 2 unramified
27
+ outside 2::
28
+
29
+ sage: [k.disc() for k in J.unramified_outside([2],2)] # optional - database_jones_numfield
30
+ [-4, -8, 8]
31
+
32
+ List the discriminants of cubic field in the database ramified
33
+ exactly at 3 and 5::
34
+
35
+ sage: [k.disc() for k in J.ramified_at([3,5],3)] # optional - database_jones_numfield
36
+ [-135, -675, -6075, -6075]
37
+ sage: factor(6075)
38
+ 3^5 * 5^2
39
+ sage: factor(675)
40
+ 3^3 * 5^2
41
+ sage: factor(135)
42
+ 3^3 * 5
43
+
44
+ List all fields in the database ramified at 101::
45
+
46
+ sage: J.ramified_at(101) # optional - database_jones_numfield
47
+ [Number Field in a with defining polynomial x^2 - 101,
48
+ Number Field in a with defining polynomial x^4 - x^3 + 13*x^2 - 19*x + 361,
49
+ Number Field in a with defining polynomial x^5 + x^4 - 6*x^3 - x^2 + 18*x + 4,
50
+ Number Field in a with defining polynomial x^5 + 2*x^4 + 7*x^3 + 4*x^2 + 11*x - 6,
51
+ Number Field in a with defining polynomial x^5 - x^4 - 40*x^3 - 93*x^2 - 21*x + 17]
52
+ """
53
+
54
+ # ****************************************************************************
55
+ # Sage: Open Source Mathematical Software
56
+ #
57
+ # Copyright (C) 2005 William Stein <wstein@gmail.com>
58
+ #
59
+ # Distributed under the terms of the GNU General Public License (GPL)
60
+ #
61
+ # This code is distributed in the hope that it will be useful,
62
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
63
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64
+ # General Public License for more details.
65
+ #
66
+ # The full text of the GPL is available at:
67
+ #
68
+ # https://www.gnu.org/licenses/
69
+ # ****************************************************************************
70
+
71
+ import os
72
+
73
+ from sage.rings.number_field.number_field import NumberField
74
+ from sage.rings.rational_field import RationalField
75
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
76
+ from sage.combinat.subset import powerset
77
+ from sage.env import SAGE_SHARE
78
+
79
+ from sage.misc.persist import load, save
80
+
81
+ from sage.features.databases import DatabaseJones
82
+
83
+
84
+ def sortkey(K):
85
+ """
86
+ A completely deterministic sorting key for number fields.
87
+
88
+ EXAMPLES::
89
+
90
+ sage: from sage.databases.jones import sortkey
91
+ sage: sortkey(QuadraticField(-3))
92
+ (2, 3, False, x^2 + 3)
93
+ """
94
+ return K.degree(), abs(K.discriminant()), K.discriminant() > 0, K.polynomial()
95
+
96
+
97
+ class JonesDatabase:
98
+ def __init__(self):
99
+ self.root = None
100
+
101
+ def __repr__(self):
102
+ return "John Jones's table of number fields with bounded ramification and degree <= 6"
103
+
104
+ def _load(self, path, filename):
105
+ print(filename)
106
+ i = 0
107
+ while filename[i].isalpha():
108
+ i += 1
109
+ j = len(filename) - 1
110
+ while filename[j].isalpha() or filename[j] in [".", "_"]:
111
+ j -= 1
112
+ S = sorted([eval(z) for z in filename[i:j + 1].split("-")])
113
+ with open(path + "/" + filename) as f:
114
+ data = f.read()
115
+ data = data.replace("^", "**")
116
+ x = PolynomialRing(RationalField(), 'x').gen() # used next line
117
+ v = eval(data)
118
+ s = tuple(S)
119
+ if s in self.root:
120
+ self.root[s] += v
121
+ self.root[s].sort()
122
+ else:
123
+ self.root[s] = v
124
+
125
+ def _init(self, path):
126
+ """
127
+ Create the database from scratch from the PARI files on John Jones's
128
+ web page, downloaded (e.g., via wget) to a local directory, which
129
+ is specified as path above.
130
+
131
+ INPUT:
132
+
133
+ - ``path`` -- (default: works on William Stein install)
134
+ path must be the path to Jones's Number_Fields directory
135
+ (http://hobbes.la.asu.edu/Number_Fields); these files should have
136
+ been downloaded using wget
137
+
138
+ EXAMPLES: This is how to create the database from scratch, assuming
139
+ that the number fields are in the default directory above: From a
140
+ cold start of Sage::
141
+
142
+ sage: J = JonesDatabase()
143
+ sage: J._init() # not tested
144
+ ...
145
+
146
+ This takes about 5 seconds.
147
+ """
148
+ x = PolynomialRing(RationalField(), 'x').gen()
149
+ self.root = {}
150
+ self.root[tuple()] = [x - 1]
151
+ if not os.path.exists(path):
152
+ raise OSError("Path %s does not exist." % path)
153
+ for X in os.listdir(path):
154
+ if X[-4:] == "solo":
155
+ Z = path + "/" + X
156
+ print(X)
157
+ for Y in os.listdir(Z):
158
+ if Y[-3:] == ".gp":
159
+ self._load(Z, Y)
160
+
161
+ data_dir = os.path.dirname(DatabaseJones().absolute_filename())
162
+ os.makedirs(data_dir, exist_ok=True)
163
+ save(self.root, os.path.join(data_dir, "jones.sobj"))
164
+
165
+ def unramified_outside(self, S, d=None, var='a'):
166
+ """
167
+ Return all fields in the database of degree d unramified
168
+ outside S. If d is omitted, return fields of any degree up to 6.
169
+ The fields are ordered by degree and discriminant.
170
+
171
+ INPUT:
172
+
173
+ - ``S`` -- list or set of primes, or a single prime
174
+
175
+ - ``d`` -- ``None`` (default, in which case all fields of degree <= 6 are returned)
176
+ or a positive integer giving the degree of the number fields returned
177
+
178
+ - ``var`` -- the name used for the generator of the number fields (default: ``'a'``)
179
+
180
+ EXAMPLES::
181
+
182
+ sage: J = JonesDatabase() # optional - database_jones_numfield
183
+ sage: J.unramified_outside([101,109]) # optional - database_jones_numfield
184
+ [Number Field in a with defining polynomial x - 1,
185
+ Number Field in a with defining polynomial x^2 - 101,
186
+ Number Field in a with defining polynomial x^2 - 109,
187
+ Number Field in a with defining polynomial x^3 - x^2 - 36*x + 4,
188
+ Number Field in a with defining polynomial x^4 - x^3 + 13*x^2 - 19*x + 361,
189
+ Number Field in a with defining polynomial x^4 - x^3 + 14*x^2 + 34*x + 393,
190
+ Number Field in a with defining polynomial x^5 + x^4 - 6*x^3 - x^2 + 18*x + 4,
191
+ Number Field in a with defining polynomial x^5 + 2*x^4 + 7*x^3 + 4*x^2 + 11*x - 6,
192
+ Number Field in a with defining polynomial x^5 - x^4 - 40*x^3 - 93*x^2 - 21*x + 17]
193
+ """
194
+ try:
195
+ S = list(S)
196
+ except TypeError:
197
+ S = [S]
198
+ Z = []
199
+ for X in powerset(S):
200
+ Z += self.ramified_at(X, d=d, var=var)
201
+ return sorted(Z, key=sortkey)
202
+
203
+ def __getitem__(self, S):
204
+ return self.get(S)
205
+
206
+ def get(self, S, var='a'):
207
+ """
208
+ Return all fields in the database ramified exactly at
209
+ the primes in S.
210
+
211
+ INPUT:
212
+
213
+ - ``S`` -- list or set of primes, or a single prime
214
+
215
+ - ``var`` -- the name used for the generator of the number fields (default: ``'a'``)
216
+
217
+ EXAMPLES::
218
+
219
+ sage: J = JonesDatabase() # optional - database_jones_numfield
220
+ sage: J.get(163, var='z') # optional - database_jones_numfield
221
+ [Number Field in z with defining polynomial x^2 + 163,
222
+ Number Field in z with defining polynomial x^3 - x^2 - 54*x + 169,
223
+ Number Field in z with defining polynomial x^4 - x^3 - 7*x^2 + 2*x + 9]
224
+ sage: J.get([3, 4]) # optional - database_jones_numfield
225
+ Traceback (most recent call last):
226
+ ...
227
+ ValueError: S must be a list of primes
228
+ """
229
+ if self.root is None:
230
+ self.root = load(DatabaseJones().absolute_filename())
231
+ try:
232
+ S = list(S)
233
+ except TypeError:
234
+ S = [S]
235
+ if not all(p.is_prime() for p in S):
236
+ raise ValueError("S must be a list of primes")
237
+ S.sort()
238
+ s = tuple(S)
239
+ if s not in self.root:
240
+ return []
241
+ return [NumberField(f, var, check=False) for f in self.root[s]]
242
+
243
+ def ramified_at(self, S, d=None, var='a'):
244
+ """
245
+ Return all fields in the database of degree d ramified exactly at
246
+ the primes in S. The fields are ordered by degree and discriminant.
247
+
248
+ INPUT:
249
+
250
+ - ``S`` -- list or set of primes
251
+
252
+ - ``d`` -- ``None`` (default, in which case all fields of degree <= 6 are returned)
253
+ or a positive integer giving the degree of the number fields returned
254
+
255
+ - ``var`` -- the name used for the generator of the number fields (default: ``'a'``)
256
+
257
+ EXAMPLES::
258
+
259
+ sage: # optional - database_jones_numfield
260
+ sage: J = JonesDatabase()
261
+ sage: J.ramified_at([101,109])
262
+ []
263
+ sage: J.ramified_at([109])
264
+ [Number Field in a with defining polynomial x^2 - 109,
265
+ Number Field in a with defining polynomial x^3 - x^2 - 36*x + 4,
266
+ Number Field in a with defining polynomial x^4 - x^3 + 14*x^2 + 34*x + 393]
267
+ sage: J.ramified_at(101)
268
+ [Number Field in a with defining polynomial x^2 - 101,
269
+ Number Field in a with defining polynomial x^4 - x^3 + 13*x^2 - 19*x + 361,
270
+ Number Field in a with defining polynomial x^5 + x^4 - 6*x^3 - x^2 + 18*x + 4,
271
+ Number Field in a with defining polynomial x^5 + 2*x^4 + 7*x^3 + 4*x^2 + 11*x - 6,
272
+ Number Field in a with defining polynomial x^5 - x^4 - 40*x^3 - 93*x^2 - 21*x + 17]
273
+ sage: J.ramified_at((2, 5, 29), 3, 'c')
274
+ [Number Field in c with defining polynomial x^3 - x^2 - 8*x - 28,
275
+ Number Field in c with defining polynomial x^3 - x^2 + 10*x + 102,
276
+ Number Field in c with defining polynomial x^3 - x^2 - 48*x - 188,
277
+ Number Field in c with defining polynomial x^3 - x^2 + 97*x - 333]
278
+ """
279
+ Z = self.get(S, var=var)
280
+ if d is not None:
281
+ Z = [k for k in Z if k.degree() == d]
282
+ return sorted(Z, key=sortkey)
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python
2
+
3
+ # PEP 517 builds do not have . in sys.path
4
+ import os
5
+ import sys
6
+ sys.path.insert(0, os.path.dirname(__file__))
7
+
8
+ from sage_setup import sage_setup
9
+
10
+ sage_setup(['sagemath-database-jones-numfield'],
11
+ spkgs=['database_jones_numfield'])