Partial sums of series with rational term ratios for interval_dyadic_real #
This file computes partial sums of series with given term ratios by binary splitting. The
interval_dyadic_real extensions evaluate their Taylor series through it.
Implementation notes #
Binary splitting here is the summation technique of Haible and Papanikolaou. It is unrelated to
the binarySplit cover, which bisects intervals.
In a normal evaluator, this divide-and-conquer based approach is faster than linear computation since it reduces the number of computations on larger numerals. However, the performance gain is limited for kernel checks, since GMP arithmetic is still not the bottleneck even at ~10k bits, while the binary splitting approach takes more kernel steps than a simple linear recursion.
An optimisation is implemented where blocks of up to 32 terms are evaluated linearly to reduce the number of kernel steps. The block size is empirical: a smaller block does less arithmetic on large numbers and takes more kernel steps, and therefore would be better for higher precision or faster kernel. A larger block size is faster for the other case (lower precision, slower kernel).
The benefit of this approach is therefore mainly in reducing the recursion depth (O(log n),
compared to O(n) for linear computation) rather than performance.
References #
- B. Haible and T. Papanikolaou, Fast multiprecision evaluation of series of rational numbers, https://www.ginac.de/CLN/binsplit.pdf
- R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, 2nd ed., §5.5
- F. Johansson, hypgeom.h – support for hypergeometric series, Arb documentation, https://arblib.org/hypgeom.html
The sum of a block of consecutive terms of a series with term ratios p j / q j and first
term 1, and the term following the block, as fractions over the common denominator den.
- termNum : R
- den : ℕ
The product of the
q jover the block. It is a natural number so that it can serve as the denominator ofratBall. - sumNum : R
The numerator of the sum of the block over
den.
Instances For
The sum of the first k terms of the series starting with 1 where each later term is
the previous one multiplied by p j / q j for j ∈ [a, a + k - 1), computed by binary splitting.
When p and q are polynomials in j, this is a hypergeometric series in the sense of Graham,
Knuth and Patashnik: factoring p and q into linear factors j + c, the products of the p j
and of the q j become, up to constant factors, products of Pochhammer symbols, as in the usual
ₚF_q form. Nothing here requires p and q to be polynomials, but binary splitting is only
efficient when the factors p j and q j stay small, as they do for polynomials.
If no q j is zero, sumNum / den is the sum (hypergeomPartialSum_spec states this precisely).
The recursion needs termNum to append a term or to join two blocks of terms, since every term
of the later block is scaled by termNum / den.
Equations
- One or more equations did not get rendered due to their size.
Instances For
hypergeomPartialSum sums a series whose term ratios are
t (j + 1) / t j = p (a + j) / q (a + j).