benc1213
Senior Newbie


«
Posted
20110409 04:55:54 » 

How high of a level of math do I need to be a good programer? Would I need to know calculus I would expect?




loom_weaver


«
Reply #1  Posted
20110409 05:31:03 » 

Programming requires strong analytical and problem solving skills. A methodical and meticulous approach is often quite useful and people with these traits are often good at mathematics as well.
That being said I have personally found calculus, matrix algebra, and discrete mathematics very useful during my career in programming so far. These are 1st and 2nd year university courses. Numerical analysis and linear programming, 3rd4th year courses in my particular degree have contributed a lot as well. There was a heated discussion in a recent thread about precision. Without naming any names, it was pretty clear who had a strong background in numerical analysis and who didn't.
The theory of computation involving mathematical proofs (3rd year course) was difficult for me to understand but helped establish a strong foundation in computer science. Logical proofs and theory from a philosophy course was insanely useful. Heck, even statistics can be crucial depending on what problem domain you're in.
In summary, the more mathematics the better. You don't need all this math to program but in my opinion, mathematics is a key element in the foundation of a 'good' programmer.





Games published by our own members! Check 'em out!


loom_weaver


«
Reply #3  Posted
20110409 06:02:39 » 

Let me add a few examples on how all this math can be useful for programming games.
Matrix algebra  an absolute necessity for 3D transformations i.e. think graphics, OpenGL, etc. Calculus  Want to work on/with a physics engine? How is distance, velocity, and acceleration related? Graph theory  guess where the A* pathfinding algorithm came from. Theory of computation  state machines combined with some graph theory gives you behavior treeson the cutting edge of game AI
Notice how a lot of the 'hard' problems in writing games fall into these categories.
Good luck with your studies!




ra4king


«
Reply #4  Posted
20110409 06:28:58 » 

Hey ben, I'm a sophomore in High School and for 2D games you really only need to know basic arithmetics, trigonometry and geometry (for drawing, collision detection, etc...). Like loom_weaver said, you only need to know advanced mathematics (1112th grade math basically) for 3D, physics, and really smart AI. I don't think you have taken trig yet as a freshman but that is only necessary for finding angles and side lengths in triangles. Hope that helped




pitbuller


«
Reply #5  Posted
20110409 08:09:38 » 





JL235


«
Reply #6  Posted
20110409 12:23:54 » 

It really depends on your definition of 'maths' and on what you are programming. When people talk about maths they typically imagine working on paper with large proofs and endless formulas in a pure mathematical world. There are parts of programming where this is required, but most programming is _MUCH_ less formal.
Further although search algorithms and hashing techniques can be backed up with pure mathematical models, again in practice you rarely need to look at them. Even at university you are rarely taught them in this way and instead they often try to teach at a more algorithmic level. You can take that further, but usually that's up to you to explore that (such as optional modules, a postgraduate course or studying in your own time).
For most programming, I'd actually argue you require very little explicit mathematical knowledge. For example building an elegant menu system in your game, you need to use some maths to help with any animations but you certainly don't need to go that in depth about what you are building. A few sketches on a piece of paper is as formal as it gets.
Finally a friend of mine at university was terrible at maths; he barely passed his Alevel maths (for nonUK people that is the qualification before degree level in the UK). He went on to graduate with a 1st and he easily understood the cryptography, graph theory, search algorithms and other mathematical sections taught on our course. I also know a guy who programs a whole (small) game every week. He is both terrible at maths and terrible at programming, but he often gets more done in a week then I usually do in a month!
Better yourself: definitely! But don't get too wrapped up in if your good or bad at programming and maths!




aazimon


«
Reply #7  Posted
20110411 01:46:36 » 

I agree with much of what as been said, but if you are just talking about being a good programmer: I've been programming professionally for eight plus years, and haven't need to do any math, related to my work. But if you are are talking about being a good game programmer then you will need some knowledge of math, for figuring out the mechanics of the game.




ddyer


«
Reply #8  Posted
20110411 05:36:02 » 

The general maths that are really useful are basic algebra, trig, probability, number theory and matrix algebra. Don't overlook classes in numerical methods that are tailored to programming. More advanced math including calculus is not generally relevant or useful.




