# “How much math do I need to know to program?” Not That Much, Actually.

When you run this program, it produces output like this:

======================

Start of combat #1

Alice misses Bob.

Bob (12 hp) hits Alice (14 hp) for 6 points of damage. Alice is reduced to 8 hp.

Alice misses Bob.

Bob misses Alice.

Alice misses Bob.

Bob misses Alice.

Alice misses Bob.

Bob misses Alice.

Alice (8 hp) hits Bob (12 hp) for 5 points of damage. Bob is reduced to 7 hp.

Bob misses Alice.

Alice misses Bob.

Bob misses Alice.

Alice misses Bob.

Bob (7 hp) hits Alice (8 hp) for 2 points of damage. Alice is reduced to 6 hp.

Alice (6 hp) hits Bob (7 hp) for 6 points of damage. Bob is reduced to 1 hp.

Bob misses Alice.

Alice (6 hp) hits Bob (1 hp) for 1 points of damage. Bob is reduced to 0 hp.

Bob has died.

Alice won 1 (100.0%) fights. Bob won 0 (0.0%) fights.

But maybe Alice just got lucky in this one fight. Let’s reprogram this program to turn off the verbose output (displaying text on the screen takes a lot more time than running the simulation) and up the number of fights to 30,000 (this is just changing the NUM_FIGHTS variable to 30000 and the VERBOSE variable to False):

Alice won 12909 (43.03%) fights. Bob won 17091 (56.97%) fights.

So we can see that with the given stats, Bob is at a slight advantage. The computer just ran 30,000 simulated fights. If we were to play 30,000 fights of Dungeons and Dragons with pencil, paper, and physical dice, it would take months to calculate this. But my laptop had the results in less than 8 seconds.

But what if we increased Alice’s hit points from 14 to 20. Who would win then?

Alice won 19438 (64.79%) fights. Bob won 10562 (35.21%) fights.

We see that those 6 extra hit points turns the tables and gives Alice the advantage. How about if her hit points were only increased to 16 instead of 20?

Alice won 15176 (50.59%) fights. Bob won 14824 (49.41%) fights.

We see that just tweaking the stats by 2 hit points is just enough to even out the advantages that Bob gets from his higher level of damage.

And when you look at this program, **the only math it uses is addition, subtraction, and multiplication and division to find a percentage**. Even if we made the simulation more sophisticated to account for the effects of magic spells, healing potions, multiple attackers, and switching to different weapons in mid-combat, we wouldn’t need to know more math or have made good math grades to do the programming for it.

Sure, go ahead and learn more math. It can only help you become a better programmer. But how much math do you need to know to program? Very little, actually.

*UPDATE: I guess I’d add basic algebra to the required knowledge, but only insofar as that if X * 3 = 12 knowing why X is 4.*

*(Here’s a list of other discussions on Reddit about this topic.)*

- Math in programming – I’m concerned that I should give up trying (89 comments)
- Is there hope for having a career in programming if I’m terrible at math? (50 comments)
- What areas of math are the most important to computer science/programming? (26 comments)
- Why is Discrete Math so important? (20 comments)
- How much math do you need to become a good programmer? (20 comments)
- Is it possible to be “almost ok” at math and still be a good desirable programmer? (13 comments)
- Should I brush up on math? (10 comments)
- This may be the dumbest question I have ever posted online. How much math does one actually need to be a good programmer? (11 comments)
- I’m trying to learn c++ but why do tutorials always have math problems? (7 comments)
- Worth while improving math skills? (8 comments)
- What math courses should I take if I really want to delve into 3D? (15 comments)
- What is a better supplement to a BS in Computer Science? Math or Physics? (11 comments)
- The importance of Math for Programming? (6 comments)

Page 4 of 4 | Previous page

Sam:

March 18th, 2012 at 7:47 pm

While this is true, it could be argued that rather than the math itself, it’s the ability to think intuitively using math that is the key.

Then I suppose it follows that people who are able to do this will often have learned more math.

Mark:

March 18th, 2012 at 8:40 pm

I think Sam pretty much just nailed it. It isn’t the amount of math that you know, it is being able to use simple math in ways that you may not naturally think to use it in.

