Todd
94 posts
I use x8664 assembly, Python, C, and SQL to fight malware. 
#10566
Mathematics 9 months, 4 weeks ago Edited by Todd on Jan. 28, 2017, 5:27 a.m.
I've met a fair share of programmers who, while they generally don't explicitly say "I hate math," tend to try to avoid it as much as possible. This has to be because I've worked with mainly web and some desktop projects (as opposed to games or scientific computing which clearly use more math). I'll admit that while I have not always been a "math lover," programming has led me down that path. Why? Because everything a computer does involves numbers and math is of course playing with numbers! Casey mentioned in a HH episode how some people go from totally hating math to loving it once they see it used in the context of something (such as programming). Share your relationship with math here and reasoning.
Some reasons/ways I've come to enjoy math with programming: 1. It's easy and fun to incorporate math into all different kinds of algorithms, such as computing prime numbers, fibonacci numbers, Carmichael numbers, etc... 2. It really does help. For example, if I get good with binary math and bitwise operators, I can make more efficient algorithms. In lowlevel computing, should you choose to, you can pretty much use numbers in place of everything. 3. Math algorithms seem to also be good to test out programming fields such as multithreading  it's pretty easy to put some serious load on the CPU with them and crunch numbers. 4. I've noticed that I can swap out inefficient code with a good mathematician's work and it will speed up an algorithm tremendously. An example was how I had written a very slow algorithm to compute prime numbers and then Martins told me to look up alternative primality tests. These tests allow for the load to be reduced on the CPU as the numbers get larger. Perhaps I'm biased, but I don't see "I've never been good at math" as a valid excuse. Unfortunately, at least here in the US, math is often not taught properly to suit the needs of students and this results in them feeling that they cannot do it. I was one such student, and when taught the proper way for me, I went from a D to a 100% in algebra and physics, not missing one single question on the final exams. By some teachers I was told that math "was a major weakness for me" and that "I struggled" but all it took was for me to find the right learning source and/or perhaps be given enough time to understand. Now I sit here, and frankly, my favorite parts of programming are the lowlevel numbers stuff, from playing with hex, octal, and binary into studying works of Galois, Fermat, Ramanujan, and now getting into cryptography. Anyways, share your stories about how you've used math in your programming journey. I'm the smartest man in Athens because I know that I know nothing. ~ Socrates 
CaptainKraft
Jeremiah 157 posts
2 projects
Father, husband, C programmer, and Linux apologist. Think before you code. 
#10576
Mathematics 9 months, 4 weeks ago
I've always been a fan of math despite the absolutely awful teaching methods here in the US. It makes me really sad how poorly most people are introduced to math because of how beautiful and ubiquitous it is. Unfortunately, it's up to the students to find a way to enjoy it rather than relying on professors to help them see the beauty.
In middle school I was pushed ahead in math classes because I was pretty good at it. I would get bussed to a high school with a small group of students and we would take classes that were a few years ahead of our peers. When I moved to Florida, the school systems didn't support students that were ahead, so I was brought back a few years and had to repeat the same math classes previously. Needless to say, I had a bad taste in my mouth for math education from an early age. In college, math gets a little better because you get to see some of the more complex parts of math that are super cool, but the way it is presented is still terrible. The good part is that you have tons of great math resources at your fingertips while in college from brilliant mathematicians to libraries dedicated to the subject. Anyway, I'll stop ranting for now and I'll leave you with a video I came across a while back that does a great job of showing some of the beautiful parts of math. Build a man a fire, he'll be warm for a day. Set a man on fire, he'll be warm for the rest of his life. 
John_Uskglass
Laurie 37 posts

