Jump to content

Edit filter log

Details for log entry 915168

02:27, 18 August 2009: 202.174.40.174 (talk) triggered filter 9, performing the action "edit" on Summation. Actions taken: Disallow; Filter description: Personal attacks by unregistered or new user (examine)

Changes made in edit



==Notation==
==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]].)
Jesse Kluske is GAY! he loves to suck big chunky penis.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.
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.

Action parameters

VariableValue
Name of the user account (user_name)
'202.174.40.174'
Page ID (page_id)
'246160'
Page namespace (page_namespace)
0
Page title without namespace (page_title)
'Summation'
Full page title (page_prefixedtitle)
'Summation'
Action (action)
'edit'
Edit summary/reason (summary)
'/* Notation */ '
Whether or not the edit is marked as minor (no longer in use) (minor_edit)
false
Old page wikitext, before the edit (old_wikitext)
'{{redirect4|Sum|Summation}} '''Summation''' is the [[addition]] of a set of numbers; the result is their ''sum'' or ''total''. An [[interim]] or present total of a summation process is termed the ''running total''. The "numbers" to be summed may be [[natural number]]s, [[complex number]]s, [[matrix (mathematics)|matrices]], or still more complicated objects. An infinite sum is a subtle procedure known as a [[series (mathematics)|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. This sum can be achieved using the formula for an arithmetic sequence, <math>\frac{n}{2}(2a+(n-1)d)</math> where ''a'' is the first term (1), ''d'' is the common difference (1) and ''n'' is the number to which the sequence is summed (100). ===Capital-sigma notation=== Mathematical notation has a special representation for compactly representing summation of many similar terms: the ''summation symbol'' ∑ (U+2211), a large upright capital [[Sigma (letter)|Sigma]]. This is defined thus: :<math>\sum_{i=m}^n x_i = x_m + x_{m+1} + x_{m+2} +\dots+ x_{n-1} + x_n. </math> The subscript gives the symbol for an [[Index (mathematics)|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'''. Here ''i'' = ''m'' under the summation symbol means that the index ''i'' starts out equal to ''m''. Successive values of ''i'' are found by adding 1 to the previous value of ''i'', stopping when ''i'' = ''n''. An example: :<math>\sum_{k=2}^6 k^2 = 2^2+3^2+4^2+5^2+6^2 = 90</math>. Informal writing sometimes omits the definition of the index and bounds of summation when these are clear from context, as in :<math>\sum x_i^2 = \sum_{i=1}^n x_i^2</math>. 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: :<math>\sum_{0\le k< 100} f(k)</math> is the sum of ''f''(''k'') over all (integer) ''k'' in the specified range, :<math>\sum_{x\in S} f(x)</math> is the sum of ''f''(''x'') over all elements ''x'' in the set ''S'', and :<math>\sum_{d|n}\;\mu(d)</math> is the sum of &mu;(''d'') over all integers ''d'' dividing ''n''.<ref>Although the name of the [[Free variables and bound variables|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]].</ref> There are also ways to generalize the use of many sigma signs. For example, :<math>\sum_{\ell,\ell'}</math> is the same as :<math>\sum_\ell\sum_{\ell'}.</math> A similar notation is applied when it comes to finding [[product (mathematics)|multiplicative products]]; the same basic structure is used, with ∏, or the capital [[pi (letter)|pi]], replacing the ∑. ===Programming language notation=== Summations can also be represented in a [[programming language]]. Some languages use a notation for summation similar to the mathematical one. For example, this is [[Python (programming language)|Python]]: <source lang="python" enclose="pre"> sum(x[m:n+1]) </source> and this is the [[Perl]] equivalent of the above Python: <source lang="perl" enclose="pre"> use List::Util 'sum'; sum($m..$n); </source> and this is [[Fortran]] (or [[MATLAB]]): <source lang="fortran" enclose="pre"> sum(x(m:n)) </source> and this is [[J (programming language)|J]]: +/x and this is [[Haskell_programming_language|Haskell]]: fold (+) 0 x and this is [[Scheme_programming_language|Scheme]]: (apply + x) In other languages loops are used, as in the following [[Visual Basic]]/[[VBScript]] [[computer program|program]]: <source lang="vb" enclose="pre"> Sum = 0 For I = M To N Sum = Sum + X(I) Next I </source> or the following [[C (programming language)|C]]/[[C++]]/[[C Sharp (programming language)|C#]]/[[Java (programming language)|Java]] code, which assumes that the variables <code>m</code> and <code>n</code> are defined as integer types no wider than <code>int</code>, such that <code>m</code>&nbsp;≤&nbsp;<code>n</code>, and that the variable <code>x</code> is defined as an array of values of integer type no wider than <code>int</code>, containing at least <code>m</code>&nbsp;−&nbsp;<code>n</code>&nbsp;+&nbsp;1 defined elements: <source lang="java" enclose="pre"> int i; int sum = 0; for (i = m; i <= n; i++) { sum = sum + x[i]; } </source> In some cases a loop can be written more concisely, as in this Perl code: <source lang="perl" enclose="pre"> $sum += $x[$_] for ($m..$n); </source> or these alternative [[Ruby (programming language)|Ruby]] expressions: <source lang="ruby" enclose="pre"> x[m..n].inject{|a,b| a+b} x[m..n].inject(0){|a,b| a+b} </source> or in C++, using its standard library: <source lang="cpp" enclose="pre"> std::accumulate(&x[m], &x[n + 1], 0) </source> when <tt>x</tt> is a built-in array or a <tt>std::vector</tt>. Note that most of these examples begin by initializing 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.{{fact|date=July 2009}} Since addition is commutative, this might also be accomplished by swapping the upper and lower bound and incrementing in a positive direction as usual. Also note that the ∑ notation evaluates to a definite value, while most of the loop constructs used above are only valid in an imperative programming language's statement context, requiring the use of an extra variable to hold the final value. It is the variable which would then be used in a larger expression. 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 expression|overloaded symbol]]. In the above examples, the subscript of ∑ was translated into an assignment statement to an index variable at the beginning of a <code>for</code> loop. But the subscript is not always an assignment statement. Sometimes the subscript sets up the iterator for a <code>foreach</code> loop, and sometimes the subscript is itself an array, with no index variable or iterator provided. Other times, the subscript is merely a [[Boolean]] expression that contains an embedded variable, implying to a human, but not to a computer, that every value of the value should be used where the Boolean expression evaluates to true. In the example below: :<math>\sum_{x\in S} f(x)</math> <math>x</math> is an iterator, which implies a <code>foreach</code> loop, but <math>S</math> is a [[Set (mathematics)|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 (computing)|scalar]] in all examples given above. ===Special cases=== It is possible to sum fewer than 2 numbers: *If one sums the single term ''x'', then the sum is ''x''. *If one sums zero terms, then the sum is [[0 (number)|zero]], because zero is the [[identity element|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'', then there is none. ==Approximation by definite integrals== Many such approximations can be obtained by the following connection between sums and [[integral]]s, which holds for any: [[monotonic function|increasing]] function ''f'': :<math>\int_{s=a-1}^{b} f(s)\ ds \le \sum_{i=a}^{b} f(i) \le \int_{s=a}^{b+1} f(s)\ ds.</math> [[monotonic function|decreasing]] function ''f'': :<math>\int_{s=a}^{b+1} f(s)\ ds \le \sum_{i=a}^{b} f(i) \le \int_{s=a-1}^{b} f(s)\ ds.</math> For more general approximations, see the [[Euler–Maclaurin formula]]. For functions that are [[Riemann integral|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: :<math>\frac{b-a}{n}\sum_{i=0}^{n-1} f\left(a+i\frac{b-a}n\right) \approx \int_a^b f(x)\ dx.</math> The accuracy of such an approximation increases with the number ''n'' of subintervals, such that: :<math>\lim_{n\rightarrow \infty} \frac{b-a}{n}\sum_{i=0}^{n-1} f\left(a+i\frac{b-a}n\right) = \int_a^b f(x)\ dx.</math> == Identities == {{see also|List of mathematical series}} The following are useful identities: : <math>\sum_{n=s}^t C\sdot f(n) = C\sdot \sum_{n=s}^t f(n)</math>, where 'C' is a distributed constant. (See [[Scalar multiplication]])<br /><br /> : <math>\sum_{i=s}^n C = (n-s+1)C</math>, where 'C' is a constant.<br /><br /> : <math>\sum_{n=s}^t f(n) + \sum_{n=s}^{t} g(n) = \sum_{n=s}^t \left[f(n) + g(n)\right]</math><br /><br /> : <math>\sum_{n=s}^t f(n) = \sum_{n=s+p}^{t+p} f(n-p)</math><br /><br /> : <math>\sum_{n=s}^j f(n) + \sum_{n=j+1}^t f(n) = \sum_{n=s}^t f(n)</math><br /><br /> : <math>\sum_{i=m}^n x = (n-m+1)x</math><br /><br /> : <math>\sum_{i=1}^n x = nx</math>, definition of multiplication where n is an integer multiplier to x<br /><br /> : <math>\sum_{i=m}^n i = \frac{(n-m+1)(n+m)}{2}</math> (see [[arithmetic series]])<br /><br /> : <math>\sum_{i=0}^n i = \sum_{i=1}^n i = \frac{n(n+1)}{2}</math> (Special case of the arithmetic series)<br /><br /> : <math>\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6} = \frac{n^3}{3} + \frac{n^2}{2} + \frac{n}{6}</math><br /><br /> : <math>\sum_{i=1}^n i^3 = \left(\frac{n(n+1)}{2}\right)^2 = \frac{n^4}{4} + \frac{n^3}{2} + \frac{n^2}{4} = \left[\sum_{i=1}^n i\right]^2</math><br /><br /> : <math>\sum_{i=1}^n i^4 = \frac{n(n+1)(2n+1)(3n^2+3n-1)}{30} = \frac{n^5}{5} + \frac{n^4}{2} + \frac{n^3}{3} - \frac{n}{30}</math><br /><br /> : <math>\sum_{i=0}^n i^p = \frac{(n+1)^{p+1}}{p+1} + \sum_{k=1}^p\frac{B_k}{p-k+1}{p\choose k}(n+1)^{p-k+1}</math><br /><br /> : where <math>B_k</math> is the ''k''th [[Bernoulli number]].<br /><br /> : <math>\sum_{i=m}^n x^i = \frac{x^{n+1}-x^m}{x-1}</math> (see [[geometric series]])<br /><br /> : <math>\sum_{i=0}^n x^i = \frac{1-x^{n+1}}{1-x}</math> (special case of the above where ''m'' = 0)<br /><br /> : <math>\sum_{i=0}^n i 2^i = 2+2^{n+1}(n-1)</math><br /><br /> : <math>\sum_{i=0}^n \frac{i}{2^i} = \frac{2^{n+1}-n-2}{2^n}</math><br /><br /> : <math>\sum_{i=0}^n i x^i = \frac{x}{(1-x)^2} (x^n(n(x-1)-1)+1)</math><br /><br /> : <math>\sum_{i=0}^n i^2 x^i = \frac{x}{(1-x)^3} (1+x-(n+1)^2x^n+(2n^2+2n-1)x^{n+1}-n^2x^{n+2})</math><br /><br /> : <math>\sum_{i=0}^n {n \choose i} = 2^n</math> (see [[binomial coefficient]])<br /><br /> : <math>\sum_{i=0}^{n-1} {i \choose k} = {n \choose k+1}</math><br /><br /> : <math>\left(\sum_i a_i\right)\left(\sum_j b_j\right) = \sum_i\sum_j a_ib_j</math><br /><br /> : <math>\left(\sum_i a_i\right)^2 = 2\sum_i\sum_{j<i} a_ia_j + \sum_i a_i^2</math><br /><br /> : <math>\sum_{n=a}^b f(n) = \sum_{n=b}^{a} f(n)</math><br /><br /> : <math>\sum_{n=s}^t f(n) = \sum_{n=-t}^{-s} f(-n)</math><br /><br /> : <math>\sum_{n=0}^t f(2n) + \sum_{n=0}^t f(2n+1) = \sum_{n=0}^{2t+1} f(n)</math><br /><br /> : <math>\sum_{n=0}^t \sum_{i=0}^{z-1} f(z\sdot n+i) = \sum_{n=0}^{z\sdot t+z-1} f(n)</math><br /><br /> : <math>\widehat{b}^{\left[\sum_{n=s}^t f(n) \right]} = \prod_{n=s}^t \widehat{b}^{f(n)}</math> (See [[Multiplication#Capital pi notation|Product of a series]])<br /><br /> : <math>\sum_{n=s}^t \ln f(n) = \ln \prod_{n=s}^t f(n)</math><br /><br /> : <math>\lim_{t\rightarrow \infty} \sum_{n=a}^t f(n) = \sum_{n=a}^\infty f(n)</math> (See [[Infinite limit#Limit of a function at infinity|Infinite limits]])<br /><br /> : <math>(a + b)^n = \sum_{i=0}^n {n \choose i}a^{(n-i)} b^i</math>, for [[binomial expansion]]<br /><br /> : <math>\sum_{n=b+1}^{\infty} \frac{b}{n^2 - b^2} = \sum_{n=1}^{2b} \frac{1}{2n}</math><br /><br /> : <math>\left(\sum_{i=1}^{n} f_i(x)\right)^\prime = \sum_{i=1}^{n} f_i^\prime(x)</math><br /><br /> : <math>\lim_{n\to\infty}\sum_{i=0}^n f\left(a + \frac{b-a}{n}i\right)\cdot\frac{b-a}{n} = \int_a^b f(x) dx</math><br /><br /> : <math>2^{x-1} + \sum_{n=0}^{x-2} 2^n = x + \sum_{n=0}^{x-2} (2^n \sdot (x - 1 - n))</math><br /><br /> ==Growth rates== The following are useful [[approximation]]s (using [[big O notation|theta notation]]): <br /><br /> : <math>\sum_{i=1}^n i^c = \Theta(n^{c+1})</math> for real ''c'' greater than −1<br /><br /> : <math>\sum_{i=1}^n \frac{1}{i} = \Theta(\log n)</math><br /><br /> : <math>\sum_{i=1}^n c^i = \Theta(c^n)</math> for real ''c'' greater than 1<br /><br /> : <math>\sum_{i=1}^n \log(i)^c = \Theta(n \cdot \log(n)^{c})</math> for [[Negative and non-negative numbers|nonnegative]] real ''c''<br /><br /> : <math>\sum_{i=1}^n \log(i)^c \cdot i^d = \Theta(n^{d+1} \cdot \log(n)^{c})</math> for nonnegative real ''c'', ''d''<br /><br /> : <math>\sum_{i=1}^n \log(i)^c \cdot i^d \cdot b^i = \Theta (n^d \cdot \log(n)^c \cdot b^n)</math> for nonnegative real ''b'' > 1, ''c'', ''d''<br /><br /> ==See also== * [[Einstein notation]] * [[Checksum]] * [[Product (mathematics)]] * [[Kahan summation algorithm]] * [[Iterated binary operation]] ==Notes== {{reflist}} ==Further reading== * [[Nicholas J. Higham]], "[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.3535 The accuracy of floating point summation]", ''SIAM J. Scientific Computing'' '''14''' (4), 783–799 (1993). ==External links== * {{commonscat-inline}} * {{planetmath reference|id=6361|title=Summation}} * [http:/upwiki/wikipedia/commons/6/62/Sum_of_i.pdf Method to Derive Polynomial Representations that Sum Natural Numbers with Exponents] [[Category:Arithmetic]] [[Category:Mathematical notation]] [[be:Сума]] [[ca:Sumatori]] [[cs:Sumace]] [[de:Summe]] [[es:Sumatorio]] [[eu:Batukari]] [[fr:Somme (arithmétique)]] [[hu:Összegzés]] [[is:Summa]] [[it:Sommatoria]] [[nl:Sommatie]] [[ja:総和]] [[no:Sum]] [[pl:Sumowanie]] [[ru:Сумма (математика)]] [[simple:Sum]] [[fi:Summa]] [[sv:Summa]] [[th:ผลรวม]]'
New page wikitext, after the edit (new_wikitext)
'{{redirect4|Sum|Summation}} '''Summation''' is the [[addition]] of a set of numbers; the result is their ''sum'' or ''total''. An [[interim]] or present total of a summation process is termed the ''running total''. The "numbers" to be summed may be [[natural number]]s, [[complex number]]s, [[matrix (mathematics)|matrices]], or still more complicated objects. An infinite sum is a subtle procedure known as a [[series (mathematics)|series]]. Note that the term summation has a special meaning in the context of [[divergent series]] related to [[extrapolation]]. ==Notation== Jesse Kluske is GAY! he loves to suck big chunky penis.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. This sum can be achieved using the formula for an arithmetic sequence, <math>\frac{n}{2}(2a+(n-1)d)</math> where ''a'' is the first term (1), ''d'' is the common difference (1) and ''n'' is the number to which the sequence is summed (100). ===Capital-sigma notation=== Mathematical notation has a special representation for compactly representing summation of many similar terms: the ''summation symbol'' ∑ (U+2211), a large upright capital [[Sigma (letter)|Sigma]]. This is defined thus: :<math>\sum_{i=m}^n x_i = x_m + x_{m+1} + x_{m+2} +\dots+ x_{n-1} + x_n. </math> The subscript gives the symbol for an [[Index (mathematics)|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'''. Here ''i'' = ''m'' under the summation symbol means that the index ''i'' starts out equal to ''m''. Successive values of ''i'' are found by adding 1 to the previous value of ''i'', stopping when ''i'' = ''n''. An example: :<math>\sum_{k=2}^6 k^2 = 2^2+3^2+4^2+5^2+6^2 = 90</math>. Informal writing sometimes omits the definition of the index and bounds of summation when these are clear from context, as in :<math>\sum x_i^2 = \sum_{i=1}^n x_i^2</math>. 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: :<math>\sum_{0\le k< 100} f(k)</math> is the sum of ''f''(''k'') over all (integer) ''k'' in the specified range, :<math>\sum_{x\in S} f(x)</math> is the sum of ''f''(''x'') over all elements ''x'' in the set ''S'', and :<math>\sum_{d|n}\;\mu(d)</math> is the sum of &mu;(''d'') over all integers ''d'' dividing ''n''.<ref>Although the name of the [[Free variables and bound variables|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]].</ref> There are also ways to generalize the use of many sigma signs. For example, :<math>\sum_{\ell,\ell'}</math> is the same as :<math>\sum_\ell\sum_{\ell'}.</math> A similar notation is applied when it comes to finding [[product (mathematics)|multiplicative products]]; the same basic structure is used, with ∏, or the capital [[pi (letter)|pi]], replacing the ∑. ===Programming language notation=== Summations can also be represented in a [[programming language]]. Some languages use a notation for summation similar to the mathematical one. For example, this is [[Python (programming language)|Python]]: <source lang="python" enclose="pre"> sum(x[m:n+1]) </source> and this is the [[Perl]] equivalent of the above Python: <source lang="perl" enclose="pre"> use List::Util 'sum'; sum($m..$n); </source> and this is [[Fortran]] (or [[MATLAB]]): <source lang="fortran" enclose="pre"> sum(x(m:n)) </source> and this is [[J (programming language)|J]]: +/x and this is [[Haskell_programming_language|Haskell]]: fold (+) 0 x and this is [[Scheme_programming_language|Scheme]]: (apply + x) In other languages loops are used, as in the following [[Visual Basic]]/[[VBScript]] [[computer program|program]]: <source lang="vb" enclose="pre"> Sum = 0 For I = M To N Sum = Sum + X(I) Next I </source> or the following [[C (programming language)|C]]/[[C++]]/[[C Sharp (programming language)|C#]]/[[Java (programming language)|Java]] code, which assumes that the variables <code>m</code> and <code>n</code> are defined as integer types no wider than <code>int</code>, such that <code>m</code>&nbsp;≤&nbsp;<code>n</code>, and that the variable <code>x</code> is defined as an array of values of integer type no wider than <code>int</code>, containing at least <code>m</code>&nbsp;−&nbsp;<code>n</code>&nbsp;+&nbsp;1 defined elements: <source lang="java" enclose="pre"> int i; int sum = 0; for (i = m; i <= n; i++) { sum = sum + x[i]; } </source> In some cases a loop can be written more concisely, as in this Perl code: <source lang="perl" enclose="pre"> $sum += $x[$_] for ($m..$n); </source> or these alternative [[Ruby (programming language)|Ruby]] expressions: <source lang="ruby" enclose="pre"> x[m..n].inject{|a,b| a+b} x[m..n].inject(0){|a,b| a+b} </source> or in C++, using its standard library: <source lang="cpp" enclose="pre"> std::accumulate(&x[m], &x[n + 1], 0) </source> when <tt>x</tt> is a built-in array or a <tt>std::vector</tt>. Note that most of these examples begin by initializing 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.{{fact|date=July 2009}} Since addition is commutative, this might also be accomplished by swapping the upper and lower bound and incrementing in a positive direction as usual. Also note that the ∑ notation evaluates to a definite value, while most of the loop constructs used above are only valid in an imperative programming language's statement context, requiring the use of an extra variable to hold the final value. It is the variable which would then be used in a larger expression. 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 expression|overloaded symbol]]. In the above examples, the subscript of ∑ was translated into an assignment statement to an index variable at the beginning of a <code>for</code> loop. But the subscript is not always an assignment statement. Sometimes the subscript sets up the iterator for a <code>foreach</code> loop, and sometimes the subscript is itself an array, with no index variable or iterator provided. Other times, the subscript is merely a [[Boolean]] expression that contains an embedded variable, implying to a human, but not to a computer, that every value of the value should be used where the Boolean expression evaluates to true. In the example below: :<math>\sum_{x\in S} f(x)</math> <math>x</math> is an iterator, which implies a <code>foreach</code> loop, but <math>S</math> is a [[Set (mathematics)|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 (computing)|scalar]] in all examples given above. ===Special cases=== It is possible to sum fewer than 2 numbers: *If one sums the single term ''x'', then the sum is ''x''. *If one sums zero terms, then the sum is [[0 (number)|zero]], because zero is the [[identity element|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'', then there is none. ==Approximation by definite integrals== Many such approximations can be obtained by the following connection between sums and [[integral]]s, which holds for any: [[monotonic function|increasing]] function ''f'': :<math>\int_{s=a-1}^{b} f(s)\ ds \le \sum_{i=a}^{b} f(i) \le \int_{s=a}^{b+1} f(s)\ ds.</math> [[monotonic function|decreasing]] function ''f'': :<math>\int_{s=a}^{b+1} f(s)\ ds \le \sum_{i=a}^{b} f(i) \le \int_{s=a-1}^{b} f(s)\ ds.</math> For more general approximations, see the [[Euler–Maclaurin formula]]. For functions that are [[Riemann integral|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: :<math>\frac{b-a}{n}\sum_{i=0}^{n-1} f\left(a+i\frac{b-a}n\right) \approx \int_a^b f(x)\ dx.</math> The accuracy of such an approximation increases with the number ''n'' of subintervals, such that: :<math>\lim_{n\rightarrow \infty} \frac{b-a}{n}\sum_{i=0}^{n-1} f\left(a+i\frac{b-a}n\right) = \int_a^b f(x)\ dx.</math> == Identities == {{see also|List of mathematical series}} The following are useful identities: : <math>\sum_{n=s}^t C\sdot f(n) = C\sdot \sum_{n=s}^t f(n)</math>, where 'C' is a distributed constant. (See [[Scalar multiplication]])<br /><br /> : <math>\sum_{i=s}^n C = (n-s+1)C</math>, where 'C' is a constant.<br /><br /> : <math>\sum_{n=s}^t f(n) + \sum_{n=s}^{t} g(n) = \sum_{n=s}^t \left[f(n) + g(n)\right]</math><br /><br /> : <math>\sum_{n=s}^t f(n) = \sum_{n=s+p}^{t+p} f(n-p)</math><br /><br /> : <math>\sum_{n=s}^j f(n) + \sum_{n=j+1}^t f(n) = \sum_{n=s}^t f(n)</math><br /><br /> : <math>\sum_{i=m}^n x = (n-m+1)x</math><br /><br /> : <math>\sum_{i=1}^n x = nx</math>, definition of multiplication where n is an integer multiplier to x<br /><br /> : <math>\sum_{i=m}^n i = \frac{(n-m+1)(n+m)}{2}</math> (see [[arithmetic series]])<br /><br /> : <math>\sum_{i=0}^n i = \sum_{i=1}^n i = \frac{n(n+1)}{2}</math> (Special case of the arithmetic series)<br /><br /> : <math>\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6} = \frac{n^3}{3} + \frac{n^2}{2} + \frac{n}{6}</math><br /><br /> : <math>\sum_{i=1}^n i^3 = \left(\frac{n(n+1)}{2}\right)^2 = \frac{n^4}{4} + \frac{n^3}{2} + \frac{n^2}{4} = \left[\sum_{i=1}^n i\right]^2</math><br /><br /> : <math>\sum_{i=1}^n i^4 = \frac{n(n+1)(2n+1)(3n^2+3n-1)}{30} = \frac{n^5}{5} + \frac{n^4}{2} + \frac{n^3}{3} - \frac{n}{30}</math><br /><br /> : <math>\sum_{i=0}^n i^p = \frac{(n+1)^{p+1}}{p+1} + \sum_{k=1}^p\frac{B_k}{p-k+1}{p\choose k}(n+1)^{p-k+1}</math><br /><br /> : where <math>B_k</math> is the ''k''th [[Bernoulli number]].<br /><br /> : <math>\sum_{i=m}^n x^i = \frac{x^{n+1}-x^m}{x-1}</math> (see [[geometric series]])<br /><br /> : <math>\sum_{i=0}^n x^i = \frac{1-x^{n+1}}{1-x}</math> (special case of the above where ''m'' = 0)<br /><br /> : <math>\sum_{i=0}^n i 2^i = 2+2^{n+1}(n-1)</math><br /><br /> : <math>\sum_{i=0}^n \frac{i}{2^i} = \frac{2^{n+1}-n-2}{2^n}</math><br /><br /> : <math>\sum_{i=0}^n i x^i = \frac{x}{(1-x)^2} (x^n(n(x-1)-1)+1)</math><br /><br /> : <math>\sum_{i=0}^n i^2 x^i = \frac{x}{(1-x)^3} (1+x-(n+1)^2x^n+(2n^2+2n-1)x^{n+1}-n^2x^{n+2})</math><br /><br /> : <math>\sum_{i=0}^n {n \choose i} = 2^n</math> (see [[binomial coefficient]])<br /><br /> : <math>\sum_{i=0}^{n-1} {i \choose k} = {n \choose k+1}</math><br /><br /> : <math>\left(\sum_i a_i\right)\left(\sum_j b_j\right) = \sum_i\sum_j a_ib_j</math><br /><br /> : <math>\left(\sum_i a_i\right)^2 = 2\sum_i\sum_{j<i} a_ia_j + \sum_i a_i^2</math><br /><br /> : <math>\sum_{n=a}^b f(n) = \sum_{n=b}^{a} f(n)</math><br /><br /> : <math>\sum_{n=s}^t f(n) = \sum_{n=-t}^{-s} f(-n)</math><br /><br /> : <math>\sum_{n=0}^t f(2n) + \sum_{n=0}^t f(2n+1) = \sum_{n=0}^{2t+1} f(n)</math><br /><br /> : <math>\sum_{n=0}^t \sum_{i=0}^{z-1} f(z\sdot n+i) = \sum_{n=0}^{z\sdot t+z-1} f(n)</math><br /><br /> : <math>\widehat{b}^{\left[\sum_{n=s}^t f(n) \right]} = \prod_{n=s}^t \widehat{b}^{f(n)}</math> (See [[Multiplication#Capital pi notation|Product of a series]])<br /><br /> : <math>\sum_{n=s}^t \ln f(n) = \ln \prod_{n=s}^t f(n)</math><br /><br /> : <math>\lim_{t\rightarrow \infty} \sum_{n=a}^t f(n) = \sum_{n=a}^\infty f(n)</math> (See [[Infinite limit#Limit of a function at infinity|Infinite limits]])<br /><br /> : <math>(a + b)^n = \sum_{i=0}^n {n \choose i}a^{(n-i)} b^i</math>, for [[binomial expansion]]<br /><br /> : <math>\sum_{n=b+1}^{\infty} \frac{b}{n^2 - b^2} = \sum_{n=1}^{2b} \frac{1}{2n}</math><br /><br /> : <math>\left(\sum_{i=1}^{n} f_i(x)\right)^\prime = \sum_{i=1}^{n} f_i^\prime(x)</math><br /><br /> : <math>\lim_{n\to\infty}\sum_{i=0}^n f\left(a + \frac{b-a}{n}i\right)\cdot\frac{b-a}{n} = \int_a^b f(x) dx</math><br /><br /> : <math>2^{x-1} + \sum_{n=0}^{x-2} 2^n = x + \sum_{n=0}^{x-2} (2^n \sdot (x - 1 - n))</math><br /><br /> ==Growth rates== The following are useful [[approximation]]s (using [[big O notation|theta notation]]): <br /><br /> : <math>\sum_{i=1}^n i^c = \Theta(n^{c+1})</math> for real ''c'' greater than −1<br /><br /> : <math>\sum_{i=1}^n \frac{1}{i} = \Theta(\log n)</math><br /><br /> : <math>\sum_{i=1}^n c^i = \Theta(c^n)</math> for real ''c'' greater than 1<br /><br /> : <math>\sum_{i=1}^n \log(i)^c = \Theta(n \cdot \log(n)^{c})</math> for [[Negative and non-negative numbers|nonnegative]] real ''c''<br /><br /> : <math>\sum_{i=1}^n \log(i)^c \cdot i^d = \Theta(n^{d+1} \cdot \log(n)^{c})</math> for nonnegative real ''c'', ''d''<br /><br /> : <math>\sum_{i=1}^n \log(i)^c \cdot i^d \cdot b^i = \Theta (n^d \cdot \log(n)^c \cdot b^n)</math> for nonnegative real ''b'' > 1, ''c'', ''d''<br /><br /> ==See also== * [[Einstein notation]] * [[Checksum]] * [[Product (mathematics)]] * [[Kahan summation algorithm]] * [[Iterated binary operation]] ==Notes== {{reflist}} ==Further reading== * [[Nicholas J. Higham]], "[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.3535 The accuracy of floating point summation]", ''SIAM J. Scientific Computing'' '''14''' (4), 783–799 (1993). ==External links== * {{commonscat-inline}} * {{planetmath reference|id=6361|title=Summation}} * [http:/upwiki/wikipedia/commons/6/62/Sum_of_i.pdf Method to Derive Polynomial Representations that Sum Natural Numbers with Exponents] [[Category:Arithmetic]] [[Category:Mathematical notation]] [[be:Сума]] [[ca:Sumatori]] [[cs:Sumace]] [[de:Summe]] [[es:Sumatorio]] [[eu:Batukari]] [[fr:Somme (arithmétique)]] [[hu:Összegzés]] [[is:Summa]] [[it:Sommatoria]] [[nl:Sommatie]] [[ja:総和]] [[no:Sum]] [[pl:Sumowanie]] [[ru:Сумма (математика)]] [[simple:Sum]] [[fi:Summa]] [[sv:Summa]] [[th:ผลรวม]]'
Whether or not the change was made through a Tor exit node (tor_exit_node)
0
Unix timestamp of change (timestamp)
1250562478