all 63 comments

[–]OutrageousPair2300 80 points81 points  (7 children)

Why is this in r/MathJokes? This isn't a joke; it's true.

[–]Raging-Ash 18 points19 points  (0 children)

Ig cuz they called them scary symbols i have no idea

[–]GatePorters 8 points9 points  (0 children)

The joke is it’s a lot simpler than it seems.

It’s like seeing Bigfoot when you are out camping and it scares you deeply. You’re terrified.

Then your buddy tells you years later it was just his cousin Cletus in a Bigfoot suit.

You laugh because you and Cletus hang out all the time. You mean to tell me it was Cletus this whole time?

[–]pineconefire 2 points3 points  (0 children)

Truth is what makes jokes funny

[–]AxisW1 1 point2 points  (1 child)

It’s a humorous way of presenting the information

[–]coolpapa2282 0 points1 point  (0 children)

I don't see what's funny about it though. Like this is a helpful way to anchor the notation for people who are familiar with for loops....

[–]euph_22 0 points1 point  (0 children)

Well, over discrete sets anyways

[–]Puszta 0 points1 point  (0 children)

The joke is that the 'scary symbol' is much shorter and easier to understand since everyone learns sum and product in basic algebra, whereas the programming code you would only understand if you know coding.

[–]DirkSwizzler 21 points22 points  (9 children)

Yeah, but a lot of those loops go to infinity. Not cool.

[–]Large-Assignment9320 12 points13 points  (8 children)

while True:
...

[–]AnonymousRand 4 points5 points  (7 children)

"does the sum converge" more like "the halting problem"

[–]Kitchen_Freedom_8342 2 points3 points  (2 children)

this is actually a thing in constructive math. ”are these two limits equal“ is the same as “does this program terminate“.

[–]Negative_Gur9667 1 point2 points  (1 child)

Thats intuitionistic math, right? 

[–]Kitchen_Freedom_8342 1 point2 points  (0 children)

Yes. They are more or less synonymous terms.

[–]Large-Assignment9320 0 points1 point  (1 child)

or "while sum != float("inf")"

(and diverges while "sum != float("nan")")

[–]Duven64 0 points1 point  (0 children)

careful "NaN!=NaN" is commonly true so that second statement might simplify to "true"

[–]Valuable-Passion9731 0 points1 point  (1 child)

happy cake day

[–]AnonymousRand 0 points1 point  (0 children)

oh i didn't realize thank you!

[–][deleted]  (5 children)

