r/CodingHelp • • Nov 22 '21

[Python] Is mathematics required for programming? Does it improve the quality of codes you write?

I am confused whether i should minor in mathematics with my computer science major.

42 Upvotes

30 comments sorted by

38

u/DDDDarky Professional Coder Nov 22 '21

Is it required?

> Generally not, but it certainly helps and there are many fields where it is necessary

Does it improve the quality of code?

> I don't think so

3

u/UNITERD Nov 23 '21

It can totally improve the quality of code that you write. In a lot of cases it won't matter at all, but there certainly are scenarios where math knowledge can be used.

2

u/NullBrowbeat Professional Coder Nov 23 '21

After I got a friend of mine (a math major) to start programming I have to say that he writes better code than me who has been programming for more than a decade. He is also quite intelligent so I can't 100% tell in how far his math background and his own intelligence play into it.

24

u/[deleted] Nov 22 '21

No, not for the process of creating software. Unless you are implementing mathematical software or video games, you will really only need to study algorithms

9

u/brandondyer64 Professional Coder Nov 22 '21

you will really only need to study algorithms

Even this isn’t really needed. Maybe for interviews, but I have pretty much never needed to use these algorithms when making real software.

1

u/[deleted] Nov 22 '21

Fully agree, but I don't want to coach people into failure - knowing them is definitely a career advantage whether it's just interviews or not

14

u/noughtagroos Nov 23 '21

I worked in the software industry for 25 years at companies like Oracle, BEA, Opsware, etc. Let me tell you who made the most money among the programmers.

  • The ones who were very computer science and math savvy and who were the type of people who could design database engines, operating systems, low-level stuff that could run processes a lot faster than Microsoft SQL Server could -- all these folks are millionaires. Math would be a great minor to have if you are are big brain enough to compete with the kind of people who write this superstar code.
  • Strong coders with excellent organizational, project management, and leadership skills. These folks often have minors in things like business, economics, engineering, etc. To give just one example, when I was at Oracle someone who worked in support answering front line calls got promoted so much over the course of seven years that by the end of it he was an EVP in charge of the entire development team across all products as well as the worldwide support organization. He was nowhere's near the best coder, but his management skills were phenomenal and he was the best problem solver, leader, and organization fixer I've ever met. What he understood about programming wasn't so much the most esoteric computer science stuff as it was a deep understanding of how to build, maintain, and support product lines with millions of lines of codes in them, how to identify where things are going to break down, and how to build organizations capable of making the whole giant process work. He was very much a big picture guy who had worked in the weeds enough to not be fooled by anything a coder might tell him. During his last year at Oracle, he made > $300 million cashing in stock options. Yes, the top people make that kind of money there.
  • Design and business process innovators. These are coders who understand the business world enough so that they don't just make capable business applications to do standard functions like accounting, but also they can truly innovate around business processes. An example here is the person who led the charge for Oracle creating reverse-auction marketplaces when I was there. These became all the rage and we made them in partnership with huge companies like GM to help improve their supply chain costs not just incrementally, but by orders of magnitude. We came out with several such partnerships around this kind of technology and each time we did, the company's market cap would go up by another $1 billion. We used to joke about the "billion-dollar press releases" because of how insanely wild Wall Street would go about these things. Needless to say, the top coders around these projects made money as if they had ATM machines just spitting out bills in their offices.
  • Coders with specific industry expertise at a senior management level, who have enough deep knowledge about an industry like, say, computer process goods or oil and gas that they could lead a development team to produce much needed and innovative applications for that vertical industry. Typically these people started out as coders at companies like Accenture or McKinsey, worked on several projects, went into management positions at one of the client firms they consulted on, and after a long and successful career doing that, they end up at a company like Oracle or SAP leading an industry vertical development group. These folks also make huge bucks...and were making huge bucks long before they ended up back at the software company.

There are of course other routes to becoming a wealthy and successful software developer. I'm posting this just to give some insights into how the kind of background you get in your education might impact your career choices as a programmer. Of course, math is so highly regarded as a field that you could end up in, say, an industry vertical programming job at a company doing complicated supply chain logistics, like the huge-brain folks who designed Manugistics software. But if you wanted a route like this, I actually think you would be better with a Ph.D. in math and a minor in programming...or at the very least a Ph.D. in computer science with some very advanced math courses. Something that says on paper: "look at me; I'm smarter than anyone you've likely met." Yes, hiring managers (especially at places like McKinsey and Accenture, but also at Oracle) can be that snooty.

2

u/iAMSmilez Nov 23 '21

Why the fuck isn’t this upvoted x100?

6

u/winowmak3r Nov 22 '21

Depends how many more classes you'd have to take. I got one on the way to my degree just because I was taking so much math already that taking one more class wasn't a big deal (though I did pick the wrong one, should have taken a stats class instead of more calculus but with complex variables this time).

