r/ProgrammerHumor • • Oct 06 '21

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

Post image
65.8k Upvotes

2.4k comments sorted by

1.8k

u/Hinke1 Oct 06 '21

Now do the same for great Zeta next

631

u/Dark_Diosito Oct 06 '21

Zeta is the Riemann function right?

506

u/Baldhiver Oct 06 '21

The Riemann zeta function is one of many zeta functions, yes

→ More replies (18)

22

u/[deleted] Oct 06 '21

the riemann zeta function is an extension of the zeta function, though the original zeta function was just the infinite sum of 1/nx

→ More replies (6)
→ More replies (1)

6

u/[deleted] Oct 07 '21 edited Oct 07 '21

Something like:

import scipy
def riemann_zeta(s,iter=200):
    a = 1/(1-2**(1-s))
    b = 0
    for n in range(iter):
        t1 = 1/(2**(n+1))
        t2 = 0
        for k in range(n+1):
            t2 += ((-1)**k)*scipy.special.binom(n,k)*((k+1)**(-s))
        b += t1*t2
    return a*b

5

u/axialintellectual Oct 06 '21

Or Einstein notation, aka "Do you know how annoying it is to write these \Sigma-symbols all the time without having them start to look like crap?"

And then Feynman comes along...

4

u/[deleted] Oct 06 '21

That can be written as a product (thanks Euler)

https://en.m.wikipedia.org/wiki/Euler_product

→ More replies (2)
→ More replies (4)

4.4k

u/SpeedStriker243 Oct 06 '21

Capital pi makes me feel an emotion that doesn't exist

619

u/[deleted] Oct 06 '21

It's ominous and imposing, not fun and loose like regular curvy pi

→ More replies (11)

736

u/[deleted] Oct 06 '21

Describe.

37

u/BedroomJazz Oct 06 '21

It's like a distinct but mild mix of confusion and dread

→ More replies (4)
→ More replies (12)

95

u/mjmikejoo Oct 06 '21

Slap a log on it my man

51

u/gottabemobile2 Oct 06 '21

As professional, working mathematician, I can say with confidence that this guy maths.

→ More replies (7)

12

u/AmbiguousPuzuma Oct 06 '21

For those who don't know, this turns it into a summation of logs and you often can do a lot more with that.

→ More replies (1)

138

u/magondrago Oct 06 '21

In my case it's of sheer terror, because it reminds me of Wilkinson's Polynomial, and how the zeal of actually getting more precision in the calculation could actually make the errors in getting the root of the polynomial larger and larger.

88

u/nckl Oct 06 '21

You weren't kidding - from wiki:

In 1984, [Wilkinson] described the personal impact of this discovery: "Speaking for myself I regard it as the most traumatic experience in my career as a numerical analyst."

→ More replies (8)
→ More replies (1)

18

u/MischiefArchitect Oct 06 '21

I expected it to be I and J

→ More replies (1)

33

u/MassiveFajiit Oct 06 '21

Might make you feel worse when your hear it should be pronounced Pee.

But we don't like having a homophone for P.

→ More replies (4)

5

u/bantou_41 Oct 06 '21

You are probably thinking about the Roman architecture

4

u/didSomebodySayAbba Oct 06 '21

I feel what you feel

4

u/JustVas Oct 06 '21

Πόρτα, Πιρούνι, Πιγκουίνος, Πάστα, Παπούτσι, Πιγούνι, Ποδήλατο, Πετάλι, Πειραιάς, Πίθηκος, μΠισκότο. Hope that makes you feel better...

→ More replies (2)
→ More replies (42)

1.6k

u/SZ4L4Y Oct 06 '21

B-but what if n goes to infinity?

2.4k

u/KillerRoomba13 Oct 06 '21

We will run it until int::max and call it close enough

664

u/SZ4L4Y Oct 06 '21

And Roombas start to kill people.

→ More replies (4)

128

u/holymacaronibatman Oct 06 '21

It's a smaller infinity than other infinities, checks out.

94

u/antiduh Oct 06 '21 edited Oct 06 '21

What, you gonna do my man bignum just like that? Here, in front of all these people?

→ More replies (13)

34

u/KingJellyfishII Oct 06 '21

run it using floats until it truely becomes infinity

→ More replies (8)
→ More replies (23)

327

u/mareksl Oct 06 '21

while(true)

257

u/0vl223 Oct 06 '21 edited Oct 06 '21

for(int j = 0; j<100; i++) works as well.

edit: init

→ More replies (60)
→ More replies (8)

40

u/zyxzevn Oct 06 '21

Maths loves infinity.

→ More replies (1)

13

u/[deleted] Oct 06 '21

Turing's ears glow and he looks up from what he's doing and stares into the middle distance

