Live data from Hacker News

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

news.ycombinator.com

1–10 of 101 posts

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

#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 calculus—specifically optimization—is really important in many programming contexts (e.g. machine learning).

Of course, the most important and most basic of all is the notion of a function f(x), its definition, inputs, outputs, properties, etc.

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

#3
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…

Also related to functions: big-O notation.

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

#4
Matrix multiplication is a must-have for any graphics programming and knowledge of them is very useful for learning neural networks.

And on the more esoteric side of things, in Quantum Computing every logic gate is actually a Matrix Multiplication

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

#5
Someone asked this a few months ago and the book that was referred was Concrete Mathematics by Knuth (https://www.amazon.com/Concrete-Mathematics-Foundation-Compu...) which I have since purchased and have enjoyed re-learning from college. Highly recommended, and should cover all you need to know. Very approachable text.

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

#6
Lots of areas are important. Every job I have worked has had a specific math specializations that were important. Reed-Solomon codes are used in storage and communication systems. They make use of abstract algebra (finite/Galois fields). Linear systems theory is essential for signal processing and control systems. Quaternions are important in aerospace and graphics.

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

#9
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 wasting time in disconnected from reality obscure academic bullshit, be it philosophy, physics or math. Do not follow other people's hallucinations. Have your own.)

As a rule of thumb - you need just enough math to understand The Wizards Lectures and SICP.

Again, the substitution model, sets (for notion of types and basic collecttions) and high order functions (the "domain and range" mantra) is enough.

For algorithms the notion of being bound by some function and orders of growth.

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

#10
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 memory) and then shows this really nice correspondence between the the C++-- and the abstract algebra.

If you are not familiar with the author, Alexander Stepanov is the guy who basically figured out generic programming, was instrumental in the design of C++ templates and the C++ STL. C++ gets a lot of flak but templates are very powerful (if you disregard the complexity). I think that they are actually one of the main reasons why C++ is still relevant. Also I'm starting to think that generic programming might actually be the most powerful paradigm out there (this is just a hunch). This book doesn't take the middle road, only the low level (C++) and extreme high level (abstract algebra) and totally cuts out the middle part (aka boiler plate).

Funnily enough, this C++-like language actually translates very nicely to the modern C++ successors like Swift and Rust (or it seems, I'm in the progress of exploring this).

Has anyone here tried to explore the contents of this book in either Swift or Rust?

But remember that this is not an easy book, I've met very smart people who told me they read only a part of this and are still wrapping their heads around that.

Post reply on HN