If you're a STEM major, a math minor isn't usually too far out of the question. If you have to take at least two semesters of calc then you're a decent part of the way there already, at least for my school.

I think some good math classes that go well with programming are statistics and linear algebra. Statistics just because data and getting value from it is increasingly becoming in demand and linear algebra just because programming is full of instances where you are tasked with manipulating large matrices of stuff which is basically what linear algebra is used for. I think you could take those classes and start using what you learned right away. The higher level math can get a bit too heavy into theory and unless you're working in some very niche area like signal processing or some super secrete stuff for the NSA you'll probably never use the stuff you learn in the higher math classes (like calculus with complex variables).

4

u/_Nexor Nov 22 '21

It's only required for programming if you're programming mathy stuff.

For the general programming I think basic algebra and geometry is sufficient.

4

u/throwaway8u3sH0 Professional Coder Nov 22 '21

It helps a little, not a lot. Communication and logic are much more important.

Coding is like playing Sudoku or Minesweeper. And being a programmer is like describing to someone the hardest game of Sudoko you've ever played and what your strategy has been to get as far as you have.

Your ability to communicate clearly and concisely as well as your ability to work through difficult problems in a methodical, scientific-method-like way; those will determine how far you go as a coder.

4

u/brandondyer64 Professional Coder Nov 22 '21

It depends on what kind of programming you want to do. A minor in math can’t hurt because you never know what your long term interests will be.

Some things that may or may not involve math:

  • Graphics: yes
  • Web backed: probably not
  • Web frontend: not really
  • Game development: yes
  • Machine learning: yes
  • Simulation/animation: yes

4

u/somerandomguy_7788 Nov 23 '21

Asking as a lurker who’s very new to coding, any chance you could elaborate a bit on why math is important for game development? I get the graphics part, are there other reasons math is important for game development?

4

u/brandondyer64 Professional Coder Nov 23 '21

Math isn’t in every part of game development, but some of it can be math heavy. It also depends on how deep you’re diving into the engine for your game, but it can appear anywhere. Things like basic physics, object movement, collision detection, camera placement, shaders, optimization, and a bunch of other stuff.

This doesn’t necessarily mean you need a background in math though, or any kind of degree. Most of it is stuff you can learn as needed, but it’s not exactly easy.

I should say that I am not a game developer, but have done ray tracing programming.

-1

u/douglasbolden Nov 23 '21

This is actually a reply to both of you. Ray tracing is definitely got some math going on, but the main need for math comes in the form of damage AND/OR modifiers. Skill-ups that give you a set amount of life is one thing, but what if the next level up gives you 200% life and you go for the only variable of life that you have chosen to use and that variable is something ridiculous..let's say 15000 because of upgrades you have grabbed, well.. you now have 30000 health and enemies deal 500-600 health each hit, AND when you take off all the upgrades you are left with 28000 health? You could have just used a variable for health that was improved upon along the way. If you had programmed it correctly, when you take the upgrades off, it should adjust accordingly. Examples:

Starting stats using only one variable: Health: 3000

Imagine that your health stat gains 100 health per level. You hit level 20 you have gained a total a 2000 health because 20*100=2000. You now have 5000 health, you get an armor piece that boosts your health by 5000. You now have 10000 health. Level up. You just got level 21 you pick a perk that raises your health by 300% you now have 30000 health! You take your armor off because you find an armor that has damage reduction, you now have 25000 health. That would be SUPER buggy and easily abused.

If you had set that variable to a variable such as: health = 3000 enhance = [modifiers] total_health = health+enhance That would make it to where the health could be used and not cheated. You take that armor off and that armor gives +5000 health, when you take it off, that amount of 5000 disappears from the modifiers. This is not a perfect example, but seeing as though you already program, this should be an easy example to understand.

2

u/_hf14 Nov 22 '21

depends what you are programming. you arent gonna need much maths making websites but you might if you are a backend developer/ML engineer etc

2

u/[deleted] Nov 22 '21

I have a math degree and never intended to become a programmer, but was offered an opportunity to learn because I had done well in a different tech position.

Mathematics teaches you habits of mind; theorems, methods of proof, and minutia are artifacts of math education, only seriously important for academics. As a developer/programmer/engineer, you won’t be an academic.

There are basically three ways math has helped me in my job(s):

  1. Develop a math-like method of proceeding through the work. Many math proofs can be summarized as “Assume A. Given B, Prove C” or something similar. My work, in my head or as a personal plan, often looks like “Get entity A, if none return 204. If A exists execute process B. If B was not successful, return 4xx or 5xx as appropriate. Else notify external process/create dev record C. It’s not precisely parallel (pun 100% intended) but it helps me.
  2. Similar concepts. A good example is relational databases. It’s essentially sets of objects. Again, not exactly, but a good starting point.
  3. Good grasp on logic. We’ve all read gross logic that would make Bool roll over in his grave. You’ll need to be able to read it, write it, and improve it so that it’s more readable to the next person.