philfrei


«
Reply #9  Posted
20110411 05:39:40 » 

Yes to all the above. There is programming and there is programming. I mean, a LOT of people who are programming are doing things that do not require much math at all, beyond basic algebra. I haven't used much math writing Access database applications for various offices and corporate departments. (Though it helps to have a good head for basic set theory. Not everyone "gets" table structure.) A lot of PHP & web programming, AJAX type stuff, I don't think one needs much math. Writing html for a browser takes a lot less background in math than creating a more efficient browser. A lot of folks who jumped into programming by picking up html in an earlier tech boom ended up going back to serving cappucino's because the work they did required relatively little training and they didn't know how to do anything else in the programming world when the boom went bustit was kind of the equivalent of a McProgramming job.
But I am really dismayed at how I am basically shut out of doing any audio processing via computer (beyond really really simple stuff) because of my lack of math. I'd like to write code for things like digital filtering, or other simple transforms of data streams of audio, to do "easy things" like speed up or slow down notes without changing pitch (or even WITH changing pitch). Create my own VST's. Forget it. I "ONLY" have two semesters of calculus, rudiments of matrix algebra & probability & sequences & series, basic trigonometry, basic physics. Not going to cut it. There's like another two years of coursework that would be really beneficial if I could make time for it, building up to things like differential equations and such. And what I have won't cut it for 3D programming either without a lot more selfeducation.




Games published by our own members! Check 'em out!


philfrei


«
Reply #10  Posted
20110411 05:44:41 » 

I would contend that while calculus is not used directly, very often, in programming, it is an important gateway to learning maths that are.




Sinuath


«
Reply #11  Posted
20110411 07:15:10 » 

philfrei i find your post fascinating as i'm currently in my first semester of calculus. In fact i'm taking a break from a problem right now. Please elaborate, what is calculus a gateway for?




cylab


«
Reply #12  Posted
20110411 07:56:18 » 

If you want to programm any kind of game, learn vector and matrix math  even only for 2D. It will REASONABLE reduce hair pulling if you try to make something involving any of directions, speed, accelleration, collisions etc. Create my own VST's. Forget it.
Actually it's not that hard. For almost any problem there are formulas and libraries you can leverage without understanding anything but the input and output values. You'll need a fourier transformation for most of it (to transform your "2D" [time,value] input to a "3D" [time,frequency,value] output), but there are also ready to use formulas for hi, low and bandpass filters. Google should turn up with some good resources.

Mathias  I Know What [you] Did Last Summer!



Roquen


«
Reply #13  Posted
20110411 08:58:12 » 

In an ideal world: Q: How much math should I know? A: more.
For real life, my answer would be (the classic response to most questions): It depends. In this case depending on where you are and where you want to go. My list of "useful" forms of mathematics for game programming would be very very long.
WRT: Signal processing. If you want to learn "how" and "why", I'd suggest starting with image processing instead. The eye is much more forgiving than the ear.
WRT: Calculus. Yeah it's at least useful for deblackboxing lots of stuff. For other "stuff" it's required. (Like my precision?)
So, to the OP. Everything you'll learn in HS classrooms are important building blocks to other stuff (even that complex algebra).




delt0r


«
Reply #14  Posted
20110411 10:15:05 » 

As someone who use to hire programmers (and fire), I can tell you that the average programmer has far too little math (aka none IME). In the end at one company we started advertising and hiring math and physics graduates rather than CS grads. It worked out really well. Far to few CS majors bother with serious level math and it can be serious impediment to getting the job done. Don't forget it not so much what you learned, but what you can now pick up and how quickly. Without foundation, it just won't happen.
It kinda funny that you ask with respect to games. In the business world you really don't need much raw math. It is all compound interest formula type stuff. But you end up needing to know basic algorithms and need to have a idea about big O notation. The number of times someone has done a O(n^2) algo when it should be O(ln(n)) when n can be bigger than a million is rather silly.
While for games knowing about vectors and matrices is a must IMO. General calculus is also needed really, and even coordinate spaces (aka tangent spaces for normal/bump mapping). So more is better.