#10582
Mathematics 9 months, 4 weeks ago Edited by Laurie on Jan. 28, 2017, 10:50 p.m.
I'll be honest, I've had a pretty negative relationship with maths for most of my life, and although programming has definitely opened my mind to some aspects of it, I still don't tend to get on with maths in general. That's not meant as a criticism of mathematics at all. Lots of people who really get maths assure me that it's often taught badly, and I'm completely prepared to believe I just don't understand it well enough to appreciate it. I'm just saying that my encounters with mathematics have usually been negative ones.
Leaving aside the childhood trauma that was school maths lessons, there are a few things I think I can point to that have led to my negativity towards mathematics. Specifically: 1. Maths often feels like it's designed to be exclusionary and elitist, in the way it has its own seemingly obscure notations and conventions. If I wrote my code in the way most mathematicians seem to write their formula, using singlecharacter unicode variable names for example, I'm pretty sure I would be fired. Code, on the other hand, feels like it was meant to be read. 2. Frequently, I find that the mathematics and the engineering practicalities simply fail to line up. A trivial example would be pretty much anything involving numeric representations in computers, which inevitably, being realworld things rather than abstract ideas, have limits in terms of magnitude and precision. This means that mathematically correct solutions will often not work in practice. Equally mathematics has no notion of computation time, because it is more about deducing statements of truth rather than figuring out how such things will be calculated. This in turn leads to infuriating things like bigO notation, whereby your hash table with a lookup time of O(1) + 50 gets reduced to O(1), and your array lookup ends up as O(N), and so you it looks like you should be using a hash table, but in fact, you know you'll probably only ever have 10 things in that container anyway, so the array lookup is always going to be better. 3. Mathematics often feels very overrated in programming. I remember applying to university and finding that none of the good universities would even consider my application for Computer Science because I didn't have ALevel Maths, even though I had ALevel Computer Science!! Equally whilst some specific programming domains clearly benefit from mathematics, the same could be said for almost any other subject. The fact that programmers working on artificial neural networks would almost certainly be better at their jobs if they had a grounding in neurology doesn't mean that all programmers should train as neurologists first. None of these things are meant as criticisms against maths itself. Maths is a different discipline to programming, with different goals and measures of success. Trying to "rate" maths by the standards of programming as I have done above is of course completely unfair and meaningless. However none of that really changes the bad taste left in my mouth. I wonder if any of these things resonate with any other programmers who don't find they get on with maths? And I wonder what can be done to help avoid these kinds of negative attitudes arising in future? @Todd I completely agree that "I've never been good at math" is a horrible excuse. The strange thing about it is that the statement itself may well be true, in as much as the person may never have good at maths, but it is almost always used to mean something quite different, specifically that the person is also never going to be good at maths. The fact that someone like me can be a gameplay programmer, which involves doing at least a certain amount of mathematics, suggests to me that pretty much anyone can learn this stuff. But what can be done to foster a more positive relationship between programmers/programming and mathematicians/mathematics from the ground up? 
graeme
33 posts

