(Redirected from Sum)
:''For evaluation of sums in
closed form see
evaluating sums.''
:''Summation is also a term used to describe a process in
synapse biology.''
'Summation' is the
addition of a set of numbers; the result is their 'sum'. The "numbers" to be summed may be
natural numbers,
complex numbers,
matrices, or still more complicated objects. An infinite sum is a subtle procedure known as a
series. Note that the term 'summation' has a special meaning in the context of
divergent series related to
extrapolation.
Notation
The summation of 1, 2, and 4 is 1 + 2 + 4 = 7. The sum is 7. Since addition is
associative, it does not matter whether we interpret "1 + 2 + 4" as (1 + 2) + 4 or as 1 + (2 + 4); the result is the same, so parentheses are usually omitted in a sum. Finite addition is also
commutative, so the order in which the numbers are written does not affect its sum. (For issues with infinite summation, see
absolute convergence.)
If a sum has too many terms to be written out individually, the sum may be written with an
ellipsis to mark out the missing terms.
Thus, the sum of all the
natural numbers from 1 to 100 is 1 + 2 + … + 99 + 100 = 5050.
Capital sigma notation
Sums can be represented by the summation symbol, a capital
Sigma. This is defined as:
:
The subscript gives the symbol for an
index variable, ''i''. Here, ''i'' represents the 'index of summation'; ''m'' is the 'lower bound of summation', and ''n'' is the 'upper bound of summation'.
We could as well have used ''k'', as in the following example:
:
One often sees generalizations of this notation in which an arbitrary logical condition is supplied, and the sum is intended to be taken over all values satisfying the condition. For example:
:
is the sum of ''f''(''k'') over all (integer) ''k'' in the specified range,
:
is the sum of ''f''(''x'') over all elements ''x'' in the set ''S'', and
:
is the sum of μ(''d'') over all integers ''d'' dividing ''n''.
:(Remark: Although the name of the
dummy variable does not matter (by definition), one usually uses letters from the middle of the alphabet (''i'' through ''q'') to denote integers, if there is a risk of confusion. For example, even if there should be no doubt about the interpretation, it could look slightly confusing to many mathematicians to see ''x'' instead of ''k'' in the above formulae involving ''k''. See also
typographical conventions in mathematical formulae.)
There are also ways to generalize the use of many sigma signs. For example,
:
is the same as
:
Computerized notation
Summations can also be represented in a
programming language.
is computed by the following Visual Basic/VBScript program:
Sum = 0
For I = M To N
Sum = Sum + X(I)
Next I
or the following
C/
C++/
C#/
Java code:
int m, n, i;
int sum = 0;
for (i = m; i <= n; i++)
sum += x[i];
or this
Python expression:
sum(range(m, n + 1))
or this
Perl code:
$sum += $x[$_] for ($m..$n);
or the following
Fortran (or
Matlab) expression:
sum(x(m:n))
Note that most of these examples begin by initialising the sum variable to 0, the
identity element for addition. (See "special cases" below).
Also note that the traditional
notation allows for the upper bound to be less than the lower bound. In this case, the index variable is initialized with the upper bound instead of the lower bound, and it is decremented instead of incremented. Since addition is commutative, this might also be accomplished by swapping the upper and lower bound and incrementing in a positive direction as usual.
The exact meaning of
, and therefore its translation into a programming language, changes depending on the data type of the subscript and upper bound. In other words,
is an
overloaded symbol.
In the above examples, the subscript of
was translated into an assignment statement to an index variable at the beginning of a
for loop. But the subscript is not always an assignment statement. Sometimes the subscript sets up the iterator for a
foreach loop, and sometimes the subscript is itself an array, with no index variable or iterator provided.
In the example below:
:
is an iterator, which implies a
foreach loop, but
is a
set, which is an array-like data structure that can store values of mixed type. The summation routine for a set would have to account for the fact that it is possible to store non-numerical data in a set.
The
return value of
is a
scalar in all examples given above.
Special cases
It is possible to sum fewer than 2 numbers:
★ If you sum the single term ''x'', then the sum is ''x''.
★ If you sum zero terms, then the sum is
zero, because zero is the
identity for addition. This is known as the ''
empty sum''.
These degenerate cases are usually only used when the summation notation gives a degenerate result in a special case.
For example, if ''m'' = ''n'' in the definition above, then there is only one term in the sum; if ''m'' = ''n'' + 1, then there is none.
Approximation by definite integrals
Many such approximations can be obtained by the following connection between sums and integrals, which holds for any:
increasing function ''f'':
:
decreasing function ''f'':
:
For more general approximations, see the
Euler-Maclaurin formula.
For functions that are
integrable on the interval [''a'', ''b''], the
Riemann sum can be used as an approximation of the definite integral. For example, the following formula is the left Riemann sum with equal partitioning of the interval:
:
The accuracy of such an approximation increases with the number ''n'' of subintervals.
Identities
The following are useful identities:
★
★
(see
arithmetic series)
★
★
★
★
:where
is the ''k''th
Bernoulli number.
★
(see
geometric series)
★
(special case of the above where ''m'' = 0)
★
★
★
(see
binomial coefficient)
★
★
★