The p-adic exponential and logarithm
- Cost
- For an argument of valuation to precision : rectangular splitting multiplications of -bit integers plus cheap operations; balanced method bit operations.
The exponential and the logarithm of -adic numbers are defined by the same power series as over the reals,
but the series converge only on small discs, and the denominators and are divisible by for large . The same algorithms are used in (padic, padic_radix) and in the unramified extensions (qadic), where the arguments are polynomials reduced modulo the defining polynomial but the coefficients of the series are the same rational numbers.
Convergence and truncation#
Legendre's formula gives , where is the sum of the base- digits of . Hence , with equality when is a power of .
Lemma 1 (Terms of the exponential). If then , with equality for . The series converges if and only if , that is, for odd and for . In that case every term with has valuation at least , so is a unit.
Proof. The bound follows from Legendre's formula. If , the right-hand side tends to infinity, and it is at least for because it is increasing in . If , the terms with have valuation , so infinitely many terms are not divisible by and the series diverges.
Theorem 2 (Truncation of the exponential). Let and
Then for all , so .
Proof. For we have , which is equivalent to ; apply Lemma 1.
_padic_exp_bound returns this when fits in a slong. For larger it returns , which is correct because then and is a unit for all .
Theorem 3 (Truncation of the logarithm). Let . Then , the series converges, and for every whenever and .
Proof. The first statement holds because . The function satisfies , since increases by at most one from to ; hence for , and .
_padic_log_bound starts from the estimate with and decreases while still holds, returning the least such . The logarithm converges for for every , including ; then has valuation at least .
Rectangular splitting#
A polynomial can be evaluated with multiplications of full-size elements, by computing the powers once and writing the sum as , evaluated by Horner's rule in ; the inner sums need only multiplications by the scalars [PS1973]. With this is about multiplications.
For the exponential, the coefficients are not -adic integers, so FLINT multiplies through by : the coefficients are integers, built block by block as products of small integers, and the sum is computed modulo with . Since is a unit, ; the factors of are removed from and , and the unit part of is inverted modulo (Hensel lifting of inverses, square roots and Teichmüller lifts). The guard digits guarantee that is correct modulo . The logarithm is handled in the same way, with the block denominators in place of and guard digits; each block is scaled by its own inverted denominator times , and the total is divided by at the end.
The cost is multiplications of integers of bits, where , plus multiplications by single-word integers. Small arguments () are handled by explicit formulas.
The balanced method#
Brent's bit-burst method [Bre1976b] evaluates for a real by splitting into pieces with exponentially growing numbers of bits and handling each piece by binary splitting. FLINT uses the -adic analogue. Write the integer representative of modulo in base and cut it at the digit positions :
where consists of the digits below . Then , and each factor is a series with argument of valuation at least , so by Theorem 2 about terms are needed, while the argument has only digits.
Input: an integer and .
Output: integers , and with .
- If , return the values directly.
- Otherwise let , compute for and for recursively, and return , and .
The values are exact integers. At the top level, with , , and since is a unit, : the common power of is removed and the unit part of inverted modulo . For the piece with terms the integers at the root have bits, so the binary splitting costs , and the pieces together cost . For the first piece is zero, since has valuation at least 2.
For the logarithm a product decomposition is needed instead. With , write where holds the digits of below . Then
and has valuation at least 2. Repeating the step on with the cut at , then , and so on, gives with of valuation at least and fewer than digits. Each logarithm is summed by binary splitting of (with the product of the indices), and the divisions by are inversions modulo that reuse one set of precomputed powers (_padic_inv_precomp). The cost is of the same order as for the exponential.
The Satoh–Skjernaa–Taguchi reduction#
Lemma 4. If then ; hence .
Proof. Write with . Then . The middle binomial coefficients are divisible by , so those terms have valuation at least , and has valuation .
Since , the logarithm of modulo is times the logarithm of modulo , and by Lemma 4 the series for the latter has argument of valuation at least , so only about terms. Satoh, Skjernaa and Taguchi used this to compute logarithms in point counting [SST2003]. _padic_log_satoh takes , computes modulo by fmpz_powm, evaluates its logarithm by rectangular splitting and divides by exactly; for it calls _padic_log_rectangular directly.
Use in FLINT#
| Function | Method | Selected by default |
|---|---|---|
_padic_exp_rectangular, padic_exp_rectangular | rectangular splitting | _padic_exp for |
_padic_exp_balanced, padic_exp_balanced | bit-burst with binary splitting | _padic_exp for |
_padic_log_rectangular, padic_log_rectangular | rectangular splitting | _padic_log for |
_padic_log_balanced, padic_log_balanced | product decomposition with binary splitting | _padic_log otherwise |
_padic_log_satoh, padic_log_satoh | power , then rectangular splitting | never |
_qadic_exp_rectangular, _qadic_exp_balanced | as for padic, in | _qadic_exp for , resp. otherwise |
_qadic_log_rectangular, _qadic_log_balanced | as for padic, in | _qadic_log for , resp. otherwise |
_padic_radix_exp_rectangular, _padic_radix_exp_balanced | as above, in radix arithmetic | rectangular for below 80 to 200, depending on the size of |
_padic_radix_log_rectangular, _padic_radix_log_balanced | as above, in radix arithmetic | rectangular for below 80 to 350, depending on the size of |
qadic_norm_analytic computes norms as with these functions (Norm).
The radix versions in padic_radix refine the methods: the rectangular splitting works in fixed point on limbs of radix and defers all denominators to a single inversion; the balanced exponential tracks the factor of each piece as a digit shift, so that the series is evaluated with a working precision of about digits, and uses a precomputed table of powers in the binary splitting tree (the scheme of _arb_exp_sum_bs_powtab).
Referenced from#
- Precision and representation of p-adic numbers (algorithm)
- Arithmetic in unramified extensions (algorithm)
- Exponential and logarithm
- padic_radix.h (module)
- qadic.h (module)
References#
- [PS1973] M. S. Paterson and L. J. Stockmeyer, "On the number of nonscalar multiplications necessary to evaluate polynomials", SIAM J. Comput (1973)
- [Bre1976b] R. P. Brent. The complexity of multiple-precision evaluation of elementary functions. In J. F. Traub (ed.), Analytic Computational Complexity, Academic Press, 1976, 151–176.
- [SST2003] T. Satoh, B. Skjernaa and Y. Taguchi. Fast computation of canonical lifts of elliptic curves and its application to point counting. Finite Fields and Their Applications 9 (2003), 89–101. https://doi.org/10.1016/S1071-5797(02)00013-8
The FLINT team, “The p-adic exponential and logarithm,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/p-adic/exp-log.html (generated 2026-11-02).
@misc{flint-doc-algorithms-p-adic-exp-log,
author = {{The FLINT team}},
title = {{The p-adic exponential and logarithm}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/algorithms/p-adic/exp-log.html},
note = {Generated 2026-11-02}
}