Good post.

Josh Gachnang:

March 18th, 2012 at 10:20 pm

Certainly learning more math will help you think in terms of programming. I don’t think in a school setting, however, a heavily math based curriculum (commonplace in US CS departments) is as helpful as tackling problems with code. Specifically, I don’t think calculus is as helpful as spending the same time learning to solve problems using code.

Jason:

March 19th, 2012 at 12:07 am

My point is similar to Sam’s point. You need to know math in order to program, there’s no way around it. However, the article mistakes mathematics with calculation. Mathematics, generally speaking, as abstraction, logic, and deduction.

If you can’t abstract, you can’t program. Take the Pythagorean theorem, that’s an abstraction of the instance 3^2 + 4^2 = 5^2, which is a class of triangle, specifically a right triangle.

For example: “And when you look at this program, the only math it uses is addition, subtraction, and multiplication and division to find a percentage.”

The D&D simulation might have simple calculation but it uses much more math than that because it’s model of combat. When constructing our model we didn’t include hair length or eye color as properties, which are present in actual battle. But in modeling battles those traits don’t seem to matter much in battle. Abstracting out what matters and quantifying it is the heart of mathematics.

This article really makes the case.

http://www.codinghorror.com/blog/2006/07/separating-programming-sheep-from-non-programming-goats.html

Professors gave students simple tests, like the one below, and many failed. The concluded that either you can program or you can’t.

int a = 10;

int b = 20;

a = b;

What are the new values of a and b?

Gabriel C.:

March 19th, 2012 at 2:56 am

Yes, you don’t need to know (much) math to start learning programming, but to be a good programmer I think you need it.

And is not for the actual math you’re going to use, the most important programming skill is the ability to abstract.

The best way to learn that? Yep, Math…

mangecoeur:

March 19th, 2012 at 3:29 am

I must say I was a bit surprised when I started learning programming how little maths was needed – I came from a hard science background with a head full of matrix transforms and calculus, and the most complex thing I’ve ever needed is 3D geometry.

I think what you really need much more than maths is the problem solving instinct. Here maths helps you ONLY if you were taught maths “correctly”. Some schools emphasize memorization to teach maths – rote learning of forumla and solutions – this doesn’t help you at all. Others are good at giving you the core elements and teaching you how to use them to solve novel problems, I was taught this way and it definitely helped me a lot.

Alex O:

March 19th, 2012 at 4:36 am

I agree with Sam. It is all about having an intuitive grasp of logical outcomes. You need to be able to reason about what effect a series of steps will have. The skills that let a mathematician recognize a valid proof or derivation are the same skills that let a programmer know that a piece of code is correct after reading it.

I would also add that the more math you know, the more comfortable you can be that you aren’t writing something in a silly way. If something you write takes forever to run or breaks on large inputs, then if you have a poor grasp of mathematics you won’t know if there is a faster way or if your problem is really intractable.

ΤΖΩΤΖΙΟΥ:

March 19th, 2012 at 5:11 am

100% means 100/100 (or 100÷100, if you prefer), which is equal to 1.0 . *Always*, not *often*.

Jirota:

March 19th, 2012 at 5:59 pm

From experience, I firmly believe in the general gist of what the author mentioned.

I am what you call an “average” programmer. I don’t come from a hard mathematics background. When I shifted to the programming field, I was mainly involved in doing small modules for business applications, and then later on involved in full-bore business systems. Most of what I have done are still in operation, and I am still doing maintenance programming on many of them e.g. addition of features, adopting to new work procedures, etc.. This is in contrast to some of my colleagues coming from the so-called mathematics field whose outputs, many of them, are not being used because they did not “fit” what the user wanted.

In most of the applications I have done, there is not much mathematics required. I have not even utilized Calculus. It may have been “abstracted” in APIs or libraries but it would not be fair for me to say that I “used” mathematics just because of this (just like saying that I used the science of electronics, optics, and the attendant “deep math” of it just because I’m using a karaoke microphone).

Yes indeed heavy mathematics is important in many areas like in designing new and better compilers, or software that best renders light in the monitor, or software that would enable electrons to travel faster etc.. But how many are really doing these types of work. Can we say that, extensive math is needed in all programming, as some would say, just because of this so-called heavy stuff?.

