Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute a lattice sum
ResourceFunction["LatticeSum"][monomial,constraints] gives the sum of monomial over all integer lattice points satisfying the constraints. |
Sum xt for t from 0 to infinity:
| In[1]:= |
| Out[1]= |
Sum rxsy for all integer lattice points satisfying x ⩾ 0, y ⩾ 0 and x +y ⩽ 5:
| In[2]:= |
| Out[2]= |
Count the number of integer lattice points satisfying x ⩾ 0, y ⩾ 0 and x + y ⩽ 5:
| In[3]:= |
| Out[3]= |
Compute the number directly:
| In[4]:= |
| Out[4]= |
Compute the sum of xaybzc over non-negative integers satisfying x + y + z ⩽ 5:
| In[5]:= |
| Out[5]= |
Count the total number of non-negative lattice points satisfying x + y + z ⩽ 5:
| In[6]:= |
| Out[6]= |
Visualize these lattice points. Here, we use FindInstance to obtain all the points:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
A complicated example, the algorithm gets the result instantly:
| In[8]:= | ![]() |
| Out[8]= | ![]() |
LatticeSum[monomial, constraints] returns Indeterminate if the constraints are not bounded:
| In[9]:= |
| Out[9]= |
Here z+w is treated as a base of the monomial:
| In[10]:= |
| Out[10]= |
The first input should be a monomial:
| In[11]:= |
| Out[11]= |
Constraint variables cannot be the same as the base variables of the monomial:
| In[12]:= |
| Out[12]= |
All constraints should be linear and have integer or rational coefficients:
| In[13]:= |
| Out[13]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License