Python-FLINT
Python extension module wrapping FLINT (Fast Library for Number Theory) and Arb (arbitrary-precision ball arithmetic). Features:
- Integers, rationals, integers mod n
- Real and complex numbers with rigorous error tracking
- Polynomials, power series and matrices over all the above types
- Lots of mathematical functions
Documentation: http://fredrikj.net/python-flint/
Repository: https://github.com/fredrik-johansson/python-flint/
Author: Fredrik Johansson fredrik.johansson@gmail.com
Installation
On Windows (x86-64) or OSX (x86-64 or arm64) there are prebuilt wheels for python-flint 0.4.1 that can be installed from PyPI using pip
pip install python-flint
There is currently a problem with the Linux wheels and so for now Linux wheels are not available on PyPI. Instead for Linux first install both FLINT 2.9.0 and Arb 2.23. Note that as of python-flint 0.4.1 only these exact versions of FLINT and Arb will work. While some Linux distributions may provide FLINT and Arb it is unlikely that they will provide the exact versions required (e.g. for Ubuntu only Ubuntu 23.04 provides these versions at the time of writing).
See here for instructions on building FLINT and Arb:
The latest release of Python-FLINT can then be built and installed using:
pip install 'cython>=3' numpy wheel
pip install --no-build-isolation python-flint
Python-FLINT can also be installed from a git checkout or a source archive as follows:
pip install 'cython>=3' numpy wheel
pip install --no-build-isolation .
A script that builds and installs FLINT, Arb and Python-FLINT that is tested on Ubuntu can be found in the git repo here:
See the documentation for further notes on building and installing Python-FLINT:
Examples
Import Python-FLINT:
>>> from flint import *
Number-theoretic functions:
>>> fmpz(1000).partitions_p()
24061467864032622473692149727991
>>> fmpq.bernoulli(64)
-106783830147866529886385444979142647942017/510
Polynomial arithmetic:
>>> a = fmpz_poly([1,2,3]); b = fmpz_poly([2,3,4]); a.gcd(a * b)
3*x^2 + 2*x + 1
>>> a = fmpz_poly(list(range(10001))); b = fmpz_poly(list(range(10000))); a.gcd(a * b).degree()
10000
>>> x = fmpz_poly([0,1]); ((1-x**2)*(1+x**3)**3*(1+x+2*x)).factor()
(-1, [(3*x + 1, 1), (x + (-1), 1), (x^2 + (-1)*x + 1, 3), (x + 1, 4)])
Matrix arithmetic:
>>> fmpz_mat([[1,1],[1,0]]) ** 10
[89, 55]
[55, 34]
>>> fmpq_mat.hilbert(10,10).det()
1/46206893947914691316295628839036278726983680000000000
Numerical evaluation:
>>> showgood(lambda: (arb.pi() * arb(163).sqrt()).exp() - 640320**3 - 744, dps=25)
-7.499274028018143111206461e-13
>>> showgood(lambda: (arb.pi() * 10**100 + arb(1)/1000).sin(), dps=25)
0.0009999998333333416666664683
Numerical integration:
>>> ctx.dps = 30
>>> acb.integral(lambda x, _: (-x**2).exp(), -100, 100) ** 2
[3.141592653589793238462643383 +/- 3.11e-28]
To do
- Write more tests and add missing docstrings
- Wrap missing flint types: finite fields, p-adic numbers, multiprecision integer mods, rational functions
- Vector or array types (maybe)
- Many convenience methods
- Write generic implementations of functions missing for specific FLINT types
- Proper handling of special values in various places (throwing Python exceptions instead of aborting, etc.)
- Various automatic conversions
- Conversions to and from external types (numpy, sage, sympy, mpmath, gmpy)
- Improved printing and string input/output
- IPython hooks (TeX pretty-printing etc.)
License
Python-FLINT is licensed MIT. FLINT and Arb are LGPL v2.1+.
Metadata
Release files for python-flint 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-flint-0.4.1.tar.gz | 1.1 MB | Without provenance | Details for python-flint-0.4.1.tar.gz |
Built distributions (wheels)
Total release size: 66.5 MB
Release files / python-flint-0.4.1.tar.gz
| Download URL | python-flint-0.4.1.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
652dc0b87d2b76d9297d8c4b1284de0ad57ef97ff8784349aa2a1dc21ef6c1b8
|
|
BLAKE2b-256 checksum How to use checksums |
48b0a7e5218bf54326a96407f06637f30e84f6ef51597e731996a8cc70408960
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp311-cp311-win_amd64.whl
| Download URL | python_flint-0.4.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 9.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e2799cfd3528258e87dfae68b8438169d955906ecb55a070331353d15d8731d9
|
|
BLAKE2b-256 checksum How to use checksums |
b0b359a70d4f63e5575fd7e8b87487d8cdf39f329059d0bccb39299c353a9a55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | python_flint-0.4.1-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c5da9a3de56a45eac674bf634f16f1f1b77a47d09123ad9c6c1b0145bd8031cd
|
|
BLAKE2b-256 checksum How to use checksums |
24d3d0e7ed3d101d2bef36927fca17f40f9359b8bcaacd495305c48f0c651729
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | python_flint-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
fc2691ffbd553af7fcc1b8f7de3320681cbc3122100be7cfe37841fb74665a9a
|
|
BLAKE2b-256 checksum How to use checksums |
8887cd0e6c7fd3ea4dc7667cf92822cb3883244f8859117cc45fb6b5a74d53c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp310-cp310-win_amd64.whl
| Download URL | python_flint-0.4.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 9.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
45869c8d2b91ac2c5b49832962e5993fb32968ef6cd962694f1d070feffa8eaf
|
|
BLAKE2b-256 checksum How to use checksums |
4436f0e5e3cf2d2a146bd0f9baab75061c485be9016f76419f0ed853f7c69afc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | python_flint-0.4.1-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0a57389cb39c10493baec50eeef857ff9f256c4d70491a09d1e78ce86d36e08a
|
|
BLAKE2b-256 checksum How to use checksums |
8fb4e72f54323c95334ba19c1df6b59c14c1b1c0c51a34aaee1051058dc095a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | python_flint-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
129afe7bfea6e47cff44705d924a66e62706c01bef732e402f474d431329da2c
|
|
BLAKE2b-256 checksum How to use checksums |
8994ad472ef1e130794ed2446572a555f4ad2b91068c0c8569934085e772e2fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp39-cp39-win_amd64.whl
| Download URL | python_flint-0.4.1-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 9.7 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
99249e77c5de97fe8a1a104f7bf429047febd73ad96616a288885b107d0207aa
|
|
BLAKE2b-256 checksum How to use checksums |
b96801cfa6507f9951b8e5e5eabb0ec5de940c79e467da5ce8b0e174114584f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | python_flint-0.4.1-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
67f8dc4fe493711f5d3330c69ad0c6240ecf12e81646dc4d073adb8fdb7f3e29
|
|
BLAKE2b-256 checksum How to use checksums |
537abae784a8172f3c2c295a1801fceeda676bd1e8c8f716f01f004da25936ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / python_flint-0.4.1-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | python_flint-0.4.1-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
72596f102c3eb8cb1b6b64981fa01484a2d498de98b51cb7d87b37705848e7df
|
|
BLAKE2b-256 checksum How to use checksums |
e8d04f656b3d511b703f702cc0a2c78eb767be547b48b4a2b96f1a78203cadca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for python-flint 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.