As for abstraction, I don’t believe that Math has the sole superiority on abstraction. The best abstractionists in the world are not mathematicians. Just look at the paintings…, or just look at the authors of the best computer programs… whatever those are?

By the way, I am going to enroll in a masteral degree in applied mathematics.

zemelka:

March 21st, 2012 at 12:56 am

Probably, a loose knowledge about functions and recursiveness can also help.

jsc42:

March 21st, 2012 at 3:22 am

One confuion is that math (US) / maths (rest of the world) is not just arithmetic but also mathematics. The latter has a much wider scope. Even sticking to arithmetic, a solid grounding is important for any non-trivial programming. Whilst a lot can be done with library functions, understanding which one to use and how to use it properly requires background knowledge of the domain. Programmers must be aware of the peculiarities of computing mathematics, e.g. how to reduce rounding errors on long calculations, how to determine which algorithm will complete in a resonable time, etc.

This does not mean that you have to be good at arithmetic. E.g. just because you cannot do square roots in your head or even quote the Newton-Raphson formula and use it to derive a technique for calcualting square roots does not obviate you from the obligation to understand the principle of how square roots are derived on a computer. Just a cursorary understanding will lead you to conclude that (x == sqrt(y)) is a much slower test than the equivalent (x*x == y).

Another aspect is to have the right level for what you are programming. You correctly assert that not a lot of knowledge is needed to program an ‘Angry Birds’ app as the libraries encapsulate all of the maths required. However, I would not want to live near a nuclear power plant programmed by someone who did not understand the physics and the maths for nuclear reactions.

sl@sh:

March 21st, 2012 at 4:15 am

Regarding basic operations (+, -, *, /), preference should also be mentioned, as well as the proper use of brackets to influence preference.

Even/odd may also be determined by the bitwise & operator available in many languages.

I’d also like to point out that knowing the cartesian coordinate system might in fact not help that much. I know it did confuse me quite a lot when I first encountered graphics programming and realized the y axis was going down, not up! I’m not at all sure if knowledge of cartesioan coordinates actually helped me that much: I pretty much had to relearn it as I went along programming stuff that I saw right on the screen. It wasn’t too hard either.

Furthermore, you forgot at least two things:

1. Boolean logic: you have to know how to combine conditional statements, e. g. in if statements

2. Manipulating expressions: you gave the example of the pythagorean equation and then without losing a step went on to explain the use of it in calculating the distance. What you did, implicitely, is manipulate the equation to get a formula for what you needed. Without the knowledge how to manipulate equations, all the theorems in the world won’t do you any good in programming!

Fiquin:

March 21st, 2012 at 4:46 am

You need no math at all. Programming is a human science.

Sanmathi:

March 21st, 2012 at 5:57 am

Very well written post… :)

Daniel:

March 21st, 2012 at 5:57 am

Quite simply, programming is about problem solving, and maths is about problem solvng. If you’re good at maths, it’s likely you’ll make a good programmer.

Shady:

March 21st, 2012 at 6:05 am

Please, please, please; you say mathematics, why say math. Insert mathematic for each case of math and see how silly it sounds. Please use maths when you shorten mathematics. Do the maths!

dave:

March 21st, 2012 at 6:06 am

You’re going need to understand how sets work if you have anything to do with databases, and you may need a bit of logic (“not a and not b” is the same as “not (a or b)”).

Larry:

March 21st, 2012 at 6:13 am

In the old days (back before the big bang), it was stressed in advanced programming and computer science classes that: “If you don’t know math, you have to invent it.” Math-savvy programmers didn’t have to “reinvent the wheel.”

Many programmers with little math, wrote extensive, obscure, unstable code because they didn’t know (or even care about) the most simple, elegant way to create the best algorithm to perform a function. They just wanted to put in X and get Y.

You could always tell when someone knew their math well, because they wouldn’t take as long as other programmers. Their number of lines of code would be less. Their lines would be shorter, more clear, more readable, and obviously be more stable. They had much more shortcuts, like ANDs, ORs, XORs, MODs, NULLs, etc.