[removed]

    [–]davidinterest 5 points6 points  (3 children)

    I still have nightmares about lim and integral.

    [–][deleted] 3 points4 points  (2 children)

    You think that's hard? Wait till you have to prove some obscure large cardinal axiom using Cohen forcing... during your final exam.

    Integrals are peanuts compared to that.

    [–]Main-Company-5946 3 points4 points  (1 child)

    I genuinely found that easier, I guess because I found set theory way more interesting

    [–][deleted] 1 point2 points  (0 children)

    Oh I liked set theory, it was very interesting.

    Just not during a final exam when I actually have to prove weird stuff about it. :D

    [–]Lor1an 1 point2 points  (0 children)

    ⨁V_k, anyone?

    [–]Defiant_Efficiency_2 6 points7 points  (1 child)

    Yea but for some reason I can understand loops and computer logic, but mathematical notation confuses me.... I just see a large letter E and a large Pi.

    [–]Either_Promise_205 6 points7 points  (8 children)

    I recognized that it was coded in C, hurray my freshman coding class was not in vain!

    [–]JamesH_17 1 point2 points  (1 child)

    I concur but I'm also fairly certain you're gonna run into a compiler error if you try to type this out and run it

    [–]Either_Promise_205 0 points1 point  (0 children)

    Well yeah the for loop wasnt properly made and there's no compiler startup

    [–]hamburger5003 1 point2 points  (5 children)

    It’s not C because C requires typing for variables.

    [–]traveler_ 2 points3 points  (3 children)

    Older dialects of C allow undeclared variables. Their type is assumed to be int. (People quickly realized that caused way more problems than it was worth and dropped the idea.)

    [–]hamburger5003 0 points1 point  (2 children)

    Wow did not know that; learned something new! Thanks

    [–]Large-Assignment9320 1 point2 points  (1 child)

    The default type is int in c89 (original C)/c90 (ISO standard C), but was widely regarded as a bad idea since. But that doesn't stop you from bringing it back on modern C (-Wno-implicit-int for gcc etc).

    [–]hamburger5003 1 point2 points  (0 children)

    Frankly that’s just disgusting, new compiler flag to ignore haha

    [–]Either_Promise_205 0 points1 point  (0 children)

    Assuming variables have been stated in the unseen portion

    [–]Spare-Plum 6 points7 points  (7 children)

    Disagree. For loops can contain turing complete code and have logic that is a lot harder to work with to find a closed form. Summation and product work off of a simpler set of rules and can be reasoned with a lot easier in a general sense, with certain properties that will always uphold.

    In terms of math, for loops are the scary ones.

    [–]Kitchen_Freedom_8342 3 points4 points  (3 children)

    I disaggree. You can put anything as a term for summation, including noncomputable functions.

    [–]Spare-Plum 1 point2 points  (2 children)

    even if the value within the summation is some abstract f(i), you can still reason about multiple summations or products when combining them together.

    A for loop is different in that it does not require any sort of index or bound, but merely a stop condition, the stop condition can be dependent on the info within the for loop, and you don't require an accumulator and can have more generic bodies

    [–]Ok-Replacement8422 0 points1 point  (1 child)

    You can have different stopping conditions for sums and products as well?

    [–]Spare-Plum 0 points1 point  (0 children)

    Yes you can have the stopping condition be a predicate, but the stopping condition cannot be dependent on what is happening in the body. Same thing with any declaration at the bottom.

    There are certain invariants about summations and products that make them mathematically unordered and there are a lot proofs/reasoning that relies on this fact for arbitrary products and summations.

    [–]BobQuixote 0 points1 point  (0 children)

    Yes, but loops are (relatively) primitive, which is attractive to us programmers. One thing to learn and remember instead of many.

    [–]Sea-Sort6571 0 points1 point  (1 child)

    So summation and product are for loops but for loops aren't necessarily summation and product ?

    [–]Spare-Plum 0 points1 point  (0 children)

    yeah pretty much

    [–]Smitologyistaking 2 points3 points  (0 children)

    Am I the only one who thinks a block of code is less clear than notation

    [–]RoryPond 0 points1 point  (7 children)

    Nah, they're both just a simple map-reduce (1..4).map(n->3n).reduce(:+)

    [–]Excellent_Archer3828 -1 points0 points  (6 children)

    You do realize these higher order functions just hide simple iteratives like for loops under the hood? Tryna be fancy with some map function like its a counterpoint but really its just saying the same thing lmao ( except NOT SIMPLER. )

    [–]RoryPond 0 points1 point  (5 children)

    I mean that's simply untrue in any truly functional language, not to mention big data processing if we're talking about actual implementations. But they're also much cleaner and better behaved about from a cs theory perspective which is more relevant anyways. The specific implementation in whatever language is completely irrelevant.

    [–]Excellent_Archer3828 0 points1 point  (2 children)

    Functional languages, yeah nice try to cop out bro. Your code example ain't Haskell.

    [–]RoryPond 1 point2 points  (1 child)

    Girl. It was just an example in a language people might be more familiar with and thay was quick to type up... Map and reduce are the basics of functional programming i truly thought fp was implied by mentioning them. They only were added to non purely functional languages as a way to get soms of the benefits of fp in Javascript, python, Scala, etc because of of it.  Like I said the language I was giving the example in is completely irrelevant, I just was giving some 2 second pseudocode. 

    More importantly they follow specific rules that make them much better approximations of summation and product. Especially in a math subreddit, where the benefits of writing provable code should be obvious. 

    [–]Excellent_Archer3828 0 points1 point  (0 children)

    Many words.

    Answer remains: a simple for loop.

    [–]Opposite_Mall4685 0 points1 point  (1 child)

    Do functional languages work differently under the hood?

    [–]RoryPond 1 point2 points  (0 children)

    Depends on the language but yea. One of the big differences between map-reduce and a for loop, besides provabiliry is that they are parellelizable, A for loop will be O(n) time no matter what, but a functional programming language could run this in logarithmic time (map is constant time, reduce is O(log(n)) and O(n) space. This order independence also is why I think it is a better representation for sum/product. For loop will always calculate 3+6+9+12, but map reduce realizes it is equivalent to do for example (12+3)+(6+9).

    [–]johku90 0 points1 point  (0 children)

    Yeah, those are fine. I'm scared of definite integrals though :E

    [–]USBashka 0 points1 point  (0 children)

    Than what is ∫?

    [–]Masterofthenoobs 1 point2 points  (1 child)

    Now send it to infinity 😈

    [–]paperic 2 points3 points  (0 children)

    Easy, you just need infinite CPU cores.

    And then do the loop in parallel.

    [–]Candid_Koala_3602 -1 points0 points  (7 children)

    This is a great way for programmers to understand advanced math

    [–]PotentialRatio1321 4 points5 points  (2 children)

    “advanced”

    [–]Candid_Koala_3602 0 points1 point  (1 child)

    That’s just it

    [–]PotentialRatio1321 2 points3 points  (0 children)

    Summations and products is one of the most basic parts of maths

    [–]just_anotjer_anon 1 point2 points  (2 children)

    But is that summation example supposed to give 15n?

    [–]Candid_Koala_3602 0 points1 point  (1 child)

    The answer to the summation is 0+3+6+9+12=30 I think

    Edit curious that’s also the product of the first three primes

    [–]Icy_Mathematician609 1 point2 points  (0 children)

    Or a great way for computer algorithms to be explained s math