How good are you at math?

You can talk about almost anything that you want to on this board.

Moderator: Moderators

User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

How good are you at math?

Post by GradualGames »

I did...okay...at math in highschool and college. Didn't knock anyone's socks off with grades. I'm decent enough with everyday arithmetic and trigonometry to find my way around in 2D game development. Like for example, I just integrated an atan2 routine into my current NES game to implement following behavior, and generated fixed point cos/sin tables for the velocity using python.

But knowing how to USE math is way different from a deep understanding of it. Like, I find myself wondering: How does the "sin" function in most programming libraries work? When I look it up it sounds horrifyingly complex and I find my way to a wikipedia page about a Taylor series. I seem to vaguely recall learning you can compute sin with a taylor series somewhere. But...since I can pragmatically just USE the results of math functions for my games without having a really really deep understanding of why they work, I don't bother putting in the effort to understand them at that level.

I guess I was curious how many folks here are/were so good at math that you feel you have a proof-level depth of understanding of some of the types of math that we use daily as game programmers. I often feel frustrated when I can't TOTALLY understand something, but as I get older, pragmatism is taking a stronger hold and I'm less upset when I just have to use something instead of understand absolutely every facet of it down to the proof of a theorem. I WISH I could understand it all in its entirety, but...in a way math is the same thing as the open source programming world...there are tons of pragmatic results there for you to just USE, we don't all have to absorb absolutely all of how to derive all of it the way the original discoverers of these things did.

