FLINT3.7.0-dev

acb_calc_func_t

Synopsis#include <flint/acb_calc.h>
acb_calc_func_t

The type of an integrand, a pointer to a function

int func(acb_ptr out, const acb_t inp, void * param, slong order, slong prec)

which computes f on the complex ball inp at a precision of about prec bits; param passes user data through. The return value is reserved for an error code and should be 0. out and inp are not aliased.

With order = 0, func writes an enclosure of f(z) for all z in inp to out[0]. Here f may be any function, also discontinuous or non-holomorphic. With order = n \ge 1, func writes the first n Taylor coefficients of f at inp, and must verify that f is holomorphic on inp, writing non-finite values otherwise. The integration algorithms only use order 0 and 1, so derivatives are not needed: with order 1, func computes f and checks holomorphy.

Integrands built from field operations and meromorphic functions need no special care, since division by zero and poles give non-finite enclosures automatically. Functions with branch cuts must detect when inp meets the cut; the functions acb_sqrt_analytic, acb_rsqrt_analytic, acb_log_analytic and acb_pow_analytic do this when their analytic flag is set, and acb_real_abs, acb_real_sgn, acb_real_heaviside, acb_real_floor, acb_real_ceil, acb_real_max, acb_real_min and acb_real_sqrtpos give piecewise holomorphic extensions of real functions. For example, a piecewise holomorphic extension of \sqrt{\lfloor z \rfloor} is

int func(acb_ptr out, const acb_t inp, void * param, slong order, slong prec)
{
    if (order > 1)
        flint_abort();  /* derivatives not implemented */

    acb_real_floor(out, inp, order != 0, prec);
    acb_sqrt_analytic(out, out, order != 0, prec);
    return 0;
}

and a custom function with branch cut detection follows the pattern

/* Square root with detection of the branch cut (-inf, 0]. */
void sqrt_analytic(acb_t res, const acb_t z, int analytic, slong prec)
{
    if (analytic && arb_contains_zero(acb_imagref(z))
                 && arb_contains_nonpositive(acb_realref(z)))
        acb_indeterminate(res);
    else
        acb_sqrt(res, z, prec);
}

The example program examples/integrals.c contains many more integrands.

Cite this page

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