r/learnpython • • Sep 20 '19

"Do I need to know math to be a programmer?"

We see this question pop up from time to time. I had an experience at work today that I think exemplifies the answer to this question. I work as an IT tutor for a local college and thus I handle the intro to programming classes. So I had an appointment today.

The student was having trouble with their assignment.

Okay, no biggie. Everyone has trouble with something. So we get to work.

The assignment is to build a program that prompts the user for the measurement of the radius of a circle, performs the calculation to determine the area of a circle with that radius, and display said area. the instructions even include code to import the python math library, assign a value from the Pi function of said library, and the formula Pi(r)^2.

I look at their program.

They have imported Math.
They have Pi assigned to a variable.
They have a variable asking the user for a number
They have a variable named "area" currently set to '100'.
They have a print statement to cast the value of area to a string, and then print said value.

Notice what they don't have? Yeah, any point where the area is calculated. Now if this was just a case of they hadn't worked with basic geometry in 5 years I could just let it go. Sometimes people just need a reminder of what "Pi(r)^2" does, or what Pi is and it's relevance to circles. But no, not this individual.

When I was working with them to understand this, they asked why they needed to know it when the computer should do all that work.

So as far as the 'Do I need to know math to be a programmer?' question, I think this is a perfect example of while you don't need to know advanced mathematics to be a programmer, you do need to be able to deconstruct a problem and understand what needs to be done to solve it. That is the foundational concept of mathematics.

493 Upvotes

160 comments sorted by

9

u/likestoplaygamesalso Sep 20 '19

I don't believe this is really a matter of the person not knowing math. I think it is more of a fundamental misunderstanding of how the computer and programming works. It sounds like they don't understand that the computer isn't magical, that the computer just does what it is told and doesn't infer things(at least in this case).

4

u/TorroesPrime Sep 20 '19

I would take it a half step further and say it's an example of the person not understanding that programing is about problem solving.

9

u/[deleted] Sep 20 '19 edited Sep 20 '19

Okay, your point is valid, but at the same time this is not a normal problem that is solved. Also, a quick search of "area of circle in Python" returns a link that contains:

# Python Program to find Area Of Circle using Radius  
PI = 3.14 
radius = float(input(' Please Enter the radius of a circle: ')) 
area = PI * radius * radius 
circumference = 2 * PI * radius  
print(" Area Of a Circle = %.2f" %area) 
print(" Circumference Of a Circle = %.2f" %circumference)

No one needs to understand the math behind it, they can just copy the equation. That's how 90%+ of programming is done.

There are many different types of programming. Very few of them really require someone to understand anything beyond really basic arithmetic.

However; in my personal experience, people who learn math easily also learn programming easily, and they tend to progress into much more difficult topics.

7

u/TorroesPrime Sep 20 '19

this is not a normal problem that is solved

how is this not a normal problem? Particularly for an intro to programming class.

3

u/[deleted] Sep 20 '19

I think he's saying it's not the kind of problem you'd encounter when writing production code. I still don't agree. Little calculations like this come up all the time.

3

u/TorroesPrime Sep 20 '19

yeah, but again this class isn't about producing people who can make production code any more then then taking Bio-1 in grade school is about making you an astronaut who will conduct a biological growth experiment on the ISS. So "This isn't a problem that you would encounter in production" is just an excuse without cause. The purpose of this class is to introduce people to the fundamental concepts of programming and programming is about problem solving. If you understand the problem, then you're a step closer to solving it. Math works the same way. Do you need math to solve every problem? No. But if you can't apply the same skills to quantify a problem and break it down into components and stages, as you would a mathematical problem, your ability to solve the problem is basically zero and any 'solution' you come up with will be pure luck, not skill.

-2

u/[deleted] Sep 20 '19

Not normal for a professional programmer

15

u/Astrokiwi Sep 20 '19

That's a perfect example, because it gives an inaccurate value, and it shows how copying something you don't understand can give you the wrong answer. Do you need your answer to be precise to less than 0.1%? If not, then this would be close enough. But if you've got a 1600 pixel display, this could create an error of a pixel or so, and that's enough for weird bugs to creep in - e.g. monsters walking through walls etc.

I'd just use math.pi as a default, which gives you more than enough precision.

Honestly, this is generally a good idea in programming in general. You don't need to understand the depths of everything you're doing and every library you use, but it's good to know the gist of it, otherwise you end up with things going wrong and not understanding why.

2

u/chimelime Sep 20 '19

Curious about the 1600 pixel display part of your response, how does that affect the calculations?

4

u/Astrokiwi Sep 20 '19

Oh if you're accurate to 0.1%, that's one part in one thousand, or 1 pixel on a 1000 pixel display. 1600 pixels is just a common screen width that's bigger than 1000 pixels.

2

u/chimelime Sep 20 '19

Okay cool thank you

2

u/[deleted] Sep 20 '19

The difference is less then 1%. The answer is not wrong, it just has less precision.

1

u/Astrokiwi Sep 21 '19

Sure, but you need to know how much precision you need for your application, which means you need to understand the maths.

2

u/[deleted] Sep 21 '19

Okay. How many developers are honestly working on applications where the numbers they are working on are something other then integers and currency? Let's be honest here.

I've worked with several senior developers who are terrible at math, and they could still do their job.

1

u/Astrokiwi Sep 21 '19

Anyone working on video games with physics. Anyone working in engineering or data science or research in general.

But even with integers, number theory and statistics matter. Otherwise you're going to do big wasteful operations that could be massively optimised by some simple maths. And I'm not sure how anyone could understand how to profile their code without some basic maths knowledge. Even if you're not writing the algorithm yourself, you need to know the difference between O(n2) and O(nlogn) etc

2

u/[deleted] Sep 21 '19

You're describing the top 5% of programmers. Like I get it, I know all of this is important. But most developers get by without knowing this stuff, they make pretty good money and have long careers.

