Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Python extension module wrapping FLINT (Fast Library for Number Theory) and Arb (arbitrary-precision ball arithmetic). Features:
Documentation: http://fredrikj.net/python-flint/
Repository: https://github.com/flintlib/python-flint/
Author: Fredrik Johansson fredrik.johansson@gmail.com
Currently python-flint supports CPython versions 3.9-3.12. For Windows (x86-64)
or OSX (x86-64 or arm64) or Linux (x86-64 manylinux_2_17
) there are CPython
binary wheels for python-flint on PyPI. For these platforms python-flint can be
installed simply with pip
pip install python-flint
Alternatively python-flint can be installed using conda
conda install -c conda-forge python-flint
It is also possible to use python-flint with some PyPy versions. Binary wheels are not provided for this on PyPI but can be installed with conda.
For other platforms or architectures installation needs to build from source. First install FLINT 3. Starting with python-flint 0.5.0 older versions of Flint such as 2.9 are not supported any more. Note that as of Flint 3 Arb no longer needs to be built separately as it is now merged into Flint.
See here for instructions on building FLINT:
The latest release of Python-FLINT can then be built from source and installed using:
pip install --no-binary python-flint python-flint
Python-FLINT can also be installed from a git checkout or a source archive as follows:
pip install .
A script that builds and installs FLINT 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:
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]
0.6.0
--no-build-isolation
.fmpz(6)/fmpz(3)
returns an
exact result fmpz(2)
or raises an error if an exact result is not possible.
Similar changes for fmpz_poly/fmpz
, fmpz_mat/fmpz
, and for polynomial
division with fmpz_poly
, fmpq_poly
, nmod_poly
and fmpz_mod_poly
.fmpz_mod_mat
for matrices of integers mod n
where n
is larger than
word sized.0.5.0
Important compatibility changes:
New features:
fmpz_mod_poly
type for polynomials over fmpz_mod
.fmpz_mod
.fmpz_mod
type for multi-precision integer mods.Bug fixes:
pow(int, int, fmpz)
which previously gave incorrect
results.nmod
type.0.4.4
python-flint
into
submodulesarb_poly
is not supported. Use either the
complex_roots
method or acb_roots(p).roots()
to get the old behaviour of
returning the complex roots. The roots
method on fmpz_poly
and
fmpq_poly
now return integer and rational roots respectively. To access
complex roots on these types, use the complex_roots
method. For acb_poly
,
both roots
and complex_roots
behave the samepython-flint
0.4.3
roots
method of arb_poly
, and nmod_poly
is no longer supported. Use
acb_roots(p).roots()
to get the old behaviour of returning the roots as
acb
. Note that the roots
method of fmpz_poly
and fmpq_poly
currently
returns the complex roots of the polynomial.python-flint
0.4.2
0.4.1
0.4.0
Python-FLINT is licensed MIT. FLINT and Arb are LGPL v2.1+.
FAQs
Bindings for FLINT and Arb
We found that python-flint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.