Easy math question: sum /sigma notation


#1

Is this:


more or less the same this:

(for i = 1 ; i <= n ; i ++ )
{
     f(i);
}

Not really a math guy, but my job research (google results) yields more and more math-y stuff.
Usually when seeing lots of formulae My brain goes “too much math, initiate shut down!”
I was always confounded by the “Sigma” notation …


#2

sigma means “for each in range collect the SUM”, so in this case:


result = 0;
(for i = 1 ; i <= n ; i ++ )
{
     result += f(i);
}
return result


#3

thanks, theodox.


#4

could also be written as


( f(1) + f(2) + f(3) ...  + f(n) )

correct?


#5

yep. Or

sum(map(f, values))  

#6

Do we also have a symbol for multiplication and substraction instead of addition ?


#7

exponentation is ‘multiply this by itself this many times’, and negative exponents are ‘divide by itself this many times’.

Also, the part that comes after the sigma is an arbitrary function, so if that function returns negative numbers the results will be subtractions. So

-10(sigma) n = -1 n would sum up (-1…-10)
2(sigma)n=0 cos(n * pi) would sum up the cosines of (0, pi, 2pi) = sum(1,-1,1) = 1
3(sigma)n = 0 2^-n would sum up ( 1, 1/2, 1/4, 1/8)
10(sigma)n=1 5 * n would sum up (5, 10, 15… 50)


#8

According to this it’s called the product, and it looks like the pi symbol.


#9
 
reduce (lambda a, b: a*b, [i for i in range(1,n)])
# can't start a product at zero


#10

thispdf on thesum of an infinite series is a quick , informative read.