Live data from Hacker News

Ask HN: Which areas of math are practical to programming/algorithms and why?

news.ycombinator.com

21–30 of 101 posts

Re: Ask HN: Which areas of math are practical to programming/algorithms and why?

#21

Better question: what areas aren't?

Good question... Calculus? Of course it has a long history with computing, but I would say that probably less than 10% of programmers outside scientific fields use any calculus. There is calculus in machine learning but I think that counts as less than 10% of programmers, and it will probably become its own specialty separate from programming in the coming decades (to some extent it is already)

From what I know of topology, you use logic and algebra as tools to learn about it, just as you use logic and algebra in computing. But you probably wouldn't use topology to say anything about computing.

Number theory is relevant to crypto, but I would be hard pressed to say it is practical for programmers in general. You could probably have a pretty long and successful career in programming without knowing basic things like what a prime factorization is.

Re: Ask HN: Which areas of math are practical to programming/algorithms and why?

#23
Surprised nobody has mentioned any/all of Alan Turing's work, it is the mathematics which caused the foundation of Computer Science. See Turing Completeness and Universal Turing Machines.

Graph Theory is important for understanding data structures, I would also stress that the math equivalence of idempotency and isomorphism. We use these concepts a LOT in our work - but admittedly, we're a database ( http://gun.js.org/ ), which is a very different line of work than building consumer apps.

Other people already mentioned Big-O notation. Combinatorics, etc.

Re: Ask HN: Which areas of math are practical to programming/algorithms and why?

#24
post #21

Better question: what areas aren't?

Good question... Calculus? Of course it has a long history with computing, but I would say that probably less than 10% of programmers outside scientific fields use any calculus. There is calculus in machine learning but I think that counts as less than 10% of programmers, and it will probably become its own specialty separate from programming in the coming decades (to some extent it is already) From what I know of to…

> Good question... Calculus? Of course it has a long history with computing, but I would say that probably less than 10% of programmers outside scientific fields use any calculus.

Calculus is pretty useful in computer graphics and vision, if you want to understand what is going on there are integrals left and right. Audio processing and finance too.

Re: Ask HN: Which areas of math are practical to programming/algorithms and why?

#26
I'd recommend reading Knuth's The Art of Computer Programming for his perspective. Very math intensive and things you won't find in other textbooks.

Definitely a lot of discrete math (e.g. combinatorics), some calculus, number theory (esp. for cryptography), coding theory (e.g. for error correction), information theory, computational complexity theory. The border between theoretical computer science and math in general is very blurry, pretty much anything that is CS pretty quickly touches on more "traditional" mathematics.

A lot depends on your area of programming, things like machine learning will definitely involve more linear algebra, calculus, statistics. If you're programming a 3d engine then again algebra, geometry, etc. Things like finite state machines have a mathematical underpinning.

EDIT: From what I've seen at a university level CS program, Calculus, Linear Algebra, Discrete Math, Group Theory, Logic and Statistics were (IIRC) the core required math courses. Doesn't mean everything you learn there is applicable to any kind of program you might write but at least that's what someone thought was important...

Re: Ask HN: Which areas of math are practical to programming/algorithms and why?

#27
This seems like a good read on the topic:

http://steve-yegge.blogspot.cz/2006/03/math-for-programmers....

Disclaimer: I know nothing about math but have been researching it recently as I want to go to university next year to study CS so I have about 8 months to 'learn' math (45 year old street programmer here :).

I would appreciate any feedback on if this post has any merit, and will be following this thread as it's relevant to my interests :)

Re: Ask HN: Which areas of math are practical to programming/algorithms and why?

#28

I've been recently trying to make my way though Elements of Programming ( https://www.amazon.com/Elements-Programming-Alexander-Stepan... ) by Alexander Stepanov and Paul McJones and it makes me say abstract algebra. It's the first and only rigorous foundation of software engineering that I've seen. It basically maps abstract algebra to this somewhat simple subset of C++, introduces new algebraic objects (such as mem…

I just picked this up after having finished 'From Mathematics to Generic Programming' which is a ride in the park compared to what you're reading now. Looking forward to the task of slowly working my way through it.

[Edit] Interested in Rust for the same reason, but I'm not attracted to Swift. It looks so much like Kotlin, I am not sure I understand the fuss over it other than it gives Apple devs a way out of ObjC.

Anyway, I am going full on Android now, not in the hopes of app money, but the sheer numbers of devices out there, Google's backing, and it is more of a hacker's platform than iOS. I will most likely try Kotlin again, and this will prepare me for any possible switch to Swift.

Re: Ask HN: Which areas of math are practical to programming/algorithms and why?

#29

Basic algebra for the substitution model and basic calculus for high order functions and the notion of a transformation in general. Set theory is, probably, the most fundamental. Everything could be defined as a set or as a function. Lambda calculus, obviously. Some combinators. Basics of linear algebra. No category theory and other bullshit is needed. Sets will do. It is actually very important skill to avoid wastin…

Not to start a math war, but why is set theory okay but category theory bullshit?

While they're both useful, I think category theory encompasses a bit more than set theory and it's only a little more abstract. I also like the more functional approach that a lot of category theory requires you to take; if you're used to imperative programming it's a pretty different and useful way to think about things and it's great for adding to your critical thinking/general problem solving skills.

Re: Ask HN: Which areas of math are practical to programming/algorithms and why?

#30
post #2

Discrete math first comes to mind first: lists, trees, graphs, etc. Used in basic algorithms 101, but you need some more serious probability theory for probabilistic algorithms. Linear algebra is useful for computer graphics, but also for general "system thinking" concepts like inputs spaces, output spaces, transformations, and properties of transformations. Basic differential calculus, meeeh, but multivariable calcu…

Rather than thinking just of how math ideas are used in CS, we should think of the relation as a two-way street: computing can help us better understand math too. Here is a short tutorial on basic math for programmers: https://minireference.com/static/tutorials/sympy_tutorial.pd...

It serves to review basic high school math, calculus, and even a bit of linear algebra. SymPy is very powerful stuff...

Post reply on HN