#10586
Mathematics 9 months, 4 weeks ago Edited by graeme on Jan. 29, 2017, 1:45 a.m.
In highschool I was terrible at trig and then avoided maths a long time.
Months ago pseudonym73 in the handmade hero chat mentioned that there's an easyish method of integration that is somewhat little known because calculus classes focus so much on integration by parts and so on. He recommended a book on it, manuel bronstein's symbolic integration, which is about how to write integration solvers. So immediately two things struck me. The first was that the very first definition, a terse definition of group meant for people who already knew what groups were, was the first definition of a group that made any sense to me. And you know a couple years ago I read edward frenkels popular math book 'love and math' and it is all about group theory and I tried to understand groups in that book and I learned nothing. And all those paragraphs in the wikipedia page trying to explain it all in english language terms and motivations and I learned nothing. But I hope everyone can see from that book that a group, in computing science terms, is a type This has really changed mathematics for me hugely: I used to think I needed these longwinded rationalegiving explanations before I understood something, but in reality it's that terse notation that makes mathematics work for me. Everything you need to know to understand a mathematical object on an area the size of a business card (with an example on the back). I understand this is problematic if you've been scared off maths for a long time and you don't know what the hell an upside down A is supposed to mean. In my opinion any maths not aimed at, say, upper level math undergrads and above, uses a symbol without first defining it should be launched into the sun. As a nice counterexample, there's a great (free) textbook on the discrete fourier transform by Julius O Smith that assumes no mathematical backgroundsince its discrete, you get away without any integrals, and he's free to focus on defining complex numbers and the complex exponential function without getting into calculus The second thing was that I really had too poor a grasp on even basic calculus to be reading a book on symbolic integration so I went off to read up on calculus instead. In particular I found a book that comes highly recommended from mathematicians, Spivak's Calculus, that is more or a less a series of terse definitions. It's not so dry as that, but it kind of is, and it works. It's really great to read a maths textbook that first begins by rigorously defining what a number is and what hell addition is supposed to be, then steamrolls over everything you didn't learn in highschool, and I recommend it to everyone who has never done so I guess maths is like a presentation: if you're standing there just restating everything on a slide it's not a very good presentation. I've found when reading maths my eyes often flow over the equations and skip to the text as if I'm going to find what is really 'meant' there, and this is a terrible habit. If anything, i'd be better served trying to guess what the text would say from the equations Since then I've always had a current maths textbook I've been reading. Recently I finished a book, approximation theory and approximation practice, where I found myself so surprised by some of the theorems I found myself implementing them to experiment a little and to find out if they were really saying what I thought they were saying. It's a nice feeling edit: after writing this post I ended up clicking around the ATAP site and it turns out there are lectures on it available from the author. It's really a genuinely good book: https://people.maths.ox.ac.uk/trefethen/atapvideos.html In SeptOct 2015 Nick Trefethen, Professor of Numerical Analysis at Oxford and Global Distinguished Professor at NYU, gave an 18hour series of lectures at NYU presenting all 28 chapters of this book. The lectures are full of unusual mathematical, philosophical, and historical perspectives, and everything is illustrated by Chebfun demos on the computer. This is a unique resource for those who want a deeper understanding of the foundations of numerical computation. 
msmshazan
Shazan Shums 166 posts
Some day I will make quality software. 
#10587
Mathematics 9 months, 4 weeks ago
I have problems with applied mathematics (physics like).
Eg: rigid bodies,frameworks, centre of gravity and all those Any recommended good resources. Just being curious on programming.... 
Drekryan
Derrick Lambert 1 posts
None 
#10589
Mathematics 9 months, 4 weeks ago Edited by Derrick Lambert on Jan. 29, 2017, 3:46 a.m.
I have found the videos done by Jorge Rodriguez on YouTube to be great resources on programming and mathematics. You may find some of his Twitch streams or math tutorials to be helpful as well.
https://www.youtube.com/jorgevinorodriguez https://www.twitch.tv/bsvino None 
nothings
Sean Barrett 16 posts
1 project
former pro game developer (Thief etc. @ LookingGlass) 
#10590
Mathematics 9 months, 3 weeks ago
As the person who offhandedly said something like "I'm scared of math" at handmade con, and as someone with a generally opposite experience, I suppose I should comment, even though I doubt it's at all helpful.
First of all, bigO() is totally useful and awesome. You just have to measure the right thing (like, say, unique cache lines touched). They don't matter with 10 items, but eventually you're gonna be working with 10,000 or 100,000 thingswell, if you never do, ok, good for you. But e.g. hash tables ARE better than binary trees, and O(1) and O(log N) captures most of the reason. Second, I was totally awesome at maths in my teens, very highly ranked on tests, and I wasn't scared of math during my 20s. When I graduated high school it was obvious I should either be a programmer or a mathematician. I liked programming and I didn't particularly like mathematics (even if I was good at it), so the choice was easy. And even into my early 30s I had really good math intuition, I would often see things as intuitively obvious that someone else would have had to work through on paper. But as I've gotten older, I've been exposed to a lot more areas of math and my intuition hasn't carried through to them. I still have trouble thinking about quaternions (and barely ever use them because of that). In addition I find myself less and less willing to sit down and walk through mathematics and prove a formula (like I did with texture mapping in my 20s), vs. just looking it up on the net. Partly that's a matter of it taking too much time, but partly also a matter of being slower at it and concern over making mistakes. It may not be universal, but I definitely feel like an example of the "mathematics is a young man's game" cliche. Nevertheless, as OP mentioned, being familiar and comfortable with linear algebra and basic trigonometry is really useful for game programmers (which isn't everyone). Rotation matrices and solving linear equations are really commonplace in game development. And not being afraid to set up and solve a quadratic equation is wise too. These are all things I'm not scared of, which of course means not even batting an eye at plain old algebra. None 