Error, (in sum) expecting two arguments - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : System : Error Message Guide : expectingtwoarguments

Error, (in sum) expecting two arguments

 Description A correctly defined sum requires a summand and the index or index range of summation. This error occurs when one of these arguments is not provided.
 Compatibility Note: As a result of updates made in Maple 15, this error message appears in Maple 14 and earlier versions.

Examples

Example 1

In the following example, it is unclear whether the argument represents the summand or the index.

 > $\mathrm{sum}\left(i\right)$

Solution:

For this example, we assume the intention was for the summand and index to both be  You must explicitly state both arguments for sum.

 > $\mathrm{sum}\left(i,i\right)$
 $\frac{{1}}{{2}}{}{{i}}^{{2}}{-}\frac{{1}}{{2}}{}{i}$ (3.1)

Example 2

In the following example, attempting to sum more than one summand at a time results in an error.

 > $\mathrm{sum}\left({i}^{2},i,i\right)$

Solution:

To sum more than one summand at at time, use the map command.

 > $\mathrm{map}\left(\mathrm{sum},\left[{i}^{2},i\right],i\right)$
 $\left[\frac{{1}}{{3}}{}{{i}}^{{3}}{-}\frac{{1}}{{2}}{}{{i}}^{{2}}{+}\frac{{1}}{{6}}{}{i}{,}\frac{{1}}{{2}}{}{{i}}^{{2}}{-}\frac{{1}}{{2}}{}{i}\right]$ (3.2)

Example 3

In the following example, attempting to calculate the sum of over both index variables results in an error. This statement is not well-defined.

 > $\mathrm{sum}\left(i+j,i=1..3,j=6..8\right)$

Solution:

Depending on the interpretation, one possible solution is to express the sum in the following manner:  if the indices are meant to be sequenced individually, then the following statement corrects the error and produces the intended result.

 > $\mathrm{sum}\left(\mathrm{sum}\left(i+j,i=1..3\right),j=6..8\right)$
 ${81}$ (3.3)

Otherwise, if the indices are meant to be sequenced in tandem, then the following statement corrects the error and produces the intended result.

 > $\mathrm{sum}\left(\mathrm{eval}\left(i+j,j=i+5\right),i=1..3\right)$
 ${27}$ (3.4)
 See Also