Sorry, the question in title sounds naive. I have no doubt that math is essential in programming, but I am thinking about philosophy of programming and want to summarize when they’re needed in programming. My attempt is below:

Most applications of programming are making electronics do things through their interfaces. Whether that’s telling a screen to display something, a network wire to transport data, a hard disk to persist data.

But we often need math because we often transform data, or we might make said electronics do things based on user input, or an event. Transforming an event to data is a mathematical construction.

Some applications are almost purely mathematical, like banking, crypto currency, or encryption.

In your opinion, does this fully explain why we need math in programming? Is there a better way to sum it up?

Formal math can be pretty dang handy, for programmin

But I’ve never actually

*needed*it, for programming.Boolean math does sometime look like a super power. I’ve noticed that veteran programmers pretty much all use it (or an intuition that is essentially the same thing), even if they’ve never been formally taught.

“I think we can do this in one fewer levels of nesting.”

“No way.”

… some time and analysis later…

“How the hell did you know that?!”

“I noticed the logic simplifies a bit with DeMorgan’s theorum and still works out.”

“What the fuck did you just say?!”

…

“I said it was a lucky guess.”

Computers can really just do two things: copy data and do math. Anytime your your doing anything but copying data verbatim, there is math involved. Anytime your reformating, filtering or acting on data their will be some math involved.

Take displaying an image: you can’t just copy image data to the screen, because it could have a different resolution, or color space, or be compressed. In all of those cases, you will need to do a lot of math to get things to work right.

The exact math varies, in graphics, CAD or geospatial stuff, expect a lot of geometry. Any sort of statistics or classifier is going to involve a lot of linear algebra. Even simply storing data in s quickly accessable manner involves quite a bit of math.

We don’t need more than basic math in programming–anything else is application-specific.

Programming requires logic and reasoning, which is a common foundation for other areas (such as math and philosophy). But we often lump “logic” together with math, which is probably why people assume math is central to programming.

Programming is also a very broad field (when someone says “I’m a programmer,” it’s like saying “I play sports”). Some fields (like embedded software) require more math than others.

Because we need computer to solve the maths

There is a need for heavy math in the field of programming, but

*most*programmers will not ever need it. I’ve been a developer for over 25 years and I’ll bet I’ve never needed anything more complicated than Boolean algebra except for maybe 3 times. Which is infuriating when I get asked to write a stupid algorithm on every damn job interview. Like I think there is a need for maybe one math guy in a whole department.Most programming is not “web scale.” Even though every hiring manager seems to think their needs are particularly unusual or complex. With the exception of maybe the S&P 50 or something, they aren’t.

Good luck drawing anything interesting on that screen without geometry!

I think math is the best way we know to train analytical thinking - one place it’s absolutely necessary is graphical rendering, if you’re building or improving a rendering engine it’s absolutely fucking vital. Outside of that it’s really unimportant for developers to know math - even for crypto or banking stuff. When it comes to encryption/compression you need to know math to write the algorithm but can

*generally*implement it without a strong background in math so long as it’s well defined enough… but you’ll usually be using a library.So, TL;DR the CS field needs like a thousand people that are excellent at math and the rest of us pretty much never need it.

It’s important to be able to reason about performance, even in ordinary business computing. If you pick the wrong data structure or algorithm, you can create memory problems, speed bottlenecks, etc. Even if you always use libraries it helps to understand the algorithms and structures they use so you can build efficient software.

And in game programming some knowledge of algorithms and data structures is very valuable. You often have to direct the behaviour of many objects at once in real time and, efficiency is really important.

Without this background knowledge you won’t recognize how the problem you are faced with is best addressed by a particular well-known algorithm. Recently, for example, I worked on a business problem that turned out to be tractable by arranging data into a graph and finding optimal pathways through the graph. This wasn’t obvious from the initial problem description. And for a game I needed to learn about N-body algorithms and how to efficiently approximate gravitational forces between many objects.

I wouldn’t say you need advanced math to do these kinds of programming, but you do need to know when it’s time to defer to other people’s expertise and tried-and-tested data structures and algorithms.

Most programming doesn’t need math or algorithms. Sometimes it’s needed. For example, 3D programming involves lots of mathematical geometry. It’s difficult to solve these problems without mathematical knowledge.

Maths and algorithms are useful tools to make certain problems easier to make sense of.

No and the question was pretty confusing. I would say for a long time, math wasn’t really important in programming, but it has gotten more important and will keep doing so. The most math-intensive big area of programming these days is machine learning, which is basically applied sttaistics. If you want to understand the currently trendy programming languages like Rust, it helps to know some mathematical logic. And even for a typical CRUD web site, on the back end you will be shovelling large amounts of data around, while at the front end you need to do a fair amount of user testing for effectiveness (lots of sites don’t do that, which is why they suck). So again a bit of clue about probability is helpful. The same is true for the basics of cryptography (what it does–the details of how the primitives work is for specialists). You probably want to understand something about that if your application has any security requirements above the trivial.

When you mention embedded hardware, there’s often electrical engineering (signal processing) involved, but I would treat that as a niche area that’s not part of programming per se. Similarly if you’re doing options trading or whatever, there is mathematical finance involved. But, the ordinary payment processing segment doesn’t use anything like that, at least as far as I’ve seen.

we need math in programming because math is the best language for describing the universe…

you don’t really need much to do a lot of stuff, but it’s a very math like thing… the computer was invented as a general purpose math machine, programming languages are rather similar to math… variables, functions, etc….

imo they make students take way too much math and it ends up being “just prove that you could do this, not that you’ll need to”.

like, “multivariable calculus with analytic geometry” isn’t needed for anything unless you’re doing scientific work….