Package: python-flint
Python-FLINTPython extension module wrapping FLINT (Fast Library for Number Theory)
and Arb (arbitrary-precision ball arithmetic). Features:Integers, rationals, integers mod nReal and complex numbers with rigorous error trackingPolynomials, power series and matrices over all the above typesLots of mathematical functionsDocumentation:http://fredrikj.net/python-flint/Repository:https://github.com/flintlib/python-flint/Author: Fredrik Johanssonfredrik.johansson@gmail.comInstallationCurrently python-flint supports CPython versions 3.9-3.12. For Windows (x86-64)
or OSX (x86-64 or arm64) or Linux (x86-64manylinux_2_17) there are CPython
binary wheels for python-flint on PyPI. For these platforms python-flint can be
installed simply withpippip install python-flintAlternatively python-flint can be installed usingcondaconda install -c conda-forge python-flintIt 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.Build from sourceFor 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:http://flintlib.org/The latest release of Python-FLINT can then be built from source and installed
using:pip install --no-binary python-flint python-flintPython-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:https://github.com/flintlib/python-flint/blob/master/bin/pip_install_ubuntu.shSee the documentation for further notes on building and installing
python-flint:https://fredrikj.net/python-flint/setup.htmlExamplesImport Python-FLINT:>>> from flint import *Number-theoretic functions:>>> fmpz(1000).partitions_p()
24061467864032622473692149727991
>>> fmpq.bernoulli(64)
-106783830147866529886385444979142647942017/510Polynomial 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/46206893947914691316295628839036278726983680000000000Numerical 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.0009999998333333416666664683Numerical integration:>>> ctx.dps = 30
>>> acb.integral(lambda x, _: (-x**2).exp(), -100, 100) ** 2
[3.141592653589793238462643383 +/- 3.11e-28]To doWrite more tests and add missing docstringsWrap missing flint types: finite fields, p-adic numbers, rational functionsVector or array types (maybe)Many convenience methodsWrite generic implementations of functions missing for specific FLINT typesProper handling of special values in various places (throwing Python
exceptions instead of aborting, etc.)Various automatic conversionsConversions to and from external types (numpy, sage, sympy, mpmath, gmpy)Improved printing and string input/outputIPython hooks (TeX pretty-printing etc.)CHANGELOG0.6.0gh-112,gh-111,gh-110,gh-108:
Add pyproject.toml and build dependencies. This means that python-flint can
be built from source without--no-build-isolation.gh-109:
Use exact division for non-field domains. Nowfmpz(6)/fmpz(3)returns an
exact resultfmpz(2)or raises an error if an exact result is not possible.
Similar changes forfmpz_poly/fmpz,fmpz_mat/fmpz, and for polynomial
division withfmpz_poly,fmpq_poly,nmod_polyandfmpz_mod_poly.gh-106:
Addfmpz_mod_matfor matrices of integers modnwherenis larger than
word sized.gh-104:
Bump Flint from 3.0.0 to 3.0.10.5.0Important compatibility changes:gh-80,gh-94,gh-98:
Switch from Flint 2.9 to Flint 3.gh-100:
Supports Python 3.12 by using setuptools instead of numpy.distutils.New features:gh-87:
Addsfmpz_mod_polytype for polynomials overfmpz_mod.gh-85:
Adds discrete logarithms tofmpz_mod.gh-83:
Introduces thefmpz_modtype for multi-precision integer mods.Bug fixes:gh-93:
Fixes a bug withpow(int, int, fmpz)which previously gave incorrect
results.gh-78,gh-79:
minor fixes for thenmodtype.0.4.4gh-75,gh-77:
finish bulk of the work in refactoringpython-flintinto
submodulesgh-72:
The roots method ofarb_polyis not supported. Use either thecomplex_rootsmethod oracb_roots(p).roots()to get the old behaviour of
returning the complex roots. Therootsmethod onfmpz_polyandfmpq_polynow return integer and rational roots respectively. To access
complex roots on these types, use thecomplex_rootsmethod. Foracb_poly,
bothrootsandcomplex_rootsbehave the samegh-71:
Include files in sdist and fix issuegh-70gh-67:
Continue refactoring job to introduce submodules intopython-flint0.4.3gh-63:
Therootsmethod ofarb_poly, andnmod_polyis no longer supported. Useacb_roots(p).roots()to get the old behaviour of returning the roots asacb. Note that therootsmethod offmpz_polyandfmpq_polycurrently
returns the complex roots of the polynomial.gh-61:
Start refactoring job to introduce submodules intopython-flint0.4.2gh-57:
Adds manylinux wheels0.4.1gh-47:
Removes Linux wheels, updates instructions for building from source.0.4.0gh-45:
Adds wheels for Windows, OSX and manylinux but the Linux wheels are broken.LicensePython-FLINT is licensed MIT. FLINT and Arb are LGPL v2.1+.