11

u/joeSeggiola Oct 06 '21

Had to scroll down too much to find this comment...

4

u/pmormr Oct 06 '21

You use your knowledge of calculus to turn the infinite sum into a simpler function you can implement trivially in code.

→ More replies (93)

298

u/spacewolfXfr Oct 06 '21

And then, mean mathematicians started writing things like Σ_{n>0} 1/n²

243

u/PityUpvote Oct 06 '21

That's when you use a while loop until it converges.

(please don't)

218

u/[deleted] Oct 06 '21

This is how I've been heating my home since 1983.

41

u/Layton_Jr Oct 06 '21

With 1/n², it does converge.

Don't sum 1/n, it won't

→ More replies (12)
→ More replies (10)

36

u/pmormr Oct 06 '21

Which is actually pretty easy to implement in code if you know calculus, because the answer is a finite number (Pi2 / 6). No looping required.

→ More replies (12)
→ More replies (4)

1.7k

u/NoMoneyNoHoney18 Oct 06 '21

You make it easy to understand thanks

998

u/nuclearslug Oct 06 '21

This would have been so helpful when I was talking calculus

406

u/[deleted] Oct 06 '21

Yeah, once I realized these are just for loops, the notation made way more sense.

→ More replies (50)
→ More replies (83)

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.

→ More replies (13)

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

→ More replies (10)
→ More replies (19)

46

u/Conando025 Oct 06 '21

Wait that wasn't obvious for people??

→ More replies (14)

17

u/gaj7 Oct 06 '21

You all must have had some bad math teachers if this is surprising. Both of these "scary math symbols" are just notations for iterated operations. Of course those iterations are going to be easily represented by for-loops.

→ More replies (5)
→ More replies (5)

1.2k

u/cybercuzco Oct 06 '21

These big scary for loops are just math symbols.

401

u/NoOne-AtAll Oct 06 '21

Yeah, how are those symbols more complicated than code? That's way longer to write and you need so much additional structure to define them. The symbols are nice and clean.

It's just the initial impression that might make them scary I guess

396

u/noonemustknowmysecre Oct 06 '21

Because verbosity is the noobies friend. If the understand the base components they can reason out the emergent behavior. This does that, then that does this.

Shorthand and jargon are for the experienced people that don't want to waste time spelling it out. It's faster but the exact same level of complication is still packed in there.

→ More replies (43)

43

u/Semi-Hemi-Demigod Oct 06 '21

Those symbols are just functions:

def sigma (lower, upper, factor)
    sum = 0
    for (n = lower; n<= upper; n++)
        sum += factor * n

    return sum
→ More replies (14)
→ More replies (111)
→ More replies (3)

318

u/FreyaHolmer Oct 06 '21

I'm glad yall like my lil math explainer <3

my original tweet is here, with some more comments, altho mostly responding to angry mathematicians who don't understand that my target audience isn't them~ there is a substantial amount of people who are knowledgeable in code that don't know this type of math notation, and it seems like a lot of math people were surprised to hear this

anyhow, I do a lot of math/game dev/coding/art related stuff on twitter, so feel free to check out the rest of my stuff! I often make stuff like, this animation of how 3D rotations work. I've got a somewhat outdated list of my animated math explainers here!

I saw someone asking if I am a teacher - yes! not full-time, but I do teach math and shader coding, specifically tailored for game developers, about once per year! I have uploaded those math and shader courses on my youtube channel

while most of my videos are recordings of my courses, I have also recently made a scripted, fully animated video on Bézier curves, so if you're curious about those then check that out!

26

u/Notoisin Oct 06 '21

Love your "Math for Game Devs" series.

10

u/bloeys Oct 06 '21

Thank you for all the amazing content!

Side question: what did you use to produce the image in your tweet? It looks so good and sharp!

→ More replies (3)

5

u/JoyFerret Oct 07 '21

Just noticed you're the same person that made that video about bezier curves! I loved that video

4

u/whalt Oct 06 '21

Your YouTube channel is incredible. Even if I can’t always follow along on all the math I still get the concepts with your amazing animations. Thank you for the work you do!

→ More replies (1)

4

u/CrankyFlamingo Oct 06 '21

This truly will make me have less anxiety combing through whitepapers looking for algorithms. Thanks!

→ More replies (9)

543

u/gnome_of_the_damned Oct 06 '21

holy crap this thread just singlehandedly explained those to me in a way that was super clear. thanks all!

166

u/[deleted] Oct 06 '21

Until mathematicians transform those sums and products into non-for loop equations using arcane witchery

129

u/SomeGayBoy1 Oct 06 '21

This thread is extremely odd to me. I've always thought of computer science as a subset of mathematics, so the idea that programmers could be completely unskilled in math is just weird to me.

→ More replies (45)

10

u/Jabulon Oct 06 '21

dont make it too obvious now

→ More replies (3)

16

u/EliteCaptainShell Oct 06 '21

I'm glad you found a way to understand summation from a programming perspective, but I have to be honest I'm a little concerned that the knowledge went in this direction.

→ More replies (2)

18

u/mythosaz Oct 06 '21

Came in with the same mind-blown experience.

I guess I can be taught to understand "higher" math.

22

u/No_ThisIs_Patrick Oct 06 '21

I've always been terrible at math but good at programming. This kind of made me think I just wasn't being taught math in a way that was effective for my brain

→ More replies (2)
→ More replies (1)
→ More replies (3)

382

u/eXl5eQ Oct 06 '21

range(0, 4).map(n => 3 * n).sum()

17

u/Jojajones Oct 06 '21

return 3*(n*(n+1)//2)

Or in this case specifically: return 3 * 4 * 5//2

→ More replies (1)

13

u/marco89nish Oct 06 '21

Guess the language:

(0..4).sumBy{3*it}

(btw, no intermediate collection made)

10

u/bajuh Oct 06 '21

Guess the language round 2:

@set/a sum=0 && for /l %%i in (0,1,4)do @set/a sum+=3*%%i

(btw, I threw up in my mouth)

→ More replies (11)
→ More replies (3)

7

u/Deutero2 Oct 06 '21

(0..=4).map(|n| 3 * n).sum::<i32>() and (1..=4).map(|n| 2 * n).product::<i32>() 🦀

4

u/[deleted] Oct 06 '21

Perl:

reduce { $a + 3*$b } 0..4
→ More replies (1)

4

u/roerd Oct 06 '21
sum(3 * n for n in range(0, 4 + 1))

7

u/RoughDevelopment9235 Oct 06 '21

Now do it in JavaScript

18

u/Spood___Beest Oct 06 '21

[0,1,2,3,4].reduce((prev, n) => prev + (3*n))

→ More replies (4)

12

u/Eoussama Oct 06 '21

[...Array(4).keys()].map(e => 3 * e).reduce((acc, v) => acc + v, 0)

→ More replies (7)
→ More replies (5)
→ More replies (62)

151

u/obp5599 Oct 06 '21

I figured this was a given tbh. After taking my first programming class (alongside math classes) I remember going, oh its just a loop. This is also why I dont understand why people say you dont need math for programming. You dont need to directly do math, but the logical thinking and concepts are the same

14

u/Almustakha Oct 06 '21

To be "good" at programming you need to know your math. That's true for any science really, if you think you're "good" at biology, chemistry, physics, computer science, etc. and you don't know your math then you're really just lying to yourself. You might have a better than basic understanding, but certainly I wouldn't consider that good

→ More replies (5)

4

u/Nykcul Oct 06 '21

My friend calls programming "fancy counting" which I suppose could be also applied to math lol

But I'm in the same boat others here. I found my programming class to be more intuitive than my math classes. My guess is at some point I fell behind on my math comprehension and started just memorizing formulas to get through the tests. But programming forced me to learn to concepts so I could apply them.

I wouldn't be surprised if others had the same issue.

→ More replies (49)

476

u/technic_bot Oct 06 '21

I have been always confused by the amount of programmers and computer scientist that don't like math.

674

u/FabulousDave2112 Oct 06 '21

Programming is based around logic. It's all about learning the syntax and techniques you can use to figure out solutions to logical puzzles.

While math is technically the same at a high level, it is taught in grade school as arcane memorization with no apparent logic or reasoning behind it. This gives young people (myself included, until very recently) the completely wrong idea of what math is supposed to be.

Logic and puzzle solving are fun. Memorizing formulae with no apparent reasoning behind them is not. Therefore programming is fun, math is awful. That's the reasoning that the vast majority of new programmers enter the field with if they didn't stick with math long enough for the logic to start being explained properly.

126

u/redditmodsareshits Oct 06 '21 edited Oct 06 '21

My man you're so right. The downvoters should try pulling up a high school math textbook and compare it with a high school programming (yes, even C++ counts !) textbook. It's easy to see the point.

No body who has had their brain raped by long lists of formulae in maths (calculus, trig, etc) or physics (everything in physics basically) and worse, derivations, will ever like them. On the other hand, programming anything is literally a kind of derivation (output) using formulae (idioms) and your own application of these, and plenty of people enjoy it and find it meaningful, apart from the fact that it's also a real job that pays money.

→ More replies (68)
→ More replies (95)

116

u/papacheapo Oct 06 '21

Yeah, I knew a guy that failed algebra and never went any further... In his defense, his code was shit.

54

u/[deleted] Oct 06 '21

In my defense, I did eventually pass.

→ More replies (4)

34

u/pumpkin_seed_oil Oct 06 '21

Sure but there's also the camp of "i like math, i fucking hate the notation"

A large sigma and pi are sorta understandable, but having things like 2 different standards for vector notation where one is just easily missed because its essentially just fat font makes my skin crawl

→ More replies (40)

12

u/[deleted] Oct 06 '21

I think a lot of it has to do with the way math is written. Math notation is honestly a pain in the ass to learn, remember, and apply.

I'm generally quite good at reading static code, even in fairly esoteric languages. But I've never gotten to a point where it feels fluid and natural to read mathematical formulas and whatnot.

→ More replies (10)

6

u/Coffeemonster97 Oct 06 '21

You can do programming without knowing much math (think front-end development). But you can't really call yourself a computer scientist without any math skills, as computer science is literally applied math.

18

u/LtTaylor97 Oct 06 '21

I don't like math CLASS. Math is great and very useful. But when you shove me in a desk and ask me to recall formulas and plug in numbers according to 32 different rules (probably more that we all pretend are givens) and such, then shuffle it into a nice format and repeat until solved, all with minimal resources to reference, I hate it. I hate it I hate it I hate it. So much.

So I hate Math in the education sense. I can solve most any math problem given some time and resources, but I'm denied both in a test. This is both unreasonable and unfairly prefers those with a better talent for memorization. The inverse is generally true in programming, things are more intuitive and self-evident, and it's perfectly acceptable to use documentation and references to do your assignments and "exams", so I do very well in contrast.

→ More replies (2)

5

u/[deleted] Oct 06 '21

I like math.

I hated school.

→ More replies (34)

105

u/SnooCheesecakes5910 Oct 06 '21

Computing IS a branch of math, ya weapon

→ More replies (9)

138

u/qsdf321 Oct 06 '21

Programming is just readable math.

130

u/[deleted] Oct 06 '21

As a physicist, math is just readable programming. dont shoot me

54

u/trump_pushes_mongo Oct 06 '21

As a programmer, enterprise software is just unreadable code.

→ More replies (3)

57

u/Ghostglitch07 Oct 06 '21

You don't belong here outsider.

→ More replies (1)
→ More replies (10)

5

u/[deleted] Oct 06 '21

I'd argue the opposite lol

→ More replies (2)

4

u/[deleted] Oct 06 '21

Haskell/scheme moment

→ More replies (4)

275

u/enano_aoc Oct 06 '21

Well on the left you have pure, side-effects free declarative code. On the right you have barbaric imperative code with mutable variables.

Functional code is so good because it draws inspiration from Math. Stay functional. Stay close to Math.

65

u/PityUpvote Oct 06 '21

I agree, but the people that use higher order functions don't tend to have a problem with these mathematical concepts.

→ More replies (7)

40

u/tube32 Oct 06 '21

I did not understand a word of what you just said

153

u/enano_aoc Oct 06 '21 edited Oct 06 '21

Well, then let me explain:

  • pure is a subjective adjective. You can ignore it for the time being.

  • side-effects free means that there occur no side effects in code. A side-effect is anything that alters the state of the system. We say that a function, method or procedure has side-effects if the function call has observable consequences other than it return value. For example, reading a file is a side-effect, making an API call is a side-effect, and mutating a variable is a side effect.

  • declarative code is used to categorize code that describes the solution state, instead of the required steps to reach the solution. Think SQL queries: you do not tell the DB engine how to do your query; you rather tell the DB engine what is the result of the query. In this image, on the left you describe the solution, but on the right you describe how to reach the solution.

  • barbaric is yet another subjective appreciation, you can ignore it for now.

  • imperative code is the opposite of declarative code. Imperative describes the step to reach the solution, rather than describing the solution. In this picture, you have a declarative expression on the left, and an imperative expression on the right

  • A mutable variable is nothing else than a variable that changes its value over time. On the right, you have two mutable variables: sum and n.

Now, functional code advocates side-effects free code, declarative code and immutability. These things are considered bad for various reasons:

  • Mutable variables are bad because they intertwine value and time, thus making the code much harder to reason about

  • Side-effects have unexpected consequences and ramifications. They make the code harder to read and harder to debug. Because you cannot avoid side-effects, functional programming provides means of encapsulation the execution of side effects (such as functors and monads, if I can indulge in pompous language)

  • Imperative code forces a solution down your throat, whereas declarative code leaves much more room for implementing any solution you deem better. It is more flexible and allows for greater improvements over time. Moreover, declarative is waaaaaaaay easier to read if you have a trained mathematical mindset.

I hope I helped. If you have further interest, please do not hesitate to ask.

→ More replies (41)

9

u/conicalanamorphosis Oct 06 '21

Codeman the Barbarian!

11

u/Akita8 Oct 06 '21

It's cool and all but there are big tradeoffs when writing functional, imperative code it's order of magnitudes more readable and honestly the functional programming community it's a little bit culty and elitist. Functional programming it's just another tool in your toolset not the answer and solution to everything.

→ More replies (1)
→ More replies (29)

90

u/usesbiggerwords Oct 06 '21

I know this is supposed to be funny, but I'm weary of everything being called 'scary'. It's just math people.

53

u/casce Oct 06 '21

Easy math in this case as well. Math can get really scary but this definitely is not.

→ More replies (10)

26

u/UnstoppableCompote Oct 06 '21

Especially since this is a programming sub. I'm concerned, do people not know simple notation?

Especially since a for loop isn't really necessary to understand this at all. In fact, by having to think about edge cases and the stopping condition you're making it more complicated.

→ More replies (5)

42

u/ForceBru Oct 06 '21

Seriously, since when is "summation and product are for loops" getting 5k upvotes?! Of course they're for loops - why is it presented as some kind of "great intuitive explanation"? Isn't this super obvious?

→ More replies (16)
→ More replies (2)

28

u/_sideffect Oct 06 '21

Her videos on YouTube about gaming and graphics is amazing... She's extremely smart and explains things very well

8

u/dvpbe Oct 06 '21

second that. The amount of knowledge she shares is beyond amazing.

→ More replies (1)

10

u/qubedView Oct 06 '21

This is why learning to program before I decided to get into math really helped. My way of conceptualizing new symbols and methods was to write little python apps that did it.

→ More replies (1)

9

u/k3rn3 Oct 06 '21

Freya is chill as fuck. She knows a LOT about computer graphics and geometry and stuff, and she also helped make Budget Cuts, which is a really cool game

35

u/Separate-Quarter Oct 06 '21 edited Oct 06 '21

I'm at a loss for words looking at most of the top comments here. Seriously, how is this surprising, or even illuminating?

I guess it's just american education standards at work

4

u/Franfran2424 Oct 06 '21

I understand the productory symbol being uncommon, but the summation one is very often used, and the productory one is the obvious complemwntary

→ More replies (21)

7

u/MayMars1011 Oct 06 '21

I have a bachelor degree in mathematics and hated those fuckers cause never had a professor who really explain them well. Got into computer science…I had many awww moments cause now my brain has a legit application to them

7

u/vaginamonkeys Oct 06 '21

on another side of twitter: “btw these scary blocks of code are just sums and products”

6

u/laundmo Oct 06 '21

fucking Freya, it seems like every bit of math she shows is just suddenly 10 times easier to understand. can fully recommend her YouTube for some game dev math explanations.

5

u/redmomentos Oct 06 '21

Do people really not know this? Like if you haven’t been exposed to Sigma notation then yeah, obviously you wouldn’t know what they mean, but I’m completely shocked how many people it seems like have had to USE sigma notation and didn’t know that it’s a summation

→ More replies (1)

9

u/Mikeyboi337 Oct 06 '21

How do you do integrations? I see a lot of papers requiring integrations do you actually have to do the calculus for it?

9

u/brimston3- Oct 06 '21 edited Oct 06 '21

Usually, yes, calculus required, unless you can turn it into a reimann integral approximation. Which is usually how integration is conceptually taught.

https://en.wikipedia.org/wiki/Riemann_integral

The tl;dr is make boxes with the box height equal to the function value at that point, subdivide the interval into boxes small enough that your answer has sufficient precision (but not so small as to introduce numerical errors from floating point operations), sum up the area of all the boxes.

If either end of the interval is infinity or there's a big ol' asymtote or discontinuity, calculus is required.

So say you've got f(x)=x2 and you want to calculate the integral from 0,10 of f(x).

double integr = 0;
double box_width = 0.01;
for (double x=0; x < 10.0; x += box_width) {
    integr += x*x          // x^2 part 
              * box_width; // integration part
→ More replies (8)
→ More replies (1)

9

u/EvaUnit343 Oct 06 '21

The fact that this is getting so much traction on a programming subreddit is alarming.

4

u/sohang-3112 Oct 06 '21

Programming and Math don't have to look so different. IMO the programming language APL comes closest to being like Math. In APL, the above two examples become simply +/3×⍳4 and ×/2×⍳4 - once you learn it, the APL notation is as readable and expressive as regular Math notation.

→ More replies (3)

4

u/Chimuss Oct 06 '21

Thats freya ! She has an amazing youtube channel check it out

4

u/Griffolion Oct 06 '21

As a software engineer hiding the shame that I don't really get a lot of the "math" side of things, this was an incredibly clear explanation of those terms.

4

u/DidItForTheJokes Oct 06 '21

So you’re telling me a linq statement is just one of those simple math symbols?

4

u/acylase Oct 06 '21

Where is humor?

4

u/arbitrageME Oct 06 '21

ok great, let's try an easy one

sum = 0;
for (n = 0; n < inf; n++)
    sum += 1/(n^2)

70

u/LazerFX Oct 06 '21

Why has nobody explained it so bloody simply up until now? Lots of technical gatekeeping bullshit, not - "Hey, go from low number to high number and repeat the function".

This is why I hate mathematics - not because of the mathematics themselves, but because mathematicians cannot explain things for their life.

68

u/PityUpvote Oct 06 '21

Mathematicians tend to want to avoid confusion more than they want to provide understanding. This explanation is good for a basic understanding, but it's also not entirely correct, which is why a mathematician might not use it.

→ More replies (14)

44

u/[deleted] Oct 06 '21

Probably it has been explained, but because it was math you weren’t interest due to a lifetime of shit teachers. But on this subreddit you are willing to give it a chance.

20

u/namrog84 Oct 06 '21 edited Oct 06 '21

Exactly this.

My college math courses did cover some basics like this, not showing the programming counterpart, but just showing basic examples where N is like 3 and showing it written out long form.

Then it quickly jumps into cases where N is infinite and it gets more complex very quickly and then becomes far more abstract in nature.

A lot of math books I've seen DO cover a very simple real world applicable example, which many people quickly skip over because its 'easy' but don't really internalize the lesson, but then the book/course spend most of their time in abstract territory which is more challenging.

→ More replies (6)
→ More replies (10)

11

u/LegOfLambda Oct 06 '21

How was sigma explained to you as anything other than the sum? I've never seen anyone not immediately understand it, but they're pretty rare symbols in primary math so you may not have seen them.

14

u/ferrous69 Oct 06 '21

Did you ever ask for an explanation? Did you ever look it up? I mean I googled capital pi and the first link explains it really clearly https://mathmaine.com/2018/03/04/pi-notation/

Why are you roasting all mathematicians for this?

They’re very simple concepts that are used to investigate rich and complex topics, like convergence of a series, but clear explanations of the symbols and functions they represent are trivial to find.

Also they’re not for loops, they represent functions but that’s for another comment I guess.

→ More replies (2)

7

u/Miner_Guyer Oct 06 '21

I think a big part of it is that a lot of math is just learning the right vocabulary. It's almost like learning a new language, in a sense. And mathematicians get so used to this vocabulary, using all these definitions with a very specific meaning, it's easy to forget the knowledge that the average person has.

It's a problem I run into a lot as a cs/math double major. My cs friends will ask me questions about math, but they'll struggle to figure out the right words to use, and I keep having to ask them "what do you mean by xyz" until they're specific enough that I understand the proper math definition they're talking about. It's almost like someone who took a week of Spanish class trying to talk to a native, there's just a lack of common vocabulary.

→ More replies (1)

6

u/Brother0fSithis Oct 06 '21

I could be wrong but how is that not how you were taught it in math? That's exactly how I was taught it in my math classes

→ More replies (1)

5

u/SashimiJones Oct 06 '21

For what it's worth, as a math person and a very bad programmer, I saw this and was like "Cool, it's helpful to think of a for loop as a special case of sigma notation." Seems useful for remembering how to get the ranges right.

5

u/[deleted] Oct 06 '21

How were these symbols explained to you before?

→ More replies (2)

21

u/redditmodsareshits Oct 06 '21

My man. This is too true. Barbaric as it may be, code is simpler simply because it is better explained. Try reading my country's national maths textbook. Shit is worded just to keep homies out, i swear.

→ More replies (7)

4

u/redeemedleafblower Oct 06 '21

There are many reasons why the right would be inferior for usage in mathematics. Many people in this thread have already mentioned its insufficiency for infinite sums/products.

Another pro of the left is that it's simply easier to manipulate if you want to work out some calculations/simplifications/rearragenements.

For example, if you want to add two summations, you can write Sigma(a_n) + Sigma(b_n) = Sigma(a_n+b_n). This is very clear, but it's not so obvious how you can write this out in code.

4

u/WiseVibrant Oct 06 '21

This is a dumb take. Something like this was probably explained when you first learned about it.

If you’re reading a programming tutorial online, do you expect them to explain what a for loop or an int every time you see those?

→ More replies (6)
→ More replies (7)

6

u/Dr_Scientist_ Oct 06 '21 edited Oct 06 '21

Alternatively, the value of calculus allows you to skip the for loop and go straight to the answer. Which is wildly more efficient. I don't want to hear any C developers using for loops to calculate integrals hyping their performance.

6

u/SpaghettiPunch Oct 06 '21

there's also lots of functions whose integrals aren't "nice" expressions. e.g. 1/ln(x). for those, if you want to calculate them then you have to use numerical integration and then you're back to programming loops.

3

u/douira Oct 06 '21

now try to do n->inf with this

3

u/[deleted] Oct 06 '21

3

u/SahinK Oct 06 '21

How the fuck is this "humor"?

→ More replies (1)

3

u/tgreenhaw Oct 06 '21 edited Oct 06 '21

Simplify the example:

instead of sum += 3*n make it sum = sum+(3*n) and prod = prod*(2*n)

Less concise but more obvious.

3

u/just-the-doctor1 Oct 06 '21

Damn! Never thought of it like that!

3

u/anxious_dumpling Oct 06 '21

Wait till you hear that integrals are also just sums

3

u/[deleted] Oct 27 '21

If only I could make that connection in high school. Never wanted to learn thanks to my math teacher.

9

u/Mal_Dun Oct 06 '21

Mathematicians: *Literally invent computers to express mathematics in procedures and implement algorithms*

Computer Scientists: "Hey fuck math, I can write this sum as for-loop!"

Mathematicians: ....

4

u/laundmo Oct 06 '21

its not about writing it that way, its about helping people understand.

→ More replies (1)

5

u/Metroidman97 Oct 06 '21

...holy shit, I actually understand Sigma notation now.

→ More replies (1)

5

u/boommicfucker Oct 06 '21 edited Oct 06 '21

I hate mathematical notation. It is the exact opposite of what a programmer should do.

  • Quick to write, hard to read - inexcusable when used to teach. Be verbose, bring slides or printouts, stop scribbling like a madman while talking to the whiteboard about the proof being trivial.

  • Single-letter variable and function names (and the letters can be from any alphabet). That's like the first thing people are told not to do in programming courses and for a damn good reason.

  • Very little standardization. Here δ means this, one university over it means that. Wouldn't be that much a problem if it was something like BERT_CONSTANT vs CONST_BERT but it isn't. I don't even know what to call half the Greek alphabet.

  • Smug-ass documentation, if any. Shove your "trivials" and "exercises to the reader" up your bum!

  • Elitism. If you don't remember what all those things mean then you are just not worthy. Does any of that have to do with the actual mathematics contents of the lesson? No. But get bent lol

And they say Perl looks like an explosion in an ASCII factory...

5

u/JeffBPesos Oct 06 '21

Sure, but does anybody really struggle to understand the meaning of a summation?

9

u/[deleted] Oct 06 '21

Never thought of that. A for loop made sense a lot easier than those simbols.

13

u/NukeItAll_ Oct 06 '21

Anyone who needed this to understand those symbols doesn’t deserve their STEM degree. You never learned math. You memorized a bunch of steps to get a grade.

10

u/Manny_Sunday Oct 06 '21

I think you may overestimating how many people in this sub have STEM degrees

→ More replies (2)
→ More replies (14)

6

u/[deleted] Oct 06 '21

How are these scary math? Isnt this middle-school math

→ More replies (4)

2

u/lazeromlet_ Oct 06 '21

These things are always so scary but Ik it's more simple than it looks

2

u/CAM1998 Oct 06 '21

Well yeah

2

u/thinspell Oct 06 '21

Damn, professors use this next time.

2

u/[deleted] Oct 06 '21

Do I need to be good at math to code at first?

4

u/pokeaim Oct 06 '21

dont have to, but really helps

→ More replies (6)

2

u/ramplay Oct 06 '21

Yeah I remember struggling to learn this shit. Can't recall if it was in Algorithms class, Calculus or both. But I feel it came up in calc before I got to understand it via algorithms

2

u/[deleted] Oct 06 '21

Does anybody know where image comes from?

→ More replies (1)

2

u/voluntarycap Oct 06 '21

I majored in both math and cs and all my math classes got considerably easier after I connected that a lot of the symbols were just code logic.

2

u/[deleted] Oct 06 '21

Lol, never learned these in school, am a programmer and they make perfect sense this way.

2

u/doymond Oct 06 '21

So if one were a developer who could use a good refresher on relevant math for programming, what would be a good start? Asking for a totally real friend.

→ More replies (2)

2

u/[deleted] Oct 06 '21

Is there a resource which converts mathematical symbols into code? Would be useful for making programs tailored to certain calculations

→ More replies (1)

2

u/CondorKhan Oct 06 '21

It took me this realization to understand integrals back in the day.

2

u/dittbub Oct 06 '21

Coding is kinda like turning math into readable language rather than using weird math hieroglyphs

2

u/tepid_single Oct 06 '21

How tf is the code supposed to be simpler!?

→ More replies (1)

2

u/renrutal Oct 06 '21

There's one large caveat:

Data structures have physical limitations and overflow rules. Repeated operations accumulate measurement errors over time. Two different CPU architectures can have different results when calculating the same thing.

On the other hand, pure maths number precision is infinite.

→ More replies (1)

2

u/[deleted] Oct 06 '21

I was going to question if there are people who both recognise this notation and also don't understand it, but judging by the comments there are?

→ More replies (3)

2

u/Adventure_Agreed Oct 06 '21

I am so grateful for this. I have been out of school for a decade and just started going back for comp sci. I am in an algorithms class and have been trying to wrap my head around summations and this is perfect.

2

u/IcezN Oct 06 '21

I'm surprised there are people who understand for loops but haven't seen this math notation before.

2

u/Korzag Oct 06 '21

Somehow I feel like advanced mathematics would be a lot less scary if we could express it in a programming language.

For instance, solving the integral of sin(x) dx from 0 to pi, would get rid of the big curly integral sign and turn it into a function call: Integrate("sin(x)", x, new Range(0, Constants.Pi)). The function signature would just be: Integrate(string expression, string withRespectTo, IntegralRange range = null). I suspect we don't do this because it's tedious to write that out on paper.

→ More replies (1)

2

u/mathdrug Oct 06 '21

I think math definitely has a communication problem. Many of the concepts I learned about in algebra and calculus were rather simple, but the textbooks and lecture notes were often written in a way that made things nebulous.

Good math teachers can often put those concepts into plain English, but not everyone gets lucky enough to have a good math teacher, so then it’s incumbent upon the student to string together a bunch of random online tutorials and YouTube videos to figure it out. Lol

2

u/the_man2012 Oct 06 '21

How we have gone full circle. When I learned coding we said "hey, think of the loop as a summation".

Coding must be so much more intuitive now that it makes more sense to make the opposite comparison. "Think of the summation as a loop".

2

u/[deleted] Oct 06 '21

Thank you for this great reminder! It's been a long time since I learned or dealt with math at this level. I had forgotten how these things work. Thank you! Now I'm off to forget again! :P

2

u/istarisaints Oct 06 '21

Please read “Calculus Made Easy” WRITTEN IN 1910!!! This post here is basically the entire premise. Here is the a snapshot of the prologue and it’s so true I love it:

“Some calculus-tricks are quite easy. Some are enormously difficult. The fools who write the textbooks of advanced mathematics—and they are mostly clever fools—seldom take the trouble to show you how easy the easy calculations are. On the contrary, they seem to desire to impress you with their tremendous cleverness by going about it in the most difficult way.”

→ More replies (1)

2

u/MasterVotr Oct 06 '21

Cs is just undercover math

2

u/nekokattt Oct 06 '21

Now do integration

2

u/[deleted] Oct 06 '21

those of who you went to university and never learned this... what the hell were you doing over there? come on, demonising mathematics as some horrible incomprehensible beast when you didn't bother spending 10 seconds reading the definitions is pure idiocy. what, did they fail to teach you that summation corresponds to summation? don't think so. use your heads a little.

2

u/Ghosttalker96 Oct 06 '21

You should also now, that integrals become sums and therefore loops as well, if you are doing discrete calculations.

2

u/f1rstman Oct 06 '21

I always found that writing code helped me to understand things more deeply than the mathematical shorthand alone. I once told a stats professor of mine that math was like playing piano for me: I can read sheet music, very slowly, but once I've learned it, it's in muscle memory; similarly, I can read mathematical notation, but it doesn't come that easily to me, and only really understand it once I code something out.

2

u/DamnDirtyHippie Oct 06 '21 edited Mar 30 '24

terrific weather versed fine sable obtainable domineering air dinosaurs frame

This post was mass deleted and anonymized with Redact

2

u/[deleted] Oct 07 '21

I don't understand either so Im just terrified.

2

u/lunchpadmcfat Oct 07 '21

And ‘i’ in a for loop is just an interval length in calculus.

Is this really a revelation for anyone?

2

u/[deleted] Oct 07 '21

I swear math is only hard because of needlessly complicated syntax and every method is named after some dude instead of what you want to accomplish.

2

u/QuarantineSucksALot Oct 07 '21

It is always better to be rich

2

u/AetherMagnetic Oct 07 '21

TIL there was a multiplication equivalent to sigma notation. Thinking about it now, it makes sense that it would exist, but for whatever reason it never occurred to me