Math and Programming

I have a curiosity question.

I noticed that in most Computer Science programs you are required to have taken Calculus to get your degree.

I’ve been out of school for quite a while. The highest math class I’ve taken is Pre-Calculus… and that was over 10 yrs ago. I probably barely remember by Trigonometry.

Now I’m looking at learning programming on my own. How much am I limiting myself if I haven’t taken Calculus?

How often do you use it? How has it helped you understand programming concepts or solved problems?

/bump
wow
I dont know where you are from but trigonometry is 3rd degree class here ( when you are 9 years old )and if you dont pass that you fail the math :stuck_out_tongue:

Honestly i do not think you need it. I haven’t even started learning Pre-Calculus yet and I’m doing great at programing, not to mention I’ve only been doing it for about 5 months, so i think you’re good to go as you are.

In grew up in the horrible California school system!

Well, having some knowledge of calculus does make some things easier, but for a lot of things (digital housekeeping stuff like GUI scripting, state management, databases, networking, etc. etc.) it’s almost totally irrelevant.

The places where calculus really becomes a big help is in anything where you’re crunching a lot of numbers to get other numbers, like 3D geometry, physics, sound synthesis, or pretty much anything that models some aspect of the real world. In those areas, all your methods and scripts are little more than giant calculus functions, and being able to work with them as such can make your life much easier.

I’m mainly wondering what the limitations are. Should I expect to hit a wall when it comes to programming in games?

My main goal is to eventually create tools to help with the art pipeline. I also want to do thing with the Unity Editor. Ahh… then there’s shaders…

Programming and math aren’t really related. Programming and music are much closer (seriously). It’s all about logic, not math. You can use programming to solve math problems, but you can use programming to do lots of things.

As far as 3D game programming goes, however, it’s useful to know some vector math, though Unity handles most of the harder stuff. With certain more advanced problems it’s good to know higher math, but that depends on what you want to do; it’s not about programming itself. Calculus? Feh. :wink:

–Eric

I’m sorry, but I completely disagree with that first statement. Math is the foundation of programming languages; logic is math. Look at any functional programming language and then look at lambda calculus (a contrived, but usefull exmaple)…

Programming and Math are not directly related

But game programming, especially in 3d, is a lot about math actually.

Trigonometrics but especially Vectors are basically a “must have base” if you want to get far.
Good thing is it is 2009 and there are “Math for dummies” websites (dummies means you don’t need math degree etc to understand :slight_smile: that help even people who never saw the stuff to comprehend it well enough to use it for some basic game logic, so don’t worry :slight_smile:

I suppose it’s fortunate that I’m not looking to do any hardcore 3D game programming for now. I may fiddle with game programming in Unity, but even here I’m not looking to go too deep.

I do want to be able to do a lot with the Editor though. I want to create tools that will make it easier for my artists to work. More drag and drop functionality that is specific to our needs.

I also want to create asset management tools. Alien Brain is way too hardcore for us. But I’d love to at least create some similar functionality in house here.

The part where I expect math to come in the most is with shaders. If I expect to do anything fancy with shaders, I imagine that math is going to go pretty deep. We don’t need that functionality yet at our company, but it sounds like learning it would be really interesting.

LOL

It never ceases to amaze me the level of misconception that invades peoples minds about how things work/are, particularly with things like programming and mathematics.

  1. If you know/can do basic algebra and trigonometry, you have 99% of the prerequisite math skills to program the majority of games. The other 1% is doing the “cutting edge” which, even then, is often just the programmer interpreting an algorithm (equation) written by someone else in their “thesis” on lighting or something. For Unity, this is mostly taken care of for you. This is typically why you get people saying that Math isn’t like programming, when that is wholly false if you actually “know” what you’re doing. Whoever said programming is logic, and math is logic, is dead on. That’s the bottom line. To program you need to be able to think logically. Unfortunately this is often hidden by the fact that most code is just reusing functions written by someone else, and is basically more like scripting instructions nowadays. Essentially all that “foundation” gets taken for granted.
  2. Writing shaders, while it gets a bad wrap, is relatively simple, it’s mostly just sets of instructions and attributes that define a surface, that are the same ones used over and over and combined in various ways with “minor tweaks”. It gets a bad wrap because it’s the area that most artists end up having to deal with on some level, and therefore gets a reputation for complexity that isn’t nearly as bad as it is made out to be. For most of the more complex surface types, they’re either already written in code somewhere, or they’re just basic algebra functions that need to be interpreted into code, where, if you can do arithmetic, you can turn them into a function in whatever code syntax you need.
  3. Calculus is no more complex than algebra, and when done in a “real world” problem, is mostly just arithmetic because complex functions in a computer are solved numerically, so it’s simply just multiplying or dividing various interval values and adding/subtracting them.
    In fact, here’s all of calculus for you (the oversimplification that is surprisingly dead on). There are two things you can read for a graphed function besides a specific point value: slope, and area under the curve/function. These values typically have some meaning in things like physics as they are for variables that have real world values (such as displacement and time). To attain those values, for anything other than a linear function, there is no “exact” solution so you must use a numerical method to approximate over small intervals. The slope is called the derivative, the area is called the integral (definite integral by my half assed definition). There are a comprehensive set of rules to obtain these derivatives and integrals for various functions, on paper, but realistically the methods are very limited/the same numerical iterations over and over for a “practical example” done by a computer numerically.

Now you’re a calculus expert. :smile: Put another way, essentially calculus is algebra with variables that are changing constantly, where an instantaneous/exact value (which doesn’t actually exist because nothing can be compared/measured without time elapsing) is approximated by using a “small” interval of values close to the value you want to obtain.
Most people who have trouble with calculus in school, it’s because of the notation and surprising amount of memorization that is required (as most that are good at math don’t bother to do until they hit calculus), and the propensity for lazy teachers/professors to skip massive amounts of algebra steps to get to “the point”, and therefore lose most of the students in the process.

Woo hoo!

Want to see a GREAT website to learn various things from advanced math (yep, even calc) to biology? Check this out:

http://www.khanacademy.org/

I think that guy is doing a great thing, and its all FREE.

As Dreamora said, 3D prog is a lot about maths.

Honestly, if I didn’t love maths, I guess it would have taken me much more time to create some core functions. Especially for 3D manipulation.

Also, bronxbomber92 pointed it well : Math is logic.
If one is not good at logic, he will not be good at math. So logically ( :lol: ), if one is not good at math, he will have more difficulties at programming.

Basically, programming is automatization.
To automatize, you need calculations.
To calculate, you need Maths.

Imho, the math relationship with prog is not about facts and static formulas, it’s all about how maths work.

Honestly, math will help you a lot.

You can’t really do 3D without trigonometry. What are you going to do about your positions and vectors? Trial-and-error?

Same for other things. You absolutely need a firm grasp of logic or I don’t know how you’re going to code anything. And logic is math.