I have no special talents. I am only passionately curious.Albert Einstein



Roquen


«
Reply #15  Posted
20110411 10:30:04 » 

Calculus is similar to the algebra of reals. It's a basic buidling block that closes lots of doors if you don't know it. Note I disagree about not "needed" at least sound numerical analy skills in the business world. So few programmers understand it that we'll probably see floating decimal hardware because they don't understand, for instance, that 1/10 is irrational in binary.




pjt33


«
Reply #16  Posted
20110411 10:46:42 » 

The number of times someone has done a O(n^2) algo when it should be O(ln(n)) when n can be bigger than a million is rather silly.
Is that a deliberate error to see who's awake?




delt0r


«
Reply #17  Posted
20110411 11:39:45 » 

I don't see anything wrong. Unless you are going to be pedantic about up to a constant and n>1000000. In real algos the size of n really matters compared to the constant. Not many constants are the order of 1000000000000.
Perhaps you don't see that i use ln for the natural log , rather than log, which is still logarithmic up to a constant.

I have no special talents. I am only passionately curious.Albert Einstein



Roquen


«
Reply #18  Posted
20110411 12:28:13 » 

I guess you could know that you'll never hit worst case performance and that the n^2 has a better average case. But since you explicitly said "should have been"..that's sorta eliminated.




pjt33


«
Reply #19  Posted
20110411 21:27:57 » 

I don't see anything wrong.
An algorithm which is O(log n) can't read all the input. philfrei, there's a page on DSP which I've only skimread  I'd like to go back and study it properly at some point  but which I suspect you'd find interesting. http://yehar.com/blog/?p=121




philfrei


«
Reply #20  Posted
20110411 22:03:11 » 

Thank you pjt33! I have printed out the tutorial and will be reading it on my commute to work tonight! Sinuath, maybe this is a good illustrations as to how Calculus is a gateway drug...errr, gateway course: http://math.berkeley.edu/courses_descripts.htmlNote, Math 1B (2nd semester calculus) is needed for courses like 53 & 54 which are in turn needed for the first round of upper division courses, such as 114 " Introduction(!) to Applied Mathematics". There IS a lot of programming work for people without math background, but it comes and goes, has a very dicey "business cycle". 1) Something valuable can only be done with great difficulty. 2) Someone makes a tool so lots of people can do this valuable thing  often leads to lots of new programming hires. 3) Someone figures out how to automate this valuable thing  leading to lots of same new McProgrammers getting laid off.




Nate


«
Reply #21  Posted
20110412 06:11:59 » 

You don't need any math at all to be a pro gamer.




Mads


«
Reply #22  Posted
20110412 06:40:38 » 

I'd say you can come a long way with the most basic math, and a nice working brain.. Ofcourse your collisions will be homemade and not so realistic, but it can work




delt0r


«
Reply #23  Posted
20110412 08:24:40 » 

pjt33, finding something in a sorted list with random access does not need to read all the input. It just one example of true O(log(n)). Also picking something that may have "good" average case compared to an alternative that has this complexity as a worse case is not better by any stretch of the imagination.
Why do so many CompSci majors beat quick sort to death I will never know.

I have no special talents. I am only passionately curious.Albert Einstein



pjt33


«
Reply #24  Posted
20110412 11:03:43 » 

pjt33, finding something in a sorted list with random access does not need to read all the input.
Fair point. (You've seen people using an O(n^2) search through a sorted list?! Ouch)




Roquen


«
Reply #25  Posted
20110412 14:09:05 » 

BigO is a very important metric but it isn't a gleaming sword. Were that the case many methods would never see the light of day. A trival example: the splay tree. Worst case = n, average case = ln(n). However with the right kind of temporal access patterns searches will approach constant time.




delt0r


«
Reply #26  Posted
20110412 14:59:02 » 

This illustrates my point really well. There are a lot of CS majors that are now lost as to what we are talking about. Personally having some idea is IMO mandatory. You don't really need to know what NP=P means, but you need to understand big O little o and real world performance scaling issues. More importantly you should know that "common problem X" can be solved with "algo Y" in O(splat) complexity.

I have no special talents. I am only passionately curious.Albert Einstein



