Skip to content

Sum

Sum[expr, n] returns the sum of n copies of expr.

Sum[expr, {sym, n}] returns the sum of expr evaluated with sym = 1 to n.

Sum[expr, {sym, m, n}] returns the sum of expr evaluated with sym = m to n.

Attributes[Sum] := {HoldAll, Protected, ReadProtected}

Simple examples

In[1]:= Sum[i, {i, 5, 10}]
Out[1]= 45
In[2]:= Sum[i, {i, 1, 10}]
Out[2]= 55
In[3]:= Sum[i, {i, 0, 10}]
Out[3]= 55
In[4]:= Sum[i, {i, 1, 30000}]
Out[4]= 450015000
In[5]:= Sum[i, {i, 0, 30000}]
Out[5]= 450015000
In[6]:= Sum[i, {i, 0, n}]
Out[6]= (1*n*(1 + n))/(2)
In[7]:= Sum[i, {i, 1, n}]
Out[7]= (1*n*(1 + n))/(2)
In[8]:= Sum[a + b, {a, 0, 2}, {b, 0, 3}]
Out[8]= 30
In[9]:= Sum[a, {a, {b, c, d, e}}]
Out[9]= b + c + d + e
In[10]:= Sum[a*f, {a, {b, c, d, e}}, {f, {g, h}}]
Out[10]= b*g + c*g + d*g + e*g + b*h + c*h + d*h + e*h
In[11]:= Sum[i, {i, n*50}]
Out[11]= 25*n*(1 + 50*n)