Algol actually required the use of these functions. You could often write a full page of fortran in just a few algol characters.

Shon:

March 21st, 2012 at 6:24 am

Yes, you can test for odd or even using modulus, but it is a rather silly thing to do since doing a bitwise “and” with 1 is at least an order of magnitude more efficient. e.g.

In C:

if (x & 1) …

in x86 assembly:

test eax, 1

jz even

Kay:

March 21st, 2012 at 6:27 am

@Josh Gachnang

“If you can’t abstract you can’t program.”

Oh that’s not true. You just can’t program well. See turing.

Guru:

March 21st, 2012 at 6:34 am

“Not that much, actually…” lmao

(You also forgot the importance of the order of operations.)

Put a programmer that is good at math beside a programmer that isn’t. Tell both of them to build a program that pulls numbers from a database that involves several table joins and compare results. The programmer that is good at math will realize that there are duplicate records (due to the joins) that are causing inflated counts. The programmer that hates math will assume the computer is doing the math correctly.

Both can program. Which one would you choose to be on your team?

Wendell:

March 21st, 2012 at 6:38 am

I agree with mangecoeur. Problem solving comes natural to some, like math, but most it does not, it has to be learned. In this world where high tech touches every aspect of ones life, problem solving skills are in short supply. There needs to be an overhaul of secondary education where most students begin to learn advance math. Let’s face it most students will never use the math they learn and don’t see any relevance in learning it in teh first place. But the problem solving skills that they are supposed to learn in math class are not taught but are acquired through osmosis while being in math class. This has to stop. We need more classes in abstraction, logic, deduction and problem solving to get to the next level of software development. It is time to take programming from the math majors and put it in the hands of the left-brainers. Creativity is what yo need to program not advance math skills.

Rudi:

March 21st, 2012 at 7:11 am

I would add the Set Theory basics you need to properly understand and work with Relational Databases, a must in the vast majority of business apps.

Jeff LeMieux:

March 21st, 2012 at 7:36 am

The statement “To get a percentage of a number, multiply that number by the percent number with the decimal point in front of it,” is misleading. Using this method would give a result of the value 0.6 for 6% instead of 0.06 and, perhaps 0.04 for 0.04%. A better choice would be “Move the decimal point two places to the left”

shooter:

March 21st, 2012 at 7:44 am

All those differential equations and complex number systems and series aren’t that much needed, it means!

SimplyRetarded:

March 21st, 2012 at 7:47 am

What I see happening, even as of 2012, is poorly-trained programmers screwing up the most fundamental task of knowing WHEN to round … and when not to. In the financial arena, such a common mistake can quickly amount to a BIG discrepancy depending on how long it goes unnoticed. I’ve personally witnessed such a mistake whose discrepancy grew to hundreds-of-thousands overnight.

Frankidoze:

March 21st, 2012 at 7:47 am

Well if you consider that Boole’s Algebra is not a basic requirement,…

Seriously not cool to forget that…

Anon:

March 21st, 2012 at 8:23 am

The link to flash animation for AES (Rijndael) is missing. The name is also misspelt.

Anonymouse:

March 21st, 2012 at 8:27 am

I basically agree with the article in regards to the amount of math one actually needs to do their programming tasks and the points raised by Sam regarding the ability to think mathematically. They nailed it.

My sorrow is that I’ve seen a lot of places where people think that math is only calculation and algorithms and ignore the fact that, for a programmer, a very important part of mathematical arsenal should be the ability to do basic logical operations. There are so many cases in which a programmer could not simplify a logical condition because he was unsure how the logical operations work. But why am I talking about complex operations; I bet everyone here has once encountered the infamous “if (isSomething == true)” in some other people’s code. (I can give tons of examples of such horrors.) I’d say that questions about basic boolean operations should be part of any job interview, but unfortunately they’re not.

felipe:

March 21st, 2012 at 8:39 am

I think you are missing the fact that to do good SQL programming, you need to be able to think in therms on sets. So, set theory is a must.

Edward:

March 21st, 2012 at 8:54 am