And BTW I have a BS in Mathematics, been working as a developer for about 3 years after being self taught. I've taken several classes in number theory and that shit is way far beyond what people in CS are doing; they only scratch the surface. Almost nobody knows how to apply statistics beyond taking means. I tried to introduce people to median's and IQR's and it blew their fucking minds.

Yeah, maybe if you work at a company that's full of bright engineers and statisticians and so forth, this stuff is talked about daily. But almost nobody does. Most of us work with a bunch of slobs who surf Facebook half the day.

1

u/Astrokiwi Sep 21 '19

I think it's not so much about being the top 5% of programmers, so much as it just depends on the field? I mean, there are a lot of engineers using Matlab or whatever, and there are a lot of scientists writing in FORTRAN-77 because they don't know any better. There are a lot of terrible programmers with great mathematical skills, and a lot of them spend half their time on facebook too. It just depends on what company or industry they end up in.

1

u/Thomasedv Sep 20 '19 edited Sep 20 '19

However; in my personal experience, people who learn math easily also learn programming easily, and they tend to progress into much more difficult topics.

As a person like that, yeah, because the process of solving problems is pretty similar. See problem break down into step (formals to use, equations to write/rearrange/solve) and iterate through the problem until you get an answer. It doesn't exactly sound like programming, but you follow a very similar process.

Also, more relevant to the post, in the case of OPs, i think it's more worthwhile to mention that the person decided that the PC should do the job for him. The general idea is to either solve it yourself, find out how to solve it yourself (to make your own implementation, which here is just the line to find the area), or find a library/module/example that does the job and reuse that. The last option for bigger issues than finding the area of a circle. It might be just an intro to programming, but googling(or rather, information gathering) is half the job in that course.

2

u/Dr_Smeegee Sep 20 '19

No. I have been coding professionally since 2001. One of my harshest criticisms, second only to "Clever" is reserved for "Mathematician Code", which is characterized by piss-poor abstraction (in either direction), one character globals, and an almost religious aversion to commenting.

My latest gig has been moving a bunch of very sharp accountants from Excelville to the wonderful world of pandas. A couple of them are literal mathletes, and they have taken to it like ducks to milkshakes. Teaching them that not only is it is okay to reject someone's commits for illegibility or obscurity, it is a literal gift to one's future self has really cut into the "fuck you, I had to learn it on my own" attitude.

2

u/TorroesPrime Sep 20 '19

A couple of them are literal mathletes, and they have taken to it like ducks to milkshakes.

I used to work in a shopping center with a Duck pond in it, and seeing as one day the Ducks in said duck pond decided that they really liked McDonalds milk shakes so much that they were physically attacking people to get them and the McDonalds had to shut down until the county erected a barrier to separate the ducks from people. So I'm not sure you're evoking the imagine you are intending to.

1

u/Dr_Smeegee Sep 21 '19

You are right. I meant "Swans to pudding."

218

u/grumpyfrench Sep 20 '19

You must know logic

49

u/[deleted] Sep 20 '19

100% correct.

And an alarming number of IT people have no idea that logic is more than just an if/else statement in a program...

0

u/[deleted] Sep 21 '19

[deleted]

36

u/michaellarsen91 Sep 21 '19

You can get rid of the == True in your statement. It is redundant.

-13

u/14jvalle Sep 21 '19 edited Sep 21 '19

Another thing that the individual got incorrect is that you should be using is rather than == when comparing things like True or others like None...

Yes, python does not need a comparison for booleans, it will do it implicitly. Also, it has falsy and truthy...

The fact is, if for whatever reason you have to compare to a Boolean keyword... It would have to be with is not ==... Which is what people seem to not understand...

Edit: Wording... To clarify my point.

9

u/michaellarsen91 Sep 21 '19

Is True is also redundant. Python will check to see if the variable is true or false and you can use that as your Boolean statement. All you need is if logic:

-4

u/14jvalle Sep 21 '19

I meant that the use of == is incorrect for entities such as True, False, or None... Not that using == or is would be correct...

Of courses python does not require you to check if it is true.

I had the "also" as adding to your answer, and that the person's reply was incorrect in two ways, not just one.

27

u/thegoodfellasfella Sep 21 '19

Instructions unclear. Printed a new job

27

u/HintOfAreola Sep 20 '19

I'm great with logic.

I started programming because I'm "bad" at math.

16

u/[deleted] Sep 21 '19

The truth is I was awful at maths, but then one day I got a new maths teacher and suddenly started to understand everything.

Years later when I already graduated I found a great maths book with great examples and explanations and started to understand it.

I know I'll get a lot of downvotes for this and a lot of people will disagree with me but it really does depend on how you're learning / who teaches you.

3

u/Lunnux Sep 21 '19

What is the book called?

1

u/Crimson_Inu Sep 21 '19

Yeah, what book please! I’m struggling going back to college.

2

u/[deleted] Sep 21 '19

Hey! Unfortunately the book is only in Finnish 😭. I don't know any such math books in English, but this book that I bought (from a book store) is really nice and it has everything with long ass explanations and examples.

1

u/Lukki96 Oct 02 '19

Help a fellow finn and name the book!

4

u/thezaza101 Sep 21 '19

Pretty much me. I only scraped by discrete maths in collage.

11

u/dr3d3d Sep 21 '19

do you have a photo of the collage?

91

u/[deleted] Sep 20 '19

I don't see how this is a math problem. This seems more like a student fundamentally misunderstanding how computer programs work. Just realising that the calculation needs to be done is almost nothing to do with mathematics.

4

u/[deleted] Sep 21 '19

But he has to know the formula unless the module has a calculate_area() method

12

u/[deleted] Sep 21 '19

I don't think he needs to know the formula. He just needs to know that such a formula exists and know how to search for it on google. I haven't done geometry in 30+ years. I'd have to look up the formula for sure.

6

u/[deleted] Sep 21 '19

What I'm saying is that he didn't just not know the calculation, he didn't even realize that a calculation needed to be done. That's poor.

32

u/[deleted] Sep 20 '19 edited Sep 21 '19

