In programming how important is it to be good at algebra?

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Cogman

Lifer
Sep 19, 2000
10,278
126
106
The logical mind that makes a person good at algebra is the same kind of logical mind that makes a person good at programming.

If you don't have the mind to follow and understand the quadratic equation, then I don't see how you would be able to follow and understand a program.

Bingo. Just what I was going to say. While you don't absolutely need complex math, you absolutely need to be the type of person that could pick it up. The complexities of learning to use upper level math and the complexities of learning to understand a programming environment are very closely related.

Now, it is completely possible that you could become a great developer, but for whatever reason Quadratics never make sense, however, I would look at this as a warning sign that programming may not be for you.

The real acid test is if you can go out, pick up a programming language, and write something useful/fun for yourself.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
Well im not bad at math, i can do geometry, trig, some algebra but when it gets to the crap like midway down this page:

http://en.wikipedia.org/wiki/Quadratic_equation

I just get lost. All these meaningless variables, roots, powers, fractions all mixed together as well :| I was fine with the smaller equations but that stuff is a bit much.

So far im not struggling with the actual programming part of my course though, its quite enjoyable.

The quadratic equation is fairly simple. You have basic operators (-, +, *, /), a power, and square root. That's like a simple program with a few functions.

If you were to solve the quadratic equation in code, it would be a short simple function:

Code:
(in no particular language. obviously this can be optimized)

quadratic(a, b, c) {
	x1 = (-b + sqrt(pow(b,2) - 4*a*c)) / (2*a);
	x2 = (-b - sqrt(pow(b,2) - 4*a*c)) / (2*a);
	return x1, x2;
}

where sqrt() and pow() are predefined functions in a math library

I'm thinking that the quadratic equation is like a function that calls a couple of other functions. In programming terms, an extremely simple function.
 

serpretetsky

Senior member
Jan 7, 2012
642
26
101
Well im not bad at math, i can do geometry, trig, some algebra but when it gets to the crap like midway down this page:

http://en.wikipedia.org/wiki/Quadratic_equation

I just get lost. All these meaningless variables, roots, powers, fractions all mixed together as well :| I was fine with the smaller equations but that stuff is a bit much.
First of all, wikipedia always makes math looking confusing and weird.

Otherwise, where are you struggling?

I mean, no one just looks at the quadratic formula and just suddenly understands it. Are you familiar with the problem the quadratic formula is addressing? In which case do you know what the variables are?
 

Mark R

Diamond Member
Oct 9, 1999
8,513
14
81
Is this stuff important in programming in general? I guess it would be beneficial if you are programming educational software that teaches quadratics but apart from that?

It's necessary if the problem you are dealing with makes use of the particular type of mathematics.

I once wrote some 3D rendering software, to render big arrays of voxels (an image might be 512x512x512). I had to have a detailed understanding of matrix math, vectors and their operators (such as dot products, etc.).

My initial naive version of doing this was based on basic geometry, and couldn't do stuff like optimise out invisible voxels (because you need a dot product to see if a place is behind you) and couldn't do nice shaded surfaces (because that also needs dot products and Matrices). Once I had discovered and learned about the dot product, it became straightforward to optimise the code.

Another program I wrote took data from a sensor, processed it and then did some analysis (It acutally measured electrical frequency). Finding the frequency meant finding the maximum value in an array - a straightforward problem. But, the array had a low resolution in the frequency dimension (e.g. freq[49] would be for 49Hz, freq[50] would be for 50Hz) and was "blurred" but very good resolution in the voltage dimension (e.g. if the actual frequency was 49.5, freq[49] and freq[50] would be equal). I wondered if I could trade one off against the other. So I realised that the blurring was quadratic. By applying calculus and algebra, I was able to calculate equations for the "true peak" - using these in the program gave much, much better results.
 

iCyborg

Golden Member
Aug 8, 2008
1,327
52
91
A lot of developers don't really need to know much math. UI, web techs, business rules etc, it's mostly about knowing the framework and the problem domain. Though, Comp Sci is basically a branch of mathematics (though CS != software engineering), so in that sense you can argue that you need to be good in it. As someone else said, you might not need to have specialized calculus/algebra knowledge, but if you have problems picking up basic concepts even with some effort, then I'd consider it as a red flag too.