I’ve found in almost 40 years of programming that only the basic math concepts listed in the article were required of me. I have yet to need the Pythagorean theorem though. I actually hate math and have never understood why for so long it has been deemed fundamental to programming in general. Granted, there are some things that are beyond me, like graphics programming, cryptography, queueing theory, etc. But in my work on real-time, client/server, data communcations, and web applications, those skills haven’t been required. And if they were, then obviously I’m not the person for the job.

Whatever I needed to learn to prepare me for a career as a programmer I picked up somewhere along the way. Not from mathmatics though I can assure you.

Alexis GERMANEAU:

March 21st, 2012 at 9:12 am

When I think to Toto.equals() and Toto.hashCode(), that remebered me some pieces of fundamental algebra about equivalences and equivalences classes.

I may need to override both together because a.equals(b) shall imply a.hashCode()==b.hashCode() … ouch… logic is not that far.

Also I love when Map I use are “relatively” perfomants so maybe that the morphism “hashCode” I implements shall be relatively well balanced…. probabilities seems not that far.

My experience tell me strongly injective functions are difficult to inverse and this is difficult to make hypothesis about their inverse images. So I don’t see how to insure that “p(Toto.hashCode()=X)” is relatively uniform.

Finaly marketing, as always, are unclear about features and Toto is still unstable so it is difficult to build good hash function.

Luckily, I’m confident Toto will only contains totaly orderable fields to be taken into account.

I can build a total order on each fields it contains, so forget Map, I will use lexicographic order which is fortunately still a total order. So let’s use a SortedMap wich is still a good compromise in term of complexity (log2 of the number of entries).

Hey guys don’t tell me that all this stuff are math !!!!

I’m just speaking about implementing “Toto.equals()” and what the impact into my container ^^

Stephen Watson:

March 21st, 2012 at 9:23 am

Here is a thought. Instead of going through all that why not do collision detection modified by armor rating and or damage rating of the weapon. Seems to me you would need even less math. I realize this is a little beside the point it just seems to me knowing what the programing language can do is just as,if not more, important as trying to impress someone with a complicated mathmatical formula.

Dan Sutton:

March 21st, 2012 at 9:39 am

Good article… but one comment. You don’t mod a number with 2 to check if it’s odd; you AND it with 1 — much faster.

Brad Rhoads:

March 21st, 2012 at 9:42 am

I struggled with math early on. But after getting into programming, I found math got a lot easier. It’s really the same thought process that you learn. I think a key difference is the feedback you get by solving compilation errors and then application errors.

Mark:

March 21st, 2012 at 10:24 am

Two areas of Mathematics that you have not mentioned that would be useful to a programmer are boolean logic (plus possibly predicate logic) and decimal fractions. Decimal fractions would be useful for understanding floating point numbers and why they are not 100% accurate.

Richard Jackson:

March 21st, 2012 at 10:25 am

I would hate to find out the programmer that programmed my calculator didn’t know Basic Algebra… :>)

Anonymous Coward:

March 21st, 2012 at 10:40 am

You don’t need a lot of math to be able to program. You do need a lot of mathematical knowledge and training to be able to program well.

Brandon:

March 21st, 2012 at 12:18 pm

Operator precedence is vital to reading and understanding code. People write all sorts of complicated expressions and it would be nearly impossible to understand their function without understanding the order the operations occur in. It also helps to be able to write code without a million parenthesis.

Mark:

March 21st, 2012 at 12:25 pm

You can more or less do everyday programming without deep mathematical knowledge, but it seems misleading to say that you can learn the 3D libraries, physics engines etc and understand how a game works. Writing a game starts from the fundamentals, and the basis for this is a working knowledge on some mathematical topics. Other than that, a really good article on the subject :)

Andrew:

March 21st, 2012 at 1:55 pm

Programming is a bottomless ocean. But usually ops with bits are a must. Therefore, one must know what means AND, OR, XOR and NOT ops. As for me, I’m working in area, where one cannot do without advanced math. Image matching for aerial photogrammetry. There is a powerful and very unpleasant idea in programming- to replace pros by idiots. This is where such tips like “you may not know math, use libraries” go from. I met some wise boys, trying to solve problems, that they was not prepared for. A nice example- fingerprints, obtained from 3D scanner. One such boy wanted to extract papillary lines from it without knowing geometry of curved surfaces nor regularization. Another similar situation- FFT- Fast Fourier Transform, often used to compute convolutions. One MUST know underlying math in-depth, otherwise naive usage of corresponding libraries gives him some strange-looking mess.

Andy:

March 21st, 2012 at 3:18 pm

I have invested some time and effort recently improving my math due to a project that involved interpolation of unknown points along cubic and quadratic bezier curves. The result is a program that works correctly and I understand what is going on under the hood. I could have used a library or modified a code example but I feel that improving my math enabled me to solve problems more effectively and produce better code.

Whilst the original post is true, you don’t need to know much math to program, improving your knowledge little and often will make you a better programmer.

Ken:

March 21st, 2012 at 7:59 pm

Those who say “maths” is a proper word, clearly don’t know the Etymology of Math. The word “math” in and of itself is plural. Maths isn’t, and never has been an English word. (I have to admit I don’t use “Etymology” much, when I first spelled it out, I found out it was the study of insects. Also, unfortunately, my spell-checker does say maths is a word.)

Math encompasses Mathematical equations, Mathematical concepts, Mathematical theories, simple, irrational, geometry, trigonometry etc. However the colloquial expression “Do the Math” usually limits math to addition and subtraction. Implying whatever “it” to be done is, is a simple mathematical operation.

“Know what a Cartesian coordinate system is.” Well, if you do, you’d also know that programming in terms of graphical displays, use a modified form of that system. (In the standard 2 dimensional x/y model, an increasing y value goes vertically up.) Positive y going down is a nod to the English top down form of writing and makes the layout of graphical images mixed in with text much easier to think about. Though, come to think of it, combining text and image in HTML aligns them both in the classical Cartesian manner. (The text is pushed down so the bottom of the text aligns with the bottom of the image.)

Louis:

March 22nd, 2012 at 2:54 am

Just enough math to check your payslip :)

dahnuguy:

March 22nd, 2012 at 7:23 am

I am just amazed that he thought it necessary to actually explain the D&D combat system to his target audience.

Of course some of us may have played before THACO was introduced.

Mike:

March 22nd, 2012 at 9:39 am

Math and as noted more importantly how to use mathematics (really important) is important, but it also depends on what programming discipline (industry) you are in. If your programming skills are in accounting type programs than basic math is all your going to need (these days) unless your reinventing charts, then you better know some basic on screen drawing math. On a factory floor if your involved in PLC’s you better know your number system conversions or have a tool to do so. If your doing gaming the sky really is the limit, depending on the game itself.

Abraham L.A.:

March 22nd, 2012 at 9:47 am

A programmer should know nothing but to solve any given problem regarding any area of expertise, someone who can learn any subject with out much trouble

GoldPanther:

March 22nd, 2012 at 9:50 am

I agree with some of the others above that math provides the style of thinking that helps with programming. If you didn’t do well in math classes, there’s a probability that programming isn’t for you. Also, set logic is a good math discipline to look into. This is just programming though. Once you get into design, there’s a possibility of more. Whether it is with crunching the numbers for system architecture feasibilities, solving a complicated problem (i.e. video forensics using tools like Fourier transforms, Taylor series, etc.), etc. My point is that overall the article is correct that you don’t need a great understanding of math to do most programming tasks. There are some projects that can require much more though especially if you have design responsibilities.

Lazar Videnov:

March 24th, 2012 at 5:25 am

You do not need that much mathematics to program but the way mathematicians think is definitely a requirement for effective programming and helps really a lot. It is not necessary to be a maths genius to do good programming but it helps :-)

Paddy3118:

March 28th, 2012 at 6:39 am

That may be enough to write a program, but not enough to be a programmer.

I am more in the camp of this guy: http://www.eetimes.com/design/embedded/4238223/The-education-of-embedded-systems-software-engineers–failures-and-fixes?Ecosystem=embedded&cid=NL_UBM+Electronics

- Paddy.

Eric:

April 3rd, 2012 at 1:33 am

In school, my understanding of mathematics sucked to the point that anything other than basic arithmetic was beyond me. 20-odd years later, my understanding of mathematics still sucks; I still look at formulae in mathematical notation and stare blankly much of the time. What has improved most whilst coding was my knowledge of available mathematic/arithmetic tools and the understanding of how to apply them to the task at hand, rather than my actual grasp of mathematics. In short, it’s not necessarily what you know, but how well you know it that is the key.

For example, I write a lot of 3D-oriented code, which requires copious use of the dot and cross products. I still don’t understand the theory behind how they actually work, but because I understand what they do within the context of matrix manipulation, I am able to code effectively with minimal fuss. Try creating a camera looking at a 3D scene without knowing how to construct and manipulate the required matrices, in the correct order, to produce the desired output; sorry, but it’s just not possible without taking trial-and-error to an order of magnitude. Knowledge is power, but context is everything.

Apart from Boolean and bitwise operations, operator precedence, data typing and some minimal set theory, the single biggest mathematical oversight by the OP is Algebra. Look closely at every level of programming language (be it C++, Python or even assembler) and you will notice that the language of code is Algebra. Without understanding how ‘c=a+b*2′ works in terms of assigning values to tokens and operating on the tokens [a,b] to produce a result in [c] – rather than the actual values within [a,b] – you cannot write effective working code, period. Algebra should have been the very first thing on the ‘must know’ list.

Finally, I offer this as food for thought: a good coder knows enough to perform the task at hand; a great coder recognises what they don’t know and is prepared to do the hard yards to learn it, so the task at hand is performed faster and smarter.

Charles Wolfe:

April 7th, 2012 at 7:28 pm

Mathematics is the art and science of discerning patterns; it is not the art of calculation. Calculating is only an expression of the application of mathematics to specific problems.

The reader comment noting that percent calculating requires moving the decimal point 2 places rather than in the manner the author describes only begins to indicate the author’s errors in the calculation hints and other even more important messages in the article.

Saying all the odometer readings in his example represent the same value only works because there are no fractional miles shown. I dare the author to post the binary equivalent of .3 decimal miles as a non-infinite sequence of binary 1 and 0. Any one who works with dollars and cents, or any sort of fractional values, knows this fact all too well or suffers the consequences. Why does he think IBM invented Packed/Unpacked Decimal numbers and decimal arithmetic, which most computer systems have implemented in hardware or a software library?

One needs to know the art of abstraction from specific to general problem. Does the author write a separate subroutine (method) for every individual case of a functional requirement or does he generalize and write a subroutine that works for all specific instances of that requirement? One needs to have a “tool box” for going the opposite direction as well. Most programming problems are too big to be dealt with as a whole. They need to be broken down in to sub-problems that are tractable.

Mathematics also teaches how to look at a problem and figure out that it is the same as one already solved or how to characterize the new specific problem in a way that describes an entire class of problems.

Personal note: Programmer and software engineer for > 40 years; CS/IT professor as well for ca 20 years.

Vicki:

May 17th, 2012 at 2:52 pm

I believe “maths” is common British usage, and “math” is American usage.

I’m American, and I am not a mathematician, but I’m interested in programming. I’m learning Python for fun.

I took some computer programming courses years ago, to be able to communicate better my department’s needs to the IT department where I worked. I had to learn enough about programming to re-phrase my requests in language they would understand so that they would be able to mentally picture a framework of the project in their own minds.

I majored in English and Spanish as an undergrad. From what I can tell (so far) programming languages are just that – languages. Anyone from a linguistics background can learn the rules and do programming. Not that much math is truly required. I took college algebra as a liberal arts undergraduate. I haven’t had any trouble learning programming concepts so far. My impression is that once you know the “grammar” rules you can write the code.

Alexis GERMANEAU:

January 16th, 2013 at 3:09 pm

After a while I really needs to comeback to this post.

I finally and definitely agree to both point of view.

Math is needed to understand the world (I’m french, and french guys don’t understand world without maths) and and specifically algebra (including logic, magma, abelian groups, quotient and so on …) math is the fundament of computer science.

I had life before to become germano/french guy blinded by first order logic and truth complexity, I was just a simple kid amazed by what a machine ca do when I was asked to do it, whatever my math background was.

So finally I deffinitely agree with the post, just take a machine, write and amaze yourself of what it can do, math will follow.