Skip to main content

Python interface to Frank Lübeck's Conway polynomial database

Project description

Python interface to Frank Lübeck’s Conway polynomial database

Introduction

Frank Lübeck maintains a list of pre-computed Conway polynomial coefficients at,

https://www.math.rwth-aachen.de/~Frank.Luebeck/data/ConwayPol/index.html

These are used in several computer algebra systems such as GAP and SageMath to provide quick access to those Conway polynomials. The aim of this package is to make them available through a generic python interface. The package consists of a single module containing a single function that returns a dict of dicts, conway_polynomials.database(). The dictionary’s format is {p: {n: coefficients}}, where p represents your prime and n your degree. The tuple of coefficients is returned in ascending order; that is, the first coefficient (at index zero) is for the constant (degree zero) term.

This package is an evolution of the SageMath conway_polynomials package hosted at,

http://files.sagemath.org/spkg/upstream/conway_polynomials/

and is maintained by the same team of developers. We have kept the versioning scheme consistent to reflect that.

Examples

Retrieve the coefficients of the Conway polynomial for prime p=2 and degree n=5:

>>> import conway_polynomials
>>> cpdb = conway_polynomials.database()
>>> cpdb[2][5]
(1, 0, 1, 0, 0, 1)

The result is cached, so subsequent computations should be fast even if you call the function again:

>>> conway_polynomials.database() is conway_polynomials.database()
True

However, the result is also mutable, so if you need to modify it for some reason then you should create a copy; otherwise your changes will affect future calls:

>>> cpdb = conway_polynomials.database()
>>> cpdb[5][5]
(3, 4, 0, 0, 0, 1)
>>> cpdb[5][5] = (8, 6, 7, 5, 3, 0, 9)
>>> conway_polynomials.database()[5][5]
(8, 6, 7, 5, 3, 0, 9)

Testing

A few doctests within the module (and this README) ensure that everything is working. You can run them from the repository or from a release tarball using:

PYTHONPATH=src python -m doctest \
  README.rst \
  src/conway_polynomials/__init__.py

Or, if you have pytest installed, with simply:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conway_polynomials-0.10.tar.gz (307.4 kB view details)

Uploaded Source

Built Distribution

conway_polynomials-0.10-py3-none-any.whl (212.6 kB view details)

Uploaded Python 3

File details

Details for the file conway_polynomials-0.10.tar.gz.

File metadata

  • Download URL: conway_polynomials-0.10.tar.gz
  • Upload date:
  • Size: 307.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for conway_polynomials-0.10.tar.gz
Algorithm Hash digest
SHA256 4f619f64f81a3eb16c4e26c5a284feeec27a6f4aad647643e79af289801ae0f3
MD5 3c7ee9b53dbc8b65557d9b3339ab29c7
BLAKE2b-256 a4732601b755e76fa1d90f19541d80d43b97bfa1d5c9bc284e79c8f8180ba317

See more details on using hashes here.

File details

Details for the file conway_polynomials-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for conway_polynomials-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a354b4ac0a9985da75e2ac6ec6d7de2902396eff48913eeed86a962486171c28
MD5 41d42238b9cb5e47c4b74c1397daf6f8
BLAKE2b-256 339f78052da6bda316d5105ea027de9978e92d81552dac8f87ca4267488a40d3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page