Legacy Documentation

Mathematica® Teacher's Edition (2002)

This is documentation for an obsolete product.
Current products and services
 Documentation /  Mathematica Teacher's Edition /  The Teacher's Book /  Basic Calculations /  Algebra /

6.6 Sums and Products

This constructs the sum .

In[1]:= Sum[x^i/i, {i, 1, 7}]

Out[1]=

You can leave out the lower limit if it is equal to 1.

In[2]:= Sum[x^i/i, {i, 7}]

Out[2]=

This makes increase in steps of , so that only odd-numbered values are included.

In[3]:= Sum[x^i/i, {i, 1, 5, 2}]

Out[3]=

Products work just like sums.

In[4]:= Product[x + i, {i, 1, 4}]

Out[4]=

Sums and products.

Mathematica TE gives an exact result for this sum.

In[5]:= Sum[1/i^3, {i, 1, 20}]

Out[5]=

Here is the numerical value.

In[6]:= N[ % ]

Out[6]=

Mathematica TE cannot give you an exact result for this infinite sum.

In[7]:= Sum[1/i^3, {i, 1, Infinity}]

Out[7]=

You can still get a numerical result.

In[8]:= N[ % ]

Out[8]=

Numerical summation will be discussed in Section 15.7. Mathematica TE also has a notation for multiple sums and products. Sum[f, i, imin, imax, j, jmin, jmax] represents a sum over i and j, which would be written in standard mathematical notation as . Notice that in Mathematica TE notation, as in standard mathematical notation, the range of the outermost variable is given first.

This is the multiple sum . Notice that the outermost sum over i is given first, just as in the mathematical notation.

In[9]:= Sum[x^i y^j, {i, 1, 3}, {j, 1, i}]

Out[9]=

The way the ranges of variables are specified in Sum and Product is an example of the rather general iterator notation that Mathematica TE uses. You will see this notation in the discussion on generating tables and lists using Table (Section 12.2), and you will see it again in the discussion of Do loops (Section 29.6).

Mathematica iterator notation.