Discrete Math has been absolutely invaluable to me as a CS student. It gave me the vocabulary to clarify my thinking and software design choices. Often times while attempting to solve a problem I find that by describing inputs, outputs, and internal data objects in the vocabulary of discrete mathematics -- sets, sequences, mappings, relations, etc -- the solutions often become obvious.

Don't overlook math. It's a programmer's best friend.

5

u/arcane_neptune Sep 21 '19

Went for physics in my undergrad but got a math minor which requires discrete maths, having a mathematical foundation will help someone understand CS theory a lot easier. Everyone needs more math.

166

u/crazedizzled Sep 20 '19

The answer is, of course, "no, unless you're programming something that requires math".

3

u/[deleted] Sep 20 '19 edited Sep 21 '19

To add to this, sometimes you don't know when a problem can be solved more efficiently using math. When I do challenges on leetcode or similar sites, often I'll complete the assignment and then check other people's solutions and find that they solved the problem using techniques I wouldn't have even thought about.

0

u/[deleted] Sep 20 '19

[deleted]

26

u/CromulentInPDX Sep 20 '19

Probably why CS majors at my university were in my linear algebra and discrete math classes.

3

u/ThatsMyEnclosure Sep 20 '19 edited Sep 20 '19

I’m starting at a university in the spring and switching my major (I’m at community college rn) and the program there seems like a mix of computer science and software engineering. I’ll have to take a few calc classes, matrices, differential equations, and stats.

0

u/[deleted] Sep 20 '19

[deleted]

4

u/KingHavana Sep 21 '19

Aside from Calc 3 and Diffeq those are all really fun.

2

u/whale_song Sep 21 '19

Calc III was my favorite calculus class by far. It was easy to visualize what you were doing and made it very intuitive, compared to II which is mostly just memorizing shitloads of formulas which is sucked ass

2

u/KingHavana Sep 21 '19

The thing about Calc II is that's where you learn series. Not only are they really useful for generating functions later on, but there's no one trick to use with series. You have to reason your way through the examples. Dance with the integrals in calc two. In Calc I you always have at least one obvious rule to use for derivatives, so it's all about memorization. In Calc II there isn't any formula to always integrate, so you have to try different methods until you eventually understand the way things work. It's not obvious what will be a u substitution and what will be partial fractions and what will be trig sub.

1

u/Dr_Smeegee Sep 21 '19

which is sucked ass

I hope this is not a typo, because this is an excellent example of what is worse than baseline ass.

0

u/[deleted] Sep 21 '19

[deleted]

3

u/KingHavana Sep 21 '19

Well I hope you do grow to like them. Calc III (or multivariable) makes you try to draw all sorts of 3-d bullshit curves and surfaces, which I didn't like doing at all. Calc IV (Diffeq) is just a completely random bag of tricks.

However the other stuff, like Linear Algebra, Graph Theory, and Combinatorics, I use all the time when programming. Even if you don't like having to take it, they are really useful for writing code. So they're exciting just for what you can do with them while programming, at least to me.

Edit: I will add that I can't think of any situation where anything from Calc III or Calc IV helps me in way. Those two I don't know why programmers would have to or want to take them at all.

2

u/synthphreak Sep 21 '19

A couple follow ups:

  1. What is your job? Just trying to gauge your programming context and experience.

Linear Algebra, Graph Theory, and Combinatorics ..... I use all the time when programming ..... they are really useful for writing code. So they're exciting just for what you can do with them while programming

2. Can you elaborate on this? How are they useful? What exactly do they help you to achieve while programming that is harder without them?

I can't think of any situation where anything from Calc III or Calc IV helps me in way. Those two I don't know why programmers would have to or want to take them at all.

3. You mentioned Calc III and IV, but not Calc I and II. Does that mean I and II are actually useful in some way (e.g., series, which you mentioned in a later reply)?

Thanks in advance.

3

u/KingHavana Sep 21 '19

So I'm a professor who teaches both math and computer science, and I program weekly (if not daily) when doing research. However, before you stop reading right there thinking this guy just loves math, I also program a lot for fun, making games and other projects for myself.

I'll even start by confessing that I have never used anything related to the integration (that takes up so much of Calc II) when programming anything, but the second half of Calc II, the Taylor series, is at the heart of all approximation. And approximation is how computers deal with most functions. A calculator doesn't know what sin(x) is from the theory of triangles or its definition on the unit circle. It knows how to take a series and plug in a number, then gets whatever degree of accuracy it wants from just multiplication and addition. Series allow you to approximate any function to any level.