And even in cases where you don't need to know math to code something, it might help a lot to make it more efficient. I'm probably better in math than in programming (I competed at one of these, and I try to find jobs where I can use this, and I had a case like this very recently:
There is some code that caches something so it's faster for look up. This worked fine for small sizes, but scaled terribly. Imagine that you organized your L2 cache so that searching and finding an item took 3-4x more time on average than if you just fetched it from RAM directly, lol, that's very similar to what was happening, and no one noticed. The original algorithm was simple and it worked, and people aren't versed in math so that was it.
I thought of a better algorithm, and my first version looked complicated so I looked up on the internet, and found a better way to organize it, and because I was thinking about it, I could immediately understand everything, even though I haven't done anything from that domain since college (fyi, the stuff I use is an augmented version of this: http://en.wikipedia.org/wiki/Combinatorial_number_system, you can use this to develop a way to index subsets of fixed size). The solution I proposed improved significantly on all metrics: it used about 30x less space, so instead of > 1MB array in extreme cases, it uses only about 35KB, and the lookup is faster by 3-4 orders of magnitude, up to 30,000x. Since for certain operations we do thousands of these lookups at once, the difference was quite significant.
 
Last edited:

Stuxnet

Diamond Member
Jun 16, 2005
8,403
1
0
An analogy struck me this evening while I was playing Skyrim: programming is math the same way that music is math. Both are fundamentally mathematical, but not in a way that matters to practitioners on a daily basis.

If writing rock, country, and rap are scripting, then writing classical music is programming, and yes, it's a very mathematical exercise.

<- former music major

It's no coincidence that music majors are often mathematically inclined.
 

TecHNooB

Diamond Member
Sep 10, 2005
7,460
1
76
Sometimes I feel that a programmer's ability to understand code should enable him/her to understand some level of high math.
 

Bootleg Betty

Member
Oct 28, 2010
99
0
0
Not only programming is math (as people said) but there are many kinds of programming that require mathematical ability on some level. Unless we're talking about really really basic level (so basic it's useless).

You can't do any kind of scheduling or planning (or routing, like the software inside your GPS) without knowing discrete math / graph theory, you can't do any 3D graphics without linear algebra, you can't do any crypto without number theory and abstract algebra (finite fields and stuff), you can't do any simulation whatsoever without physics and physics is like calculus with PDEs given soul. And you simply can't be a good programmer without understanding algorithms, and that require O() notation. And there are fields that are even more theoretically hard, like parallel algorithms or machine learning (statistics + linear algebra + analysis + nonlinear optimization = FML, no, just kidding, I love it)

EDIT: however. It's different to be a programmer, and to be a computer scientist. I guess.
 

squatchman

Member
Apr 1, 2009
50
0
0
When I think of a math requirement for programming, algebra and calculus are not the first two topics that pop into my face bucket.

http://en.wikipedia.org/wiki/Discrete_mathematics

Logic, for the most part, is a requirement of any kind of programming. Even if you're working through some Rails tutorial teaching you how easy it is to build a twitter-like application again, you are going to work out some boolean logic in your head.

I don't want to downplay how important other mathematical fields are for solving a wide range of problem types, but you would not believe how much trouble something as simple as De Morgan's laws will give the lay person.
 

KIAman

Diamond Member
Mar 7, 2001
3,342
23
81
If writing rock, country, and rap are scripting, then writing classical music is programming, and yes, it's a very mathematical exercise.

<- former music major

It's no coincidence that music majors are often mathematically inclined.

Hah, interesting. I was considering becomming a concert pianist but dropped because of the lack of financial guarantee. Still have a huge collection of piano music I composed ranging from classical style to modern contemporary. Music was a passion. I also tested out of every 1st and 2nd year math courses for college. Math was always easy for me. Scored a perfect 800 for math on SAT.

Programming felt natural for me.
 

Stuxnet

Diamond Member
Jun 16, 2005
8,403
1
0
Sometimes I feel that a programmer's ability to understand code should enable him/her to understand some level of high math.

While programming and math aren't equivalent in any strict sense, they require many of the same skills. When doing interviews, I like to bring up candidates' experiences with math and what their feelings are toward it, because there's an incredible correlation between their success at math and their ability as a programmer.

Hah, interesting. I was considering becomming a concert pianist but dropped because of the lack of financial guarantee. Still have a huge collection of piano music I composed ranging from classical style to modern contemporary. Music was a passion. I also tested out of every 1st and 2nd year math courses for college. Math was always easy for me. Scored a perfect 800 for math on SAT.

