Summation of Infinite Series

There are three functions for evaluating infinite sums of real numbers. The sum should be specified as a map m from the integers to the real field, such that m(n) is the nth term of the sum. The summation begins at term i. The precision of the result will be the default precision of the real field.

InfiniteSum(m, i) : Map, RngIntElt -> FldReElt
An approximation to the infinite sum m(i) + m(i + 1) + m(i + 2) + ... . This function also works for maps to the complex field.
PositiveSum(m, i) : Map, RngIntElt -> FldReElt
An approximation to the infinite sum m(i) + m(i + 1) + m(i + 2) + ... . Designed for series in which every term is positive, it uses van Wijngaarden's trick for converting the series into an alternating one. Due to the stopping criterion, terms equal to 0 will create problems and should be removed.
AlternatingSum(m, i) : Map, RngIntElt -> FldReElt
    Al: MonStgElt                       Default: "Villegas"
An approximation to the infinite sum m(i) + m(i + 1) + m(i + 2) + ... . Designed for series in which the terms alternate in sign. The optional argument Al can be used to specify the algorithm used. The possible values are "Villegas" (the default), and "EulerVanWijngaarden". Due to the stopping criterion, terms equal to 0 will create problems and should be removed.
V2.28, 13 July 2023