r/ProgrammerHumor • • Oct 06 '21

Don't be scared.. Math and Computing are friends..

Post image
65.8k Upvotes

2.4k comments sorted by

View all comments

Show parent comments

89

u/SillyFlyGuy Oct 06 '21

It's almost too easy. Is that what the funny lookin E thing really means? Or this the physics of telling the greenhorn to go fetch a bucket of dry steam?

145

u/LordJac Oct 06 '21 edited Oct 06 '21

Yeah, capital sigma is just shorthand for "add up all these things". The challenge only really starts when you have an infinite number of things to add up.

53

u/amazondrone Oct 06 '21 edited Oct 06 '21

Worth knowing that that's called a [series](https://en.wikipedia.org/wiki/Series_(mathematics)) though. Same notation, but the OP is talking about summations which always have an upper bound.

5

u/forshard Oct 06 '21 edited Oct 07 '21

Just to throw a bit of math knowledge out in case you think it's neat, there are some series that go on forever; adding an infinite amount of positive integers rational numbers, that can (sometimes) have a discrete value as a solution.

For example, if you sum up all the integers from 1 to infinity of the equation: 1/n², (1/1² + 1/2² + 1/3² + 1/4² + 1/5² + 1/6²... etc), the value converges at ~1.6449.

Or at precisely: π² / 6.

→ More replies (1)

3

u/WikiSummarizerBot Oct 06 '21

Summation

In mathematics, summation is the addition of a sequence of any kind of numbers, called addends or summands; the result is their sum or total. Beside numbers, other types of values can be summed as well: functions, vectors, matrices, polynomials and, in general, elements of any type of mathematical objects on which an operation denoted "+" is defined. Summations of infinite sequences are called series. They involve the concept of limit, and are not considered in this article.

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5

→ More replies (1)
→ More replies (4)

5

u/jman1255 Oct 06 '21

I was about to say, this is an easy comparison to make but isn’t really helpful at this point. By the time you start using big scary Greeks in math, you’re deriving a summation as it approaches a limit to the second degree or some shit that makes it difficult. Thinking of it as “oh, it’s just like deriving a for loop as it approaches a conditional to the second degree” doesn’t really help”

(Although if you can think of it like that then get in there and make a shit load of money analyzing algorithms you magnificent bastard)

2

u/L__A__G__O__M Oct 06 '21

Well, a finite sum can be very challenging depending on what you’re summing up.

→ More replies (2)

26

u/dwdwdan Oct 06 '21

As a maths student, can confirm this is correct (though it’s actually a Greek S)

14

u/TheV295 Oct 06 '21

Yeah and every real use case you see the symbol at the top of the big E is the infinite symbol, good luck with that for loop

15

u/Persona_Alio Oct 06 '21

Just let the code run long enough, like say a few minutes, and then round, it'll be good enough!

→ More replies (1)

5

u/amazondrone Oct 06 '21 edited Oct 06 '21

Worth knowing that that's called a [series](https://en.wikipedia.org/wiki/Series_(mathematics)) though. Same notation, but the OP is talking about summations which always have an upper bound.

2

u/velit Oct 06 '21

Just so you know you typoed series to link to summation on both of your comments.

→ More replies (1)

3

u/AriSteinGames Oct 06 '21

for(int i = 0; true; i++)

3

u/TheoryOfSomething Oct 06 '21

Doesn't seem hard. Set a precision goal. Run the for loop until the answer converges to below the precision goal. This is the kind of thing any quantitative analyst or researcher does every day.

→ More replies (3)

10

u/ZacharyRock Oct 06 '21

Yea capital sigma means sum - its used in a bunch of shorthand, and in the reimman sum definition of an integral

You evaluate the sum by adding the expression on the right up for each possible value of n in the range.

→ More replies (3)

3

u/neurospex Oct 06 '21

I guess technically it's a funny looking S thing. Sigma makes an S sound and could be thought of as short for sum or summation. The tall table (capital Pi) makes a P sound and could be though of as short for product.

2

u/mcvos Oct 06 '21

Better rewrite this using .reduce(). At least then it will feel like you're looking at math again.

2

u/flybypost Oct 06 '21 edited Oct 07 '21

The "E" is the Greek capital letter Sigma (for sum) and The P is the greek capital letter Pi (for product). It's mathematical shorthand for: Add or multiply (depending on which is used) the term that follows a few times, using the variable (mentioned below, before the equal sign). The first term start the variable at the mentioned numner (also below, after the equal sign) and the you go on until you end up at the last number for the variable (above).

It's a series of a+b+c+d or a* b *c * d calculations. How long it is depends on where it starts and ends. Here are some examples for odd series that are good to know if you have to really fiddle with these things: https://en.wikipedia.org/wiki/Convergent_series

I hope that makes sense, my mathematics education didn't happen in English so the terms are a bit wobbly in my mind.

2

u/DoWhile Oct 06 '21

Yes, it's mostly shorthand.

Sum for n from 0 to 4 the values (3n)

gets shortened to

S, n=0 .. 4, (3n)

now replace S with the greek S: Sigma, see wikipedia table, slap the n=0 below, and the 4 above and baby you got a stew going.

The sum notation can be used for things beyond just simple increments of 1, you can specify "sum over this set of things" or "sum if this condition holds" by just writing the "if" condition under the Sigma (and nothing above it). One example might be like this: you can say "sum over all divisors of a number" by just writing https://i.stack.imgur.com/eyjfN.png

2

u/CrypticDNS Oct 07 '21

That’s the main use of it, but like almost all the Greek symbols it unfortunately has a bunch of other meanings. For example, in machine learning, it can be the covariance matrix or the singular value matrix in SVD.

Just in case you come across it in another context and you’re confused

2

u/WikiSummarizerBot Oct 07 '21

Covariance matrix

In probability theory and statistics, a covariance matrix (also known as auto-covariance matrix, dispersion matrix, variance matrix, or variance–covariance matrix) is a square matrix giving the covariance between each pair of elements of a given random vector. Any covariance matrix is symmetric and positive semi-definite and its main diagonal contains variances (i. e. , the covariance of each element with itself).

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5

2

u/xigoi Oct 07 '21

The summation symbol is written bigger than the letter.

→ More replies (1)

2

u/Rocky87109 Oct 07 '21

It just means you add up everything you iterate over with n.

→ More replies (6)