Programming felt natural for me.

Similar story here I focused on composition and theory (still tinker with Finale and Sibelius every now and then). Whether I'm working on math, writing music, or programming, it all feels like much the same task.
 

Madwand1

Diamond Member
Jan 23, 2006
3,309
0
76
You can't get a BSc in Computer Science without a good amount of math (at least as far as I know -- I'd be suspicious of any University CS program which wasn't like this), and you often can't even get into a CS program without a decent standing in math beforehand.

As many have said, you're probably not going to do advanced math in your commercial programming, especially if you're not so inclined, but math skills are related to programming skills, and also provide foundational material for much of the established computer science.

Somebody brought up 'big-O' notation. You can't program well without some understanding of this, and its very basis is mathematics which you'd have to do some of while studying it.

Since the OP said 'maths', I looked up the requirements for entrance to Oxford CS:

http://www.ox.ac.uk/admissions/unde...ses/computer_science/computer_science__1.html
A-levels: A*AA
The A* must be obtained in Mathematics, Further Mathematics, Physics or Computing.
• Advanced Highers: AA/AAB

• IB: 39 points, including core points

• or any other equivalent (see details of international qualifications)

Candidates are expected to have Mathematics to A-level (A grade), Advanced Higher (A grade), or Higher Level in the IB (score 7) or another equivalent. Further Mathematics or a Science would also be highly recommended.
 

Red Squirrel

No Lifer
May 24, 2003
67,936
12,384
126
www.anyf.ca
The beauty with programming is that you tell the computer what to do. So you only really need to know basic math. The computer does the hard part. Basically anything past high school math is way more complicated than you'll ever use, unless you are doing something very specific like building a space craft simulator or something to that extent. Generally, you'll never need it. Even if you did code something that uses a complicated formula, you only need to know (aka lookup) the formula, plug in your numbers, and the computer does the hard part. Computers, gotta love em.

From a school point of view, they will require quite some heavy duty math depending on what you take, though.
 

iCyborg

Golden Member
Aug 8, 2008
1,327
52
91
Even if you did code something that uses a complicated formula, you only need to know (aka lookup) the formula, plug in your numbers, and the computer does the hard part. Computers, gotta love em.
That's a very simplistic view: in order to know which complicated formula to use and how to use it, you'll almost always need some domain knowledge. My case above is a good example: find a way to index all subsets of N elements that have max size K (and this isn't just some theoretical example, the objects and these subsets have very practical meanings and uses in the product I'm working on). How would you just look-up the formula? And even with the link to it that I gave, an average high-school student will have major problems applying it. Heck, I had problems explaining the formula and how the code works...
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
The beauty with programming is that you tell the computer what to do. So you only really need to know basic math. The computer does the hard part. Basically anything past high school math is way more complicated than you'll ever use, unless you are doing something very specific like building a space craft simulator or something to that extent. Generally, you'll never need it. Even if you did code something that uses a complicated formula, you only need to know (aka lookup) the formula, plug in your numbers, and the computer does the hard part. Computers, gotta love em.

From a school point of view, they will require quite some heavy duty math depending on what you take, though.

That's a rather generalized and short-sighted statement, lots of domain specific programming requires advanced knowledge of math. If all you want is to be a code monkey writing UI's and unit tests then by all means forget your math...

Gaming, media, and financial software are just a few examples of the need for solid Math skills while programming.

I would have never got my current job if I only knew basic HS math, no way in hell.
 

KIAman

Diamond Member
Mar 7, 2001
3,342
23
81
Another interesting thing to consider is that Set Math is vital for transact-SQL.

But everyone pretty much summed it up. The thought process which allows you to do math is very close to the same process which allow you to program.

The more complex the math you can derive, the more complex a program you can implement.
 

Red Squirrel

No Lifer
May 24, 2003
67,936
12,384
126
www.anyf.ca
That's a rather generalized and short-sighted statement, lots of domain specific programming requires advanced knowledge of math. If all you want is to be a code monkey writing UI's and unit tests then by all means forget your math...

Gaming, media, and financial software are just a few examples of the need for solid Math skills while programming.

I would have never got my current job if I only knew basic HS math, no way in hell.

Not saying you can get away if you are completely unknowing of math, but just saying, the high school or college level math is WAY beyond what you'll see in 99% of applications. Sure there's exceptions but general programming wont use the really crazy math.

