FLINT3.7.0-dev

Examples & tutorials

The examples on function pages are deliberately minimal: they show one function at work. The tutorials in this chapter are longer. Each one solves a small but realistic problem, explains the mathematics behind it and the choices made in the code, and points to the reference documentation and the algorithm pages for details. The programs are complete: they can be compiled and linked as shown in A first program. The documentation checks compile and run every program and compare its output with the output shown.

FLINT's source tree also contains a directory examples of larger programs: command-line tools, demonstrations and benchmarks, some of which were used for record computations. They are described in The example programs, and several tutorials explain the techniques they use with shorter programs.

The tutorials are grouped by topic:

  • Getting started: a first program with integers and polynomials, compiling and linking, a program that combines several modules, and the example programs shipped with FLINT. If FLINT is new to you, start with A first program.
  • Integers and number theory: integers, primes, modular arithmetic and elliptic curves.
  • Polynomials and algebra: programs built on polynomial arithmetic, such as error-correcting codes over finite fields.
  • Linear algebra: matrix computations over exact rings.
  • Rigorous numerics: rigorous numerical computation with ball arithmetic: constants to many digits, special functions, roots of functions and polynomials, integrals and the zeros of the Riemann zeta function.
  • Exact computation: exact computation with algebraic numbers and exact real and complex numbers.

The tutorials assume some familiarity with C and with the mathematics of their topic, but not with FLINT. For the conventions that all modules share (types, memory management, aliasing, threading) see Conventions; for the meaning of the results of ball arithmetic see Ball arithmetic.

Getting started

First programs with FLINT: integers, polynomials and matrices, compiling and linking, and the example programs shipped with FLINT.

Integers and number theory

Programs that compute with integers, primes, modular arithmetic and elliptic curves.

Polynomials and algebra

Programs built on polynomial arithmetic: codes, factorisation, finite fields.

Linear algebra

Programs built on matrix arithmetic over exact rings.

Rigorous numerics

Programs that compute with balls: constants, special functions, roots, integrals and zeta zeros, with guaranteed error bounds and adaptive precision.

TutorialComputing π and other constantsPrecision versus accuracy, reading and printing balls, the built-in constants, and an AGM iteration for π with an explicit truncation error bound; the example programs pi and pi_agm.TutorialChoosing the precision: the logistic map and Hilbert matricesRestarting with doubled precision until the result is accurate, how fast accuracy is lost in an iteration and why the formula matters, and the determinant of ill-conditioned Hilbert matrices; the example programs logistic and hilbert_matrix.TutorialSumming a series with a rigorous error boundA complete rigorous computation from scratch: truncating an infinite series, bounding the tail, choosing the number of terms and the working precision, and verifying the result; with the dilogarithm at 1/2 and Apéry's series for ζ(3).TutorialSpecial functions in ball arithmeticCalling special functions on balls, how input uncertainty and cancellation show up in the output, when to raise the precision, and accurate double-precision values with arb_fpwrap; the example programs fpwrap, complex_plot and functions_benchmark.TutorialIsolating the real roots of a functionCertified isolation of all roots of a real function on an interval by bisection and sign tests, refinement by bisection and by Newton's method with a rigorous error bound, with arb_calc; the example program real_roots.TutorialProving and computing a root with the interval Newton methodA complete rigorous computation from scratch: the interval Newton operator, a proof of existence and uniqueness of a root, exclusion of roots by bisection, and quadratic refinement to 1000 digits with precision doubling, for the omega constant x e^x = 1.TutorialCertified roots of polynomialsAll real and complex roots of integer polynomials with arb_fmpz_poly, multiplicities via squarefree factorisation, and roots of polynomials with inexact coefficients with acb_poly_find_roots and a precision loop; the example program poly_roots.TutorialRigorous numerical integrationIntegrals with guaranteed error bounds using acb_calc_integrate: writing the integrand, holomorphy and branch cuts, piecewise functions, infinite intervals by truncation with a tail bound, and accuracy goals; the example programs integrals, taylor_integrals and integrals_double_exp.TutorialThe Riemann zeta function, its zeros and L-functionsCertified zeros of the Riemann zeta function on the critical line, the Hardy Z-function, Laurent and Taylor coefficients, and Dirichlet L-functions with acb_dirichlet; the example programs zeta_zeros, lvalue, lcentral and keiper_li.

Exact computation

Programs that compute with algebraic and exact real and complex numbers.

Cite this page

The FLINT team, “Examples & tutorials,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/tutorials/index.html (generated 2026-10-20).