It's been 11 years since I've even done a math problem on paper, I think, I graduated college in 2006! All of the professional coding I've done hasn't involved any mathematics at all (in the sense I'm describing anyway). I maybe used a tiny, tiny bit of linear algebra once with some rotation animation or other on Android at some point in the past, but even that's been abstracted out so far at this point you barely need to know anything to use it.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: How good are you at math?

Post by GradualGames »

I guess this is no different than, say, not exhaustively understanding how an OS works. It'd probably take me years to understand everything needed to write a small unix like kernel for instance. On the same token it would probably take me years to learn how to prove all of the math that I use on a daily basis, exhaustively. It's just not worth it when you're after pragmatic results based on things that are available to use, I guess.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: How good are you at math?

Post by Bregalad »

I used to be good at math, or at least pretty decent. In highscool it was my favourite discipline by far, and I was pretty good. In uni however the level of expectations was much, MUCH higher and we had to solve problems that were so crazy, for example having multidimentional integrals to compute. it was almost insane. I managed to get by, but mediocrely, fixing my previous impression that I was good at math. I especially loved gemometry, but I liked algebra as well.

At the 2nd grade in uni this went even more insane and unfortunately I had an absolutely awful professor which was full of hatred towards students and absolutely did not want us to learn but just proof us we sucked at math. So he disgusted me of math and since then I avoided math like cancer. Which is really shame, since I originally loved it !

Taylor's series is an extremely simple concept that allows to do great interpolation around a point. If I were to code a sine function I'd probably just ressort to lookup tables and interpolation, however Taylor series can greatly improve the interpolation as instead to connect dots directly it will epouse the shape of the function locally. Usually only one or two extra terms are necessary, but you can go as far as you'd like. If you'd use a Taylor series with more terms, the interpolation will be so good that you can make the lookup table much smaller, actually in extreme cases you could just have angles like 0°, 30°, 45°, 60° etc... and do the others angles just with Taylor's series. The problem is that there will could still be some discontunity when using Taylor approximation from one point and then moving to the next point.
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: How good are you at math?

Post by Myask »

How good are you at doping silicon, fabbing plastic shells?

These strike me as about as relevant as grokking those proofs of how computers gen sin(θ), to game development.
I'm decent enough with […] trigonometry to find my way around in 2D game development.
You know that is not common, right?
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: How good are you at math?

Post by GradualGames »

Myask wrote:How good are you at doping silicon, fabbing plastic shells?

These strike me as about as relevant as grokking those proofs of how computers gen sin(θ), to game development.
I'm decent enough with […] trigonometry to find my way around in 2D game development.
You know that is not common, right?
By decent enough I mean I know the basic definitions of sin, cos, and tan, how to solve for sides of triangles, converting between radians and degrees (or other subdivisions) etc. Super super simple stuff. That's not common!?
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: How good are you at math?

Post by GradualGames »

Bregalad wrote: Taylor's series is an extremely simple concept that allows to do great interpolation around a point.
Really simple eh? :lol: like...why does it work? I've kind of gathered it's an infinite sum of derivatives of a function (with other terms in the formula I don't yet understand) which approximates the shape of the actual function, so if you can keep computing the derivative of a function you can get as much precision as you want for the function you're going for, right? So ok...but like the formula itself, WHY does it work. Why is there a factorial in the formula. etc. etc. Like, it's not bad to find out the high level definition of something and plug and chug and just use it, but ...I want to know how it was discovered and derived to begin with. It amazes me when I think about that somebody figured these things out, on paper.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: How good are you at math?

Post by lidnariq »

Derivative of xn = n·xn-1

Do it again: n·(n-1)·xn-2
And again: n·(n-1)·(n-2)·xn-3

Looks like factorial, no?
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: How good are you at math?

Post by GradualGames »

lidnariq wrote:Derivative of xn = n·xn-1

Do it again: n·(n-1)·xn-2
And again: n·(n-1)·(n-2)·xn-3

Looks like factorial, no?
Oh, cool! That makes sense (seeing the pattern there...still don't have any idea how somebody figured this out to begin with). Well, I still am confused because...I understand you can approximate the sin function with the derivative(s) of sin at just one point. What I don't get is how does it work that you can approximate a whole function just from the derivatives at one point?
Last edited by GradualGames on Sun Jul 09, 2017 5:06 pm, edited 1 time in total.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: How good are you at math?

Post by tokumaru »

lidnariq wrote:Derivative of xn = n·xn-1

Do it again: n·(n-1)·xn-2
And again: n·(n-1)·(n-2)·xn-3

Looks like factorial, no?
When I look at stuff like this (which flies completely over my head) I realize I suck at math. I barely managed to pass calculus in college.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How good are you at math?

Post by rainwarrior »

Myask wrote:How good are you at doping silicon, fabbing plastic shells?

These strike me as about as relevant as grokking those proofs of how computers gen sin(θ), to game development.
I'm decent enough with […] trigonometry to find my way around in 2D game development.
You know that is not common, right?
I would say that knowing how to prove / derive how a sin generation or other math operation can be very helpful knowledge in the right situation.

For instance, in school I was taught how a Catmull-Rom Spline is derived, but the process of learning that (combined with a prerequisite in linear algebra) made me realize how other interpolating curves may be derived in general. This has meant that at many points in my career I've been able to create a custom curve that best fits the situation at hand, rather than being stuck with whatever pre-fab solutions I can find.

This kind of knowledge often makes the difference between something that roughly fits together and barely works, and something that feels perfect and solid. In many cases this isn't even a tradeoff of time and effort: when you have the right knowledge often you can do something quickly and well, much better than adapting an acquired "black box".

Calculus in particular has tons of applications in 3D graphics. It comes up a lot in physics simulations, or even just some exploratory questions about gameplay (e.g. "how long will this level take to fill with water"). There's a lot of stuff that you can do really easily with the right knowledge of math that is very difficult to do otherwise.


Even bringing it back to sines and the NES, there's like a hundred different ways to calculate a sine, and in the right situation you might be able to make one that's very fast to calculate, numerically stable, no lookup tables / small code etc. but only suitable for for just that specific purpose. If you don't have this kind of knowledge, you'll probably be stuck with a more generic solution, and you might even just give up on what you want to do when it's actually very feasible.

I don't think the comparison with doping silicon is even remotely fair here. There's tons of ways that being able to understand and customize a sine calculation can be directly useful to the problem of developing an NES game. You might not be able to see those possibilities without that knowledge, though. If you find yourself curious about what's inside your tool, why not take some time out to understand it?


There's plenty of situations where a ready made tool is fine to use, too. Especially in commercial development, it's very important to effectively manage your time. A well made pre-fab solution is probably better than a poorly made custom solution... though even just having some knowledge of what's going on inside will help you make a better/informed choice about which existing tool to use!

Knowing how to implement something isn't only useful for implementing it; it also gives you the ability to evaluate and understand other implementations, when to use them, and how long it would take to write it yourself. Often I would specifically chose to use a ready-made system because it's something I know a lot about and could make myself (and have an idea how much the labour involved is worth).

In a lot of cases the rough solution and the "perfect" solution are equivalent for the end user, but that's also something that's difficult to judge without experience. Math in particular has a lot of uses in software, and in a lot of ways that aren't obvious or easy to explain the application until you know that math. I definitely encourage taking a little break to push out the edges of your sphere of knowledge occasionally.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How good are you at math?

Post by rainwarrior »

GradualGames wrote:Oh, cool! That makes sense (seeing the pattern there...still don't have any idea how somebody figured this out to begin with). Well, I still am confused because...I understand you can approximate the sin function with the derivative(s) of sin at just one point. What I don't get is how does it work that you can approximate a whole function just from the derivatives at one point?
Yes, it works not just for sine, but for any continuous function.

e.g. if you pick a point on a curve f(a), you can approximate a point f(a+b) nearby by taking the slope and following a straight line to that nearby point.

The slope is just the first derivative, though, you can make a better approximation if you take into account whether it is curving up or down vs. that straight line slope... so you can take the "slope" of that derivative slope, or second derivative, to improve the estimate. Instead of following the straight line, you follow the straight line, plus a continual curve up or down to adjust from it...

This process can be repeated until you have the accuracy you want. If the function is a simple polynomial eventually you get a derivative that is just 0, and at that point you're calculating it exactly.

If you want more accuracy around a specific region of the function, you can pick your starting point there. Considering a sine, you might realize that an approximation of sine(0.3) near 0 might be more accurate than sine(50π+0.3), even though the target value should be the same. Each successive layer of approximation will maybe get you one more "curve" in your approximated function. Of course with sine you know it's periodic so you can just modulo 2π to keep everything in the "close" range, but there are lots of non-periodic functions out there you may want to approximate.


Anyhow, that's just the Taylor Series idea, there's lots of other approximation methods. Many approximation methods have undesirable instability that you should be careful to avoid. Again, hard to know where they can apply until you understand them and have experience with them, but I recommend taking it as far as you're interested. It's OK to use stuff you don't understand if it solves your problem adequately, just it's hard to know what you're missing until you do.


Wikipedia is also generally a very bad place to learn anything to do with math. I find most of the articles are written by experts who expect a lot of pre-requisite knowledge. Wikipedia isn't supposed to be a tutorial, either, but it's not even structured in a way that is suitable for learning these concepts anyway. If you're lucky there's good learning material in the "external links" but that's a crap shoot. Much better to learn math from the traditional sources: textbooks, school programs, good teachers, etc.
User avatar
Sogona
Posts: 186
Joined: Thu Jul 23, 2015 7:54 pm
Location: USA
Contact:

Re: How good are you at math?

Post by Sogona »

I've had a love/hate relationship with math for most of my life. I currently like it.

I was decent at math my first few years of school. I remember my dad teaching me the powers of 2 up until 8,192; and I don't think school'd even taught us the thousands yet. Then came multiplication and division of 3-digit numbers, which really screwed with me. I hated math for the next few years until I slowly but surely got better at it and finally got on the same level as most of the other kids.

Then sometime early in my 8th grade year I got hit by a car while riding my bike, resulting in a concussion. This was around the time they were prepping us for Algebra 1 (Basic solve-for-x linear equation stuff), so it was literally a foreign language to me for the rest of the year. I ended up, against the will of my parents, being put into what was basically the remedial math class my freshman year. Luckily though, a friend of mine in study hall showed me how to do a simple problem, and suddenly it all just clicked. Math for the next 4 years came surprisingly easy, to the point where I just read A Clockwork Orange in Algebra II for the last 2 weeks of class without paying attention to anything the teacher was saying and still aced the final.

Lol, sorry for telling my life story. :roll: Fast forward to last year, and Calc 1 kicked my ass, but I managed to come out victorious. Calc II was rough too, but not as bad. I'll be honest, I still don't fully understand the Taylor/MacLauran series; I'm probably gonna have to brush up on it before Calc 3 this fall. Anyways, I've decided I'm gonna try to minor in math. I plan on taking Multivariable calc, a class on DiffEQs, and then Real and Numerical Analysis.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: How good are you at math?

Post by FrankenGraphics »

I often feel shame on the subject of math, because i got behind the pace by some as early as 5th grade and barely managed senior high school math. I use mental arithmetic all the time, especially at work, and have learned some mildly useful everyday things (like interest on interest) from youtube tutors at a later point in life (it really helps when you can rewind and hear it again after some thinking). But i tend to have trouble keeping numbers in my head for more complex problems. Above all, my library of methods is small, and my understanding of the methods present is very limited. I'm probably at the bottom rank on these boards.

When i need to solve a particular problem, like needing to define the active area of a hit box for a button that's not square or circle and can't be solved with a visual vector layout, i look it up.

I've self-taught my self to use math enough to (adequately) understand and make simple analogue circuits (like an amplifier or filter). All the things i learned in BASIC/qbasic has proved useful when writing js-like scriptlets when animating in Adobe AfterEffects, but i could certainly get much better at it.

I sometimes feel a language barrier - both towards the language of mathematics, but also math in english. If i have one suggestion to improve how math is taught in any small language, it'd be to include an english glossary at the end of every chapter.
User avatar
TmEE
Posts: 960
Joined: Wed Feb 13, 2008 9:10 am
Location: Norway (50 and 60Hz compatible :P)
Contact:

Re: How good are you at math?

Post by TmEE »

Math was my weakest subject at school which I barely passed, and is the reason I wouldn't be able to get into any university to study the things I would like such as electronics stuff. All the stuff that was taught almost made no sense the way they were presented and things moved really quickly too, by the time I was almost understanding one thing there was a test that I fail or barely pass and another thing was brought up and you had to learn it. End result is nothing stuck, and pretty much nothing had any application so I couldn't even try to put those things to use somewhere so they could stick. Geometry was easy though, and only because I could put it to use outside the paper that was put under my nose.

On the bright side I vaguely remember the names of things and what they were supposed to be doing so I can look up the things over the internet and adapt the methods described to my needs. But that only works if things are actually described, a wall of formulas usually makes little sense and tends to abstract away the process of getting from input to output. If you feed things to me like to a CPU I'll immediately start seeing the connections and everything begins to make sense even though the whole thing would look whole lot bigger and messier the "programmer way" compared to "mathematician way".

Sometimes I have a problem at hand that I don't really know a solution for so I write down the numbers, make graphs or other diagrams and seek the connections, sooner or later I have found a perfect or good enough solution and can carry on (and I would have no idea if what I made exists already and what it would be called). So in a way I'm terrible as I don't know much and not terrible because I can understand it if it is presented the right way and that I can come up with things needed on my own too.
User avatar
Gilbert
Posts: 564
Joined: Sun Dec 12, 2010 10:27 pm
Location: Hong Kong
Contact:

Re: How good are you at math?

Post by Gilbert »

Well... I was a maths major in university, since this was the only subject I was good at in secondary school(I sucked hard in any non-science subjects, such as those history subjects, geography and economy(right), for science subjects such as physics and biology I was average at best and even for maths I sucked at arithmetic badly; that's to say something...).

Anyway, I graduated my university degree with a "not very bad" grade, and even continued to study for a master degree in maths afterwards.

Then, I got this job, an editor for textbooks, primary school maths textbooks actually. So, soon my knowledge in maths stayed at primary school level thereafter.
Post Reply