Even in game programming, if I need to figure out something I just look it up, and once I know what formula to use and I plugged it in, then I have a base function that I can continue to reuse throughout the program without worrying about the back end.

As a very simplistic example, say I want to figure out the area of a circle in a RTS for resource farm, I would look up "how to find area of circle" and then find the pi formula and implement it.

As for a job, yeah they usually set the requirements pretty high, but that's just the job world and how things are. They said I needed CCNA to work at the NOC, I don't even configure cisco stuff and can easily do the job without CCNA. To actually implement something you don't really need the super high end nasa style math knowledge all by heart unless your coding something that specificly uses it (such as a simulation app at nasa).

I remember asking one of my high school teachers what would be a real world example of the stuff we were learning, just so it can help me apply and understand it more. He paused a little, and his answer was "well if ever you want to work for nasa...". Most of the math they teach is beyond what you use in every day life.

That said, if you want to be a programmer for Google or some other high end company, then you probably DO need to be good at math because they'll require it. But for hobby stuff you can easily get away without math as you can still figure things out easily and let the computer do the hard work.
 
Last edited:

Leros

Lifer
Jul 11, 2004
21,867
7
81
Pro-tip: 90% of what "Google or some other high end company" isn't much different than what all programmers do.

Being good at math is part of the difference between being a good programmer and a great programmer.
 

DT4K

Diamond Member
Jan 21, 2002
6,944
3
81
When I think of a math requirement for programming, algebra and calculus are not the first two topics that pop into my face bucket.

http://en.wikipedia.org/wiki/Discrete_mathematics

Logic, for the most part, is a requirement of any kind of programming. Even if you're working through some Rails tutorial teaching you how easy it is to build a twitter-like application again, you are going to work out some boolean logic in your head.

I don't want to downplay how important other mathematical fields are for solving a wide range of problem types, but you would not believe how much trouble something as simple as De Morgan's laws will give the lay person.

My Discrete Structures was the first thing that came to mind when I started reading this thread. That was the most un-mathlike math class I've ever taken and by far the most valuable for programming.

I've been a professional developer for 10 years and never had to do anything with trig, calculus, or the quadratic equation.

But, I do agree that the kind of logical thinking and problem solving ability that makes a good programmer should also make you good at math.
 
Dec 30, 2004
12,554
2
76
Well im not bad at math, i can do geometry, trig, some algebra but when it gets to the crap like midway down this page:

http://en.wikipedia.org/wiki/Quadratic_equation

I just get lost. All these meaningless variables, roots, powers, fractions all mixed together as well :| I was fine with the smaller equations but that stuff is a bit much.

So far im not struggling with the actual programming part of my course though, its quite enjoyable.

that was crap I memorized and promptly forgot.
 
Dec 30, 2004
12,554
2
76
Pro-tip: 90% of what "Google or some other high end company" isn't much different than what all programmers do.

Being good at math is part of the difference between being a good programmer and a great programmer.

meh. "Good at math" can mean so many different things.
I never use more than simple algebra. I can, however, understand the low-level stuff that the computer is doing, and am able to see "efficient" and "inefficient" ways of doing things. For embedded programming, that makes me "good".

There's an awful lot of mathematical theory that exists and won't do one bit towards helping our country's GDP or improve standard of living.

Max, do your best to cover this stuff at a Community College. You don't want to be racking up $20k/year in loans at some university only to find out down the road that it's too complicated.
 
Last edited:

Obsoleet

Platinum Member
Oct 2, 2007
2,181
1
0
I'm not a programmer (only dabbled in Javascript for projects at an old job), or a computer scientist, also not good at math. I did take algebra and calc1 at my university. Quadratic equations from what I remember were just following the order of ops. All 1 in the same once you memorize that.

An analogy struck me this evening while I was playing Skyrim: programming is math the same way that music is math. Both are fundamentally mathematical, but not in a way that matters to practitioners on a daily basis.

This lines up with what everyone said in the thread. Math is a judge of potential, but not of ability to get things done.

I see this in my current role, smart people who are worse than those who might be less skittish, more focused and stick-to-it. If you have it all, great, you should be wealthy by now.

A stubborn bastard with an ounce of knowledge will dominate an ADD ridden flake of a mathematician every time. At least I've seen that in my career and life for the past 30 years.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |