Summation Notation

Summation Notation

Introduction

  • The greek letter sigma allows us to describe a range of values, and then add them all together.
  • For example, if we want to add the numbers from 1 to 4, we can write: \sum_{n = 1}^{4}n
  • This expands to: 1 + 2 + 3 + 4
  • The value of n starts at 1 (written under the sigma), and ends on 4 (written above the sigma).

A more complex sum

  • In the introductory example, we simply put n after our sigma, however we can write more complex equations too: \sum_{n = 1}^{4}\left ( \frac{1}{n} + n\right )
  • This would expand to: \frac{1}{1} + 1 + \frac{1}{2} + 2 + \frac{1}{3} + 3 + \frac{1}{4} + 4

Summing sets

  • If we have a set of numbers, for example: S = [2, 5, 3], then we can sum it with: \sum_{n=1}^{|S|}S_n
  • Where |S| is the length of the set, and Sn is the nth value of S.
  • This is often simplified to: \sum S

LaTeX

\sum_{n = 1}^{x}

code (Python)

numbers = [1,2,3,4]

summed = sum(numbers)
print(summed) # prints 10