For a graph theory example, I can't conceive of making a Sudoku solver or chess program that doesn't try to use trees effectively. You can't just search to the end of a chess game using simple recursion, so you have to in some sense play in the tree, deciding how far down you're willing to go in each branch. That requires a mathematical stopping algorithm of some sort (devised by you, from many choices, all which involve counting in some sense combinatorially to determine advantage) on a tree which is a type of graph itself. (see https://en.wikipedia.org/wiki/Minimax)

Trees aren't enough however. Picture almost any video game involving an enemy that moves. When determining what path to take, there are going to be various choices for getting from one spot to another. So if you have any enemy that needs to move around on a board you'll need a way to make decisions. The common method used is explained here: https://en.wikipedia.org/wiki/A*_search_algorithm#targetText=In%20computer%20science%2C%20A*%20(,to%20its%20performance%20and%20accuracy. There are a lot of great talks from the roguelike developer's conference on this!

The Linear algebra comes up a lot. It is at the heart of many different problems, including machine learning (where neural nets also involve graph theory). This video will explain better than me: https://www.youtube.com/watch?v=IHZwWFHWa-w but at its heart there is a linear optimization problem at play.

This is getting long, but I can say that when I program and it is not for my math research, I can't avoid using a ton of math. Usually there is some optimization problem, something I'm trying to do quickly, that involves a series of choices that are determined mathematically. You certainly won't use everything you learn in your math classes, but I'd recommend paying close attention to statistics, linear algebra, graph theory, and combinatorics. They show up as the solution to many programming problems that don't sound mathematical at first.

2

u/KingHavana Sep 22 '19

Completely by chance, but this ended up in my feed and is a great example of how valuable being able to use math can be in programming. Start with a really simple idea like wanting a random map for your video game. The method used here uses a whole bunch of different types of math over the process, but starts off with basic graph theory, for regions and for rivers. There are simpler map generation algorithms out there, but pretty much all of them do use a bunch of math. (Mine from my last game used more Linear Algebra, but didn't guarantee as many desirable features as this method.)

http://simblob.blogspot.com/2010/09/polygon-map-generation-part-1.html

Longer version here which goes into the later steps: http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/

2

u/werelock Sep 20 '19

Graduated in 2003 with CS and I had to take that exact same list minus Cominatorics I think and add Matrix Algebra.

0

u/[deleted] Sep 20 '19

[deleted]

2

u/werelock Sep 20 '19

No, I think I'm just mis-remembering and it was just Linear Algebra...but I'd swear there was another algebra and I'm not finding it currently.

2

u/TangibleLight Sep 20 '19

Maybe you're thinking of boolean algebra? Usually it's not its own class, but is bundled in with some discrete math or combinatorics course.

1

u/phaionix Sep 21 '19

Modern (or abstract) algebra is the high level one. Groups, rings, etc.

2

u/w-a-t-t Sep 21 '19 edited Jan 27 '20

deleted 0.0891 What is ^^^this?

1

u/ECEXCURSION Sep 21 '19

As one sadist to another, which was your favorite? Diffeq or linear algebra? Hahah

1

u/synthphreak Sep 21 '19

I’ve heard LA is particularly difficult. If that’s true, why?

1

u/ECEXCURSION Sep 21 '19

It's weird, but I've found that most students seem to do alright in either diffieq or linear algebra, but not both. And it seems to vary from person to person which class is the killer.

I guess we're all wired differently.

1

u/CromulentInPDX Sep 21 '19

Combinatorics was included in my discrete math class, but it showed up in probability theory, obviously. I went to IU and the math requirements for CS majors were reduced, I think. They now only require four math classes: calculus 1, combinatorics, statistics, and linear algebra. Of those, only linear algebra is a 300 level class, the rest are all 200. On the bright side, you might as well pick up math minor while you're at it. You should only need another class or two. None of those are particularly rough, with the possible exception of calculus 2. Take solace in not being required to learn abstract algebra; that was probably my toughest math class during my run on a physics degree.

1

u/[deleted] Sep 21 '19

I have a physics degree and that's more math than I had to take. I never took the last three, but I use tons of statistics in my research.

2

u/arcane_neptune Sep 21 '19

Physicsboizz. What did you do your research in?

2

u/[deleted] Sep 21 '19

I'm a grad student now doing research in high energy experimental particle physics. So I do lots of statistical analysis, and lately, more and more machine learning. I'm working on a new package to calculate energy corrections for electrons and photons using a deep neural network.

1

u/[deleted] Sep 21 '19

And this is why I'm so glad I didn't study CS in college, though I love programming. Really it depends on what kind of programmer you are. In my 25 years working as a programmer, I've only ever needed basic high school algebra and a smattering of geometry.

5

u/crazedizzled Sep 20 '19

Depends what you're doing. I almost never use math beyond basic arithmetic. I find that, more often than not, if you're working on a task that would require a lot of math, somebody probably already did it in the form of a library.

4

u/kris40k Sep 20 '19

Sure, there exists libraries, but knowing mathmatical concepts is important. Like if your trying to figure out how quickly some value is changing, you don't need to develop a function for derivatives, but you at least need to understand the concept and know what you are looking for.

2

u/[deleted] Sep 20 '19

But programming itself is maths.

5

u/callmelucky py34int Sep 21 '19 edited Sep 21 '19

Yeah, programming requires a foundational understanding of (not necessarily formal education in) concepts that are inherently mathematical, like logic and set theory and counting theory and functions and data structures, but doesn't require (at least in many many cases) a proficiency in mathematical fields that people have in mind when they think about being "good at maths", like trigonometry, calculus etc.

Really whenever this question is asked, the context should be clarified: "which maths do I need to be good at in order to good at which types of programming?".

Without that specification it's kind of like asking "do I need to wear a jacket when I go out?". Well, what jacket are you referring to, and where are you going?

3

u/awhaling Sep 20 '19

There is a shit load of programming that needs to be done that requires basic math at most.

4

u/[deleted] Sep 20 '19

I concur. A lot of programming requires a basic level of mathematical capability. What basic means is tricky though.

Basic mathematics as in simple arithmetic? (Junior school level in UK, so up to age 11)

Basic mathematics as in simple algebra / calculus (say up to age 16 in UK - lower in e.g. Japan)

Basic mathematics as in pre-univeristy level for humanities undergraduate studies, so probably understanding general statistics methods (using SPSS will be hard otherwise)

Basic mathematics as in pre-univeristy level for science/engineering undergraduate studies,....

Advice to most would be programmers is study the subject on Khan Academy as far as you can if it didn't take at school

1

u/[deleted] Sep 20 '19

The maths you learn at school is as much Mathematics as musical notation is to music.

1

u/[deleted] Sep 21 '19

Indeed so

62

u/[deleted] Sep 20 '19

Depends on the nature of work, and the data. I work in an environment that relies heavily on statistical analysis, so there is math. But, there are also a lot of requirements for "business apps", like content management. Little or no math involved.

6

u/relaxationfixation Sep 20 '19

I disagree, developing statistical software will surely require knowledge of the domain. Likely it requires more math knowledge than your average developer, however most developers should have a basic understanding of math.

For example, a developer night be expected to understand the rate at which a system is processing requests. From this they will need to calculate the number is resources necessary to complete necessary work. This is not advanced statistics and it's not geometry, but it is math.

0

u/[deleted] Sep 20 '19

[deleted]

1

u/relaxationfixation Sep 20 '19

I should clarify, basic math and stats are eventually required if you wish to become a software engineer. Though much of this math is fairly simple to learn on the job. Generally you're not expected to understand statistics and data collection concepts in day one, but a basic understanding will be required to advance in most software companies.

The question of "can I be a software engineer and not be comfortable understanding math concepts," may be different than "can I be a coder without math." Of course you can write programs that run successfully without understanding math! Though building programs and having a career in software are different things.

10

u/spaceshipguitar Sep 20 '19

You have to understand basics. Like there will points in your code where you need to make an on / off switch in your for loop, or to do something every/other iteration, and being able to know how to check for a 0 remainder with the % operator is an easy way to solve that depending on what the inputs are. Deep math understanding isn't required but simple math concepts can simplify the execution of many complex ideas.

34

u/biolinguist Chomsky_Schützenberger Theorems Sep 20 '19

The answer to "Do I need Math?", outside of the U.S. is always, "YES". It's sad that the horrible state of math education in the U.S. has made so many students so very scared of mathematics.

You may be able to get by with 'coding' without knowing math for menial purposes, but if you want to understand the actual structure and logic of programming you need to know math. No math means no possibility of understanding any natural phenomena to the fullest extent.

I make this point very clear at the beginning of all my graduate seminars and classes. Brush up your math, make sure you understand basics of abstract algebra, formal logic etc. The issue is not merely with whether or not a particular problem can be pieced together without attaining explanatory adequacy, but rather it concerns the ability to reason and logic one's way through novel problems.

19

u/[deleted] Sep 20 '19

I think this might be due to the poor math education most high school students in the US get.

I went to an European gymnasium specifically targeted to math and natural sciences, and I could never understand why so many people on reddit seemed to hate math education. I couldn't really relate. US students pick and choose their curriculum, it's not extensive enough on its own (at least by my own standards) and a lot of students are left on their own to study, which leaves them with gaps. I'm baffled students are advised to learn calculus on their own. Because my school took care of my education. I just had to follow the curriculum.

Majority of studying is done specifically for tests that are standardized (here your professor makes the exam from scratch, so if you go to a good school the exams can be fairly difficult and test understanding instead of memorization).

In my country, you can't even go to a college that is math heavy unless you've studied at an appropriate school that has covered enough math that you can get by on your own. You can't even argue you don't need math because the college will not let you apply, let alone take the entrance exam. Which makes sense, you wouldn't have the appropriate skills to be able to learn the course material in time on an advanced level, and reproduce the knowledge effectively at work.

A lot of people seem to hate math because it's not taught properly in the US, at least how I understood it, and so they avoid it at all costs. They tell themselves "I don't need math to be able to understand xyz" but I disagree. It's a wide spread notion here that math is there to teach you how to think. Even if you won't need basic geometry at your job, the cognitive skills your brain develops while working out a hard geometry problem makes the difference between a 500€ programming job and a 3,000€ one. Because the 3,000€ one requires that skill.

5

u/biolinguist Chomsky_Schützenberger Theorems Sep 20 '19

You've pretty much nailed it right on the head. I couldn't have put it better myself.

The U.S. education system is more than a little screwed up. It's deteriorated steadily since the late 60's due to political and economic policies. There are some pretty interesting documentaries out in the wild on this.

9

u/Pulsar1977 Sep 20 '19

It almost makes me cry that the comment "of course you don't need math" got 50+ upvotes, while yours got none. This sub can be so ignorant at times.

1

u/Counter_Proposition Sep 20 '19

Confirmation bias. It is more difficult to accept that math is indeed obligatory, especially if there's even a chance that it's not. I personally find it very rewarding to learn math, but just time-consuming and as a full-time employee and part-time student (taking CS classes at night) it gets hard to justify time spent on anything that isn't 100%, without question obligatory. :/

1

u/biolinguist Chomsky_Schützenberger Theorems Sep 20 '19 edited Sep 20 '19

Lol... that's fine. I think @Seroton1n is not so much interested in upvotes as in making sure that the basic facts are put out. I appreciate the thought though...

4

u/Kwintty7 Sep 20 '19

The answer to "Do I need Math?", outside of the U.S. is always, "YES".

It really, really isn't. It totally depends on what sort of coding you want to do. Something like graphics can be very maths-heavy. Lots of other stuff, barely needed. It doesn't hurt to have a good grounding in arithmetic basics, and you'll need to understand boolean logic, maybe some binary, but the rest you could never need. I'm sure plenty coders use algebra, but it's not a requirement. Good coders come with different skillsets.

4

u/biolinguist Chomsky_Schützenberger Theorems Sep 20 '19

I don't disagree with your statement. But you seem to have missed the point.

2

u/Kwintty7 Sep 20 '19

Which was?

3

u/biolinguist Chomsky_Schützenberger Theorems Sep 21 '19

Less math = explanatory deficiency.

The best one can do with mechanical programming is menial tasks.

17

u/hugthemachines Sep 20 '19

In general when people in programming subreddits ask questions like "am i not smart enough to be a programmer?" I feel it is just a matter of them worrying too much.

If I had the conversation described here I could perhaps be a bit worried, though.

On the other hand, there could have been a math method you could use, like foo.calc_circle_area() which took radius as a parameter.

16

u/Counter_Proposition Sep 20 '19 edited Sep 20 '19

For most people of average or certainly above average intelligence, I think it's mostly just impostor syndrome that prompts those kinds of questions. I mean, I've been working in IT professionally (albeit it mostly as a SysAdmin and/or in IT Support) for nearly a decade now, but I still worry that I won't be able to cut it even as a DevOps Engineer, let-alone a Dev. :/ I "learned" from a young age that I was "bad at math" but I'm slowly but surely seeing that I had just deluded myself. The good thing about math and sciences is that they just make sense, and the longer you work at them, the more it starts to make sense and the easier it gets.

5

u/barghy Sep 20 '19

Everyone should understand maths which is this basic. It's like being able to read and write.

Fair enough Google the actual calculation, but this is just a basic requirement to be able to function in the world in my opinion.

4

u/[deleted] Sep 20 '19

Certainly in any technical discipline but you'd be surprised how many people wouldn't know this formula or even what 'area' is and they get through life just fine.

5

u/UnlooseNoose Sep 20 '19

I dont know if math itself is as helpful as the problem solving skills that math provides

14

u/jabela Sep 20 '19

Some mathematics is useful and for certain types of programming this can be quite intensive. However you can be a full stack web programmer or work with databases with relatively little maths.

9

u/Tseralo Sep 20 '19

I find It’s quite rare to have to do a any advanced math in web dev the most common thing I find is percentages and even that’s not that common.

3

u/NotABotStill Sep 20 '19

It depends. I work in trading shops and if you don't know at least basic math you won't succeed. More importantly, if you can't learn statistics you won't last long. I've worked in other shops (such as e-learning) where math never plays a part. One pays better than the other (trading by far). Also, one has better work-life balance than the other (e-learning by far).

At the end of the day, business knowledge and the ability to talk to the "customer/consumer" in their language is the biggest advantage a programmer can have to succeed in today's environment.

3

u/AndrewAtBrisa Sep 20 '19

I get what you mean, but this demonstrates something a little different to me:

  • Math is certainly beneficial in programming.

  • Simple arithmetic is a requirement.

  • Being able to form logic and implement ideas is important.

  • This issue sounds more like someone doesn't understand the programming language than math.

I think a developer with no math skills would be able to identify the same issue you did. If they didn't know how to calculate the area of a circle, they would either say "This is where you should calculate it. I don't know how to do that." or they would look it up on Google. As long as they know how to write out math they find, they can fix this.

I honestly wish I had learned more math in school. My last class was pre-calc. Advanced math opens up so many interesting possibilities in software. But my limited knowledge still gives me plenty of software to work on (for now at least), and I rarely use anything more than simple addition and subtraction in web dev.

3

u/[deleted] Sep 20 '19

I studied Philosophy in undergrad, and took a proofs-based math class as my requirement. I did terribly in the class - not because of the proofs, which I constructed properly, but because I knew nothing of computation, which held me back. I knew how to break it down, and what the end point would be, and the steps to get there, but I didn't know calculus for the in between. Will this be a similar issue?

3

u/dan4223 Sep 20 '19

Logical math and algebra, yes.

Anything beyond that, it depends on the application.

3

u/[deleted] Sep 20 '19

Do you need to know Latin to understand English grammar?

3

u/[deleted] Sep 20 '19

As everyone else has said, math is a must!

I’ve just started a CS degree at 22 after dropping out of high school a year early and not having done any math in the last 5+ years.

It’s taken me two attempts of math101 at university to even begin to get my head around things. Math is hard work but it incredibly rewarding when you understand what’s going on and see it’s applications!

I never believed I could a CS degree because I was too stupid and couldn’t do the math work. That view is very common today and it’s very sad. If you can learn to code, you CAN learn math!

2

u/Ser_Drewseph Sep 26 '19

You need math to get a CS degree, but not to be a software engineer. Especially if you’re doing fullstack web applications or mobile applications (unless of course these apps are being built to do math for you like a calculator app or something.). ML/AI, data science, gaming/graphics all need more complex math for sure. But a lot of the software engineering jobs out there will never require calculus or hardcore linear algebra. At most you’ll need basic discrete math like combinatorics, set theory, and graph theory.

Also, as a fellow late college-goer: don’t count yourself out too early, and go easy on the negative self-talk. It just takes a little while to shake of the rust and get in the proper mindset. It took me three semesters to get there.

1

u/konficker Sep 20 '19

Couldn’t I just google how to calculate the radius without knowing the formula? Then add that formula to my code?

-6

u/TorroesPrime Sep 20 '19

Couldn’t I just google how to calculate the radius without knowing the formula? Then add that formula to my code?

sure, because it's not like you need to know what the 'r' is in the formula or anything.

1

u/_Matik Sep 20 '19

Im sure if you Google "how to work out area of a circle" itll give you the meaning of r as well as the formula and the diagram...wait, lets just google that....would you look at that, area, meaning of all symbols and a diagram too... interesting

This isn't a math question, i only just started looking into programming and i have almost zero knowledge, but i know that you need to manually write an equation in there or import a library with equations(set of instructions) and then with a particular syntax/code refer to that equation(set of instructions) to work the area out. It wont just magically appprear because i decide to type "work_out_area"

But in saying i think that you still need basic math knowledge, that we all learned in school and we use everyday. Itll make things easier than googling everything...i dont think everyone will need crazy math tho

2

u/Counter_Proposition Sep 20 '19

/u/TorroesPrime, I am currently taking CS1030 at my local uni. Just had our first test yesterday and just as you siad, some brushing up on my math could be extremely helpful. I'm 38 so it's been several years since my last math (college algebra) class. What exactly would you recommend as a quick refresher? Much thanks! :)

2

u/KetoCatsKarma Sep 20 '19

Hey, I'm in the same boat, 37, just started back to college for CS in August. Check out Khan Academy or on Udemy the lady named Krista King who does a really excellent job with math based instruction

1

u/Counter_Proposition Sep 20 '19

Nice! We've got this! </fistBump>

2

u/[deleted] Sep 20 '19

A person wanting to be a programmer should at the very least understand high school mathematics, numeral systems, and topics in discrete mathematics, especially logic.

2

u/mayankkaizen Sep 20 '19

Depends on which level of math knowledge and what kind of programming you are talking about. In general, school level math should be considered 'necessary'.

Again, the better you are at math, the more kind of things you can do in programming. But if you don't know math, there would be still be many things you can do. It is just that the range of problems you'll be able solve will be limited.

2

u/misingnoglic misingnoglic Sep 20 '19

Reminds me of the best code I've ever seen as a TA.

def is_leap_year(): return is_leap_year

1

u/KetoCatsKarma Sep 20 '19

Ohh I just had that assignment, my code was all working except it was returning the wrong answer on 1900, it took me longer than I liked to figure out the order of my operations was wrong

1

u/pocket_eggs Sep 21 '19

Do what I mean!

2

u/[deleted] Sep 20 '19

There's this thing called the internet that you can use to find any mathematical formula that you might need. That being said, you certainly don't need to memorize formulas, but you should at least have a basic understanding of how the formulas work. You should be able to identify when you need a specific formula, even if you don't know it by heart.

2

u/-mjneat Sep 20 '19

Mathematics teaches abstract thinking(even more so than the sciences) which is essential to good programming. Some people don't see the value in anything beyond basic maths ('when will I ever use this'). Programming gives a powerful outlet to abstract thinking. You don't need one to do the other but they really do go hand in hand.

2

u/MarcieAlana Sep 20 '19

I'm reminded of the dark old days when I was a student assistance for a FORTRAN iV class. I was helping a student out, and they couldn't understand why their program would not work. Their program consisted of a series of comments describing exactly what the program should do (not in FORTRAN, but just plain ol English), and they did not understand why the program did nothing. I explained that comments were for the coder and not the computer, but they didn't really get it.

Logic. Logic is the key here. It's not that you need to understand the math -- the math was actually provided, you need to be able to break down the solution into logical steps, and your student skipped one.

1

u/Ser_Drewseph Sep 26 '19

This, like the OP, sounds more like the student didn’t know the anatomy of a program, or how computers and compilers/interpreters work. They never got the concept that you have to tell the computer what to do. That’s not even logic, it’s just general knowledge of what a thing is, and what it can and can’t to

1

u/MarcieAlana Sep 26 '19

I hope you are correct. In some cases what I've found when I explore the reasons is magical thinking -- it's smart, it should know what I want.

2

u/Russian4Trump Sep 20 '19

Basically people who know math think it’s useful, the people who don’t know math don’t think it’s useful. Well, of course it’s not useful to you because you don’t know it, but if you did know it you might find it useful.

I’m a little embarrassed that I decided that I want to get better at math so decided to run through some classes on Khan academy. There is stuff from Algebra 1 that I completely forgot how to do.

2

u/possitive-ion Sep 20 '19

Having a firm grasp of how the order of operations works is very useful in programming as well. Same with algebraic equations.

2

u/elasticunguent Sep 20 '19

they asked why they needed to know it when the computer should do all that work.

Your student seems to have a fundamental misunderstanding about what programming is in the first place.

2

u/TangibleLight Sep 20 '19 edited Sep 20 '19

The way I like to say it is: You need to be good at math. You don't need to be good at arithmetic or memorization.

2

u/Tyler53121 Sep 21 '19

When people ask me this I usually tell them YES. But you are sitting in front of the worlds greatest calculator and information finder.

2

u/crackercider Sep 21 '19

As a beginner programmer, but more active in learning math, I see ideas in programming helping develop a mathematically-primed mindset. Not completely in the utilitarian sense of programming as you would complete a problem by the book, but in in a way approaching a problem as a mathematician would; seeking efficiency by understanding which 'tricks' simplify the difficult puzzles. Sort of how geometry offered a trick in al-Khwarizmi's method of completing the square.

2

u/[deleted] Sep 20 '19

You should be able to calculate but "real maths" is only required if working on certain special algorithms

2

u/Abdalnassir Sep 20 '19

Short answer is no. The long answer is yes only if you want to work with some scientific applications, simulations, AI, etc. The kind of math you should learn is (and listed in order):

  • Algebra

  • Linear Algebra

  • Linear Programming

These will be the foundation (a very strong foundation) for any problem you try to solve that require you to know some math.

2

u/lostwafflecat Sep 21 '19 edited Sep 21 '19

Also important note for any rando high schoolers scrolling through this sub who run across this (or similar) thread(s):

Linear algebra in this context involves multivariable calculus. It isn't the type of algebra you learn in high school.

Edited to add: the reason why you need linear algebra for AI is you basically need to tell the computer to figure out the best way to do stuff. For the computer to make that "decision", it needs a set of instructions. That set of instructions is basically "do this super complex math problem to find the most efficient way to do the task I happen to give you". That's more-or-less a oversimplified and slightly inaccurate representation of machine learning, which is one of the more common applications of what's referred to as AI (as far as I'm aware, most modern AI stuff has little to do with human-machine interaction; it's mostly just automating complex tasks)

2

u/Abdalnassir Sep 23 '19

AI software requires models to operate upon them. creating the model requires you to collect large data about the problem you are trying to resolve to train the model. The data needs preprocessing before using it to train the model and this step requires effort and math skills.

2

u/tettusud Sep 20 '19

All that you need to know is how to google

1

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Sep 20 '19

I agree that good developers should have a basic grasp of the most relevant areas of mathematics just in case (and this is of course emphasized on fields where mathematics is more relevant, like computer graphics or neural networks). That said, everyone has moments where they can't remember something specific, and in my case the MAOL table book has been very useful for quickly checking whatever formulas I've needed to implement.

1

u/[deleted] Sep 20 '19

Yes, you will need to know basic algebra - the order of operations for example and using parenthesis to manipulate the order of operations. Beyond that, depends on what you're doing

1

u/[deleted] Sep 20 '19

I don't know if it's a common problem, but I had the same mentality of your student when I first started. I remember being so frustrated with the computer taking my instructions so literally. I also thought the point of programming was to generalize everything so I struggled to understand the leg work involved.

1

u/coke125 Sep 20 '19

It depends on what kind of work you are doing. For example, if you are learning programming to get into machine learning, I'll tell you this right now, 3/4 of the learning process will be on the mathematical models behind machine learning and the actual programming will just be a couple of lines using prebuilt libraries.

1

u/Cmgeodude Sep 20 '19

I feel like order of operations and basic geometric proofs are sort of fundamental. CS started as a branch of math (and is even still housed in the math department of some universities). Most programmers don't need to be geniuses with numbers, but knowing more concepts = more efficient, better code (and more potential to understand what their programs abstract from, which in turn means more potential to do cooler things).

1

u/[deleted] Sep 20 '19

The programs you design will never do math you don't know how to do, they will only do math you know how to do but faster.

1

u/[deleted] Sep 20 '19

Algorithmic thinking is essential. Knowing the why of the math or what the desired outcomes are is going to be domain specific for the work you end up doing. Knowing how to get to the solution and the stepping stones along that pathway is far more valuable and important.

1

u/[deleted] Sep 20 '19

Math provides translatable skills that are particularly useful to programming. Directly relatable are things like algorithm development; if you know how to craft equations to solve problems, coding those equations as algorithms becomes a lot easier.

Working proofs in math helps with general problem solving, and not just in programming. Being able to find various methods to solve a math problem strengthens your resourcefulness across the board.

1

u/Dr_Smeegee Sep 21 '19

I agree with you on one level. I majored in English with a focus on the 19th Century Romantics. Learning to write vilanelles and sestinas helped me learn the basics of programming way more than high-school math. Deep-diving any subject will "teach you how to think", in that it gives you a frame work to first learn a rubric, apply it, then realize where that rubric is fuzzy and make discoveries. It is good to be educable, and have some practice in being educated.

1

u/[deleted] Sep 21 '19 edited Sep 21 '19

Well, it depends on what you do. If you do application development with <= highschool mathematical constructs, then yeah you can be a programmer. And then you'd focus on mainly using libraries efficiently and other things. However, I would also say that mathematics will probably never hurt a programmer. Programming is a subset of mathematics (ref. e.g. Dijkstra). And always the connection is not "direct", the fruitfulness of studying math can also be "learning to think about mathematical things", rather than "learning to apply technique". If you do something involving considerations such as: algorithmic complexity, design of algorithms (e.g. search algorithms, sorting algorithms, data processing algorithms), then you need at least understanding of discrete mathematics and perhaps a bit of stats. Otherwise you'd find it hard to understand what kind of algorithm to use or design, what are the benefits/drawbacks of different kinds. Understanding of discrete maths and some others can also help in being "tidy" programmer, because they may teach how to be "formally reasonable", rather than "spaghetti code".

1

u/Wine-and-wings Sep 21 '19

Another point that isn’t brought up much is being able to understand algorithmic notation. You have to know basic calculus annotation to understand someone else’s work or share your own.

1

u/synthphreak Sep 22 '19

Thanks for the great response, very persuasive of your position!

1

u/RufusAcrospin Sep 23 '19

I believe maths is sometimes useful but not necessary.

What really important is, in my opinion, analytical thinking, to be able to understand the problem, analyze and break it down to small, manageable tasks.

1

u/KetoCatsKarma Sep 20 '19

So Im a first semester programming student, only 5 weeks into my program, and I'm also historically bad at math. I had no idea how to calculate the area of a circle but I googled it. The website I used was www.wikihow.com/calculate-the-area-of-a-circle .

I then took 10 minutes, wrote some pseudocode, and wrote the following program without importing the math function and it works.

Constant

Pi = 3.14

input radius

r = float (input("Please input the provided radius: "))

Perform calculation

area = Pi * (r**2) print('The Area of the Circle is %s' % format(area, '.2f'))

So if at 37, having not been in a math class for over 15 years, I can solve that in 10 minutes (it should have been less but I was having some syntax issues), this person maybe isn't trying, is lazy, is having a bad day, or hasn't been well enough equipped to solve the issue.

Did they do any pseudocode or frameworking? Also, why was it recommend to import the math function on such an easy problem?

1

u/Dr_Smeegee Sep 21 '19

In situations like this, I always try to remember just how hard it was to get my head around basic concepts in programming, which would brain-fart every other thing I already knew right out of my head, and result in some very frustrated grumbling, and some frankly bat-brained ideas.

My favorite one was thinking that every variable in a for loop had to be named "each". As in:

for each in [1, 2, 3]:
    print each

No one ever told me this. No documentation or example ever said "'each' is the reserved name for a value in a loop". I was completely wrong aaaaaallll on my own. The "fun" I had when trying to nest loops was hilarious. Later, I was looking for zipfile when I found zip and facepalmed so hard I retroactively blacked my own eyes in the crib.

Now, if you had asked me to compute the area of a circle after burning 90% of my glucose on the above discovery, "Can't it just do it for me?" would most likely have been the absolute best I could have come up with.

0

u/NintendoTodo Sep 20 '19

math is not needed (maybe basic math), just google the formula and add to code

any university that requires a math class for a cs degree is just scamming you

1

u/lostwafflecat Sep 21 '19

Email the prof if you want to take a CS class without taking calc. You won't be able to get out of it if you want to major in it, but if you just want one or two CS courses the profs can usually approve you to take the course without the prerequisite maths (that's why at most colleges that I'm aware of the prerequisites often say "or instructor consent" after the prereq courses)

1

u/Casurus Sep 20 '19

You need to have a degree is CS, which includes basic math. Would you drive across a bridge designed by someone who doesn't have a degree in Mechanical Engineering?

1

u/ghostfacekhilla Sep 20 '19

A civil engineer would suffice.

1

u/s0nicfreak Sep 21 '19

I don't ask who designed a bridge when I drive across it

0

u/[deleted] Sep 20 '19

[deleted]

2

u/KetoCatsKarma Sep 20 '19

5 weeks into my program, the first two they just taught us how computers work, how everything processes, how 0 and 1's get turned into characters and such. I understand probably not every school is doing that but your comment made me glad mine is.

0

u/TorroesPrime Sep 20 '19

This case is not really an example of needing to know math, it's more about knowing what a computer is.

and there is an object example of "I didn't actually read the thing I'm replying to."

0

u/[deleted] Sep 20 '19

[deleted]

2

u/TorroesPrime Sep 20 '19

The conclusion you came to is pretty different from what I said. I did read the post, and I furthered the discussion. No need to be rude.

I'm sorry... that wasn't what it appeared I was replying to. Donno what happened but I was responding to another post where someone said "Yeah, I can just look up the formula and put in the program. I don't need to know math to do that." Not really sure what happened there.