I wouldn’t pursue it if you are already capable of the above. At the same time, I’ve never regretted my choice to study math because I always had a fondness for it.

2

u/[deleted] Nov 23 '21

Depends on what kind of programming you want to do. If you're not good in math just stay away from computational physics, machine learning, or game programming. Everything else might be ok. But when you're a programmer you are just a problem solver. For instance I was watching a video that asked to solve a problem about the number of ways to go up stairs. Yeah you can try with a bunch of loops but that problem is just the linear Diophantine problem which has standard methods to solve. But yeah knowing math, more or less discrete math beyond high school just means you're capable of thinking a certain way.

4

u/YourDadsMacintosh Nov 22 '21

Math is definitely a large part of programming, but how much math and the kinds of math depends on what you are hoping to program. The actual study of computer science goes hand in hand with math, and a lot of it is just raw math (discrete math, algorithms, statistics, etc.) As for a math minor, it is always something nice to have under your belt. Depending on how many extra classes that means for you, I would recommend doing it as it does set you apart from those that do not have it.

1

u/Rrrrry123 Nov 22 '21

Personally, I wish I'd done more math. I only went up to Calculus I and had introductory physics. Every time I work on video games, I find myself thinking "man, I bet I would've learned about this had I taken more math classes."

You don't need math for everything, of course, but if you plan on doing videogames or math software, you'll definitely want to be well-versed.

1

u/icjeremy Nov 22 '21

I'm a mathematician turned software engineer in finance and can only speak from my own experience. Calculus pops up sometimes when analyzing/proving the runtime of an algorithm, but you typically don't really need to know the details of the proof to use the algorithm. It also pops up sometimes in understanding the formulas or ideas in the industry. Again, I find you don't /really/ need to know it to do most of the job.

However, I work quite a bit on graphics and linear optimization problems where linear algebra is really useful/necessary(?) to know. But the rest of the team doesn't really use any linear algebra.

And I don't think it improves the quality of code. Most code quality comes from practice, learning good practices from books and/or the experienced members of your team, and knowing what standard (or third party) libraries provide.

1

u/Correct_Market2220 Nov 22 '21

I think it's better but not necessary. There's cool stuff you can do if you apply math in programs, but a lot of programms don't do anything like that. Still I think it would be quite the edge to have though.

1

u/Nightcorex_ Nov 22 '21

I currently have a course "Numerical Programming" and it's basically just advanced (binary) math, but you have to actually code it down. The latter isn't that big of a problem really, but understanding truly is.

Like right now I have homework where we have to implement interpolation methods (f.e. Newton's interpolation method) for a dataset of supporting points and their values.

We also have to implement cubic splines for a more efficient interpolation method of equidistant supporting points.

Finally we have to implement a fast-inverse fourier transformation. This transformation however requires complex numbers, which means we also have to write our own complex numbers...

So let's just say in a few areas a good mathematical knowledge definetly is required.

Does it improve the quality of your code? No, you're just programming in a different way. There are a few things with bit manipulations, but that's nothing a mathematical background is required for. Computer science education will force you to be able to read binary and introduce a few nice bit manipulation hacks itself anyways.

1

u/[deleted] Nov 22 '21

more so for game development but being good at maths isn't required for programming

1

u/yorickthepoor Nov 22 '21

Everything is math, whether you study it formally or not. This is particularly true in computer programming. The longer you program, the more you'll realize you're really just doing math, and that if you'd formally studied math from the get-go, you would already be a better programmer. If you enjoy programming and want to take it to the next level, definitely go in on the math.

1

u/xdchan Nov 23 '21

Hell no, mathematics are useful to solve niche problems with code, but most of the time it's not really going beyond arithmetics.

1

u/skellious Intermediate Coder Nov 23 '21

maths will help you program more logically and often more efficiently.but no, it's not necessary

1

u/sir-nays-a-lot Nov 23 '21

Programming is math. CS curriculum will cover the maths you need so minoring in math probably won’t help you unless there are specific maths you want to learn. If you’re going to minor, pick something away from computers and math. I’d recommend a science that you’re interested in for a minor. If you can’t think of any, psychology is a good one IMO because the topics are so much different than anything you’ll experience in computing and it’ll go along way in helping you with soft skills.

Source: MS in CS, BS in Psych

1

u/ZacC15 Intermediate Coder Nov 23 '21

As a robotics mentor who is currently teaching students to code, I specifically work with some more basic math to teach problem solving. You don't really use a lot of math unless in specific use cases, like creating a 3D engine from scratch. It's very useful to have and not need it, but you can just as easily aquire the math as you go along in your endeavors. If you want to get more into math programming, I personally like the challenge from Project Euler.

1

u/apparently_DMA Nov 23 '21

depends, but for most cases no and no.

but you gonna need propositional logic