BinomSums is a package, for the computer algebra system Maple 17 or later, providing functions to handle multiple binomial sums. It implements the algorithms described in the paper:
A. Bostan, P. Lairez, and B. Salvy, “Multiple binomial sums”
Table of Contents
This is a very preliminary implementation. It is likely to contain bugs. It is provided as is. Do not hesitate to submit bug reports of pull requests.
BinomSums is released under the terms of the MIT license.
See the file LICENSE for more information.
make, this produces the file
- Check that the variable
libnamein Maple contains the path to
binomsums.mlaor to its parent directory.
- Load the package in Maple with
A binomial sum is a Maple expression made with the following rules. For
simplicity, let us assume that Maples indeterminates split in two sets: the
continuous variables and the discrete ones. An
<integer form> is a polynomial
of degree one in the discrete variables, with integer coefficients.
A supergeometric sequence
<supergeom> can be:
- A polynomial in the discrete variables
<rational function of continous variables>^<integer form>
<supergeom> + <supergeom>
<supergeom> * <supergeom>
<binomial sum> can be either primitive:
Binomial(<integer form >, <integer form>)
Delta(<integer form >)
H(<integer form >)
Catalan(<integer form >)
Multinomial([<integer form >, ...])
<binomial sum> can be composed:
<binomial sum> + <binomial sum>
<binomial sum> * <binomial sum>
Sum(<binomial sum>, <discrete variable>=<integer form>..(<integer form> || infinity))
A generating function
<gfun> is a binomial sum whose discrete variables are
all bound by a
Examples of binomial sums
S1 := Binomial(n,k)^2*Multinomial([n,k]); S2 := Sum(t^n*Sum(Binomial(n,k)^2*Multinomial([n,k]), k=0..infinity), n=0..infinity); S3 := Sum(Sum(x^n*y^m*Binomial(n+2*m, m), n=0..infinity), m=0..infinity); S4 := Sum(t^n*Sum(Binomial(n,n-k), k=0..infinity), n=0..infinity);
S4 are generating functions.
Description of the main functions
sumtores(S :: <gfun>, v :: name, [geomred = false]) -> ratpoly, list(name)
Returns a rational function
R and a list of names
The variables in
R are the continuous variables in
The generating function
S is the residue of
R with respect to the
ord gives, by ascending order, the order of the variables defining
the iterated Laurent series field in which the residue is defined (see the
paper for definition).
sumtores fails if it does not find an order on the variables that makes the
infinite sums converge.
geomred=false is given, then the geometric reduction (see the paper for
definition) is not performed.
> sumtores(S2, v); 1 ---------------------------------------------------------------, [t, v, v] (v v - v - v) t + v v (-1 + v) (-1 + v) > sumtores(S3, v); v ---------------------------------, [x, y, v] (y + v (-1 + v)) (x - v) > sumtores(S4, v); Error, (in solvecons) inconsistent
ratres(R :: ratpol, v :: name, ord :: list(name)) -> ratpoly or FAIL
FAIL or a rational function
T that is the residue of
respect to the variable
v in the iterated Laurent series field defined by the
ord. It implements Algorithm 3 of the paper.
> ratres(1/(t*(1+z)^19+z-t), z, [t, z]); 1 -------- 19 t + 1
geomred(R :: ratpoly, ord :: list(name), params :: set(name)) -> ratpoly
Tries to apply
ratres with all the variables of
ord that are not in
params, one after the other, and returns the result.
So it returns a rational function
T with less variables, hopefully, than
such that its residue with respect to the variables in
R that are not in
params is equal to the residue of
S with respect to the variables in
that are not in
computesum(S :: <binomial sum>, maxn :: integer)
S, and then compute the sum. Useful for
checking that things are consistent.
> computesum(S2, 6); 6 5 4 3 2 104959 t + 11253 t + 1251 t + 147 t + 19 t + 3 t + 1
rser(R :: ratpoly, vars :: list(name), n :: posint) -> truncated power series
Compute the first
n terms of the power series expansion of the residue of
with respect to all the variables of
vars except the first one. The ordering
vars defines the iterated Laurent series field in which the computation
takes place. Useful for checking that things are consistent.
> rser(sumtores(S2, v), 7); 2 3 4 5 6 1 + 3 t + 19 t + 147 t + 1251 t + 11253 t + 104959 t
geomredall(R :: ratpoly, ord :: list(name), params :: set(name)) -> set(ratpoly)
The same as
geomred but tries every possible order to eliminate the
sumtoct(S :: <binomial sum>, v :: name) -> <supergeom>
T :: <supergeom>.
S contains no infinite sum, the continuous variables of
T are those of
v, etc. In this case, for any integer value of the
discrete variables, the value of
S is the constant term of
T, with respect
to the variables
v[i]'s, in any order.
T will contain an extra variable
_W[_k] for each infinite sum
k=a..infinity. They are used internally to determine an order on the
variables that makes things converge.
> sumtoct(S1, v); (k + 1) (n - k) (k + 1) (n - k) 1/((1 - v) v (1 - v) v (1 - v - v) n k v v ) > sumtoct(S2, v); - v v v v/((-v v v + t _W[_n]) (_W[_k] v v - v v v + v v + v v - v) (-1 + v + v))