Issue #3
April 7th, 2001

 

Advanced math vs. programming

Many people think that you need to be a wizard at math to be a programmer. This is a common misconception, and the QB community (with people of ages ranging from 12 to 19) is the perfect example to show that the above is a stereotype. The question: how much math do you actually need to do programming? What about the amount of math needed to program different levels of programming language? (think QB vs. C++ vs. ASM)

To answer these questions, it is imperative that we look at the programming. Being more experienced in QB programming, I'll talk in terms of QB programming first.

In simple QB programming, all you need is to know how addition, subtraction, multiplication, division and parenthesizes (in short, brackets) work, and to take note of the order of precedence of these arithmetic calculations. You don't even have to calculate the numbers. That's because the computer does all the mental madness itself. You can give it 29644 *12334 +12123 -12422 / 2354, and it spits the correct answer out every time, even taking in account the performance of the multiplication and division before the performance of addition and subtraction. To calculate the above statement with pencil and paper would be a rather tedious job, and you should be glad that the computer is there to calculate it. So, in terms of arithmetic, you only need to know you very basics. A fourth or fifth grade standard in math would do.

A rather basic knowledge of algebra is also needed by the beginner. Your variables are the algebra symbols in many ways. It should suffice to say that without a background knowledge in the application and usefulness of algebra, it's going to be almost impossible to accept variables, even in QB programming where many things are simplified for you.

Apart from algebra, a good mathematical knowledge in number types is also recommended. From your math, you should know what is an integer and how it refuses to take in decimal numbers, preferring instead to round the number off to the nearest whole number (as a side note, please note that in math, your integers don't have a numerical boundary whereas in QB, your integers
are bound between -32768 to 32767 inclusive. QB, and probably many other programming language's integers are bound like this so that they fit into 2 bytes of space). Know your decimal number system by hard. Since this is QB, you don't really need to know your binary (base 2) and hexadecimal (base 16) number systems, at least before you reach the advanced portions of programming. You don't need to know the octal (base 8) system either. You would have to be experienced in hexadecimal number system if you fiddle with ASM though. An understanding in binary is strongly encouraged to understand the technical stuff such as your data storage and management (for example, how the computer performs arithmetic in binary form quickly). I don't know how the octal system came about, so I'm not used to base 8 numbers. I don't think any aspiring programmers need to know the octal number system now.

A more abstract part of mathematics is needed in slightly more complex areas of programming in QB: logical operators. Logical operators, in case you do not know, are your ANDs, ORs, XORs, NOTs and so on; those things that you use in your IF statements (there are more obscure logical operators such as IMP, EQV, NAND and so on, but nobody uses them, so they are not discussed)
This is not really taught in schools in math lessons. Rather, you should understand this separately as a math concept first, than apply it to your programming. One way to understand logical operators is to just explain them in English, as in "AND means that both conditions must be true for the result to be true" or "XOR means that both conditions are true or all conditions are false, the result is false", but a more professional and standard way to express them is through truth tables. Truth tables are tables plotted for all combinations of the truth of both conditions. In case you do not know what I am talking about, below are two truth tables, one for AND and one for the obscure XOR, where "0" represents a false condition and "1" represents a true condition:


As you can see, the illustration of logical operators with the help of truth tables really help.

As for trigonometry, one of my most disliked aspects of mathematics, good news for you: unless you are programming some kind of graph program or some unimaginable application, you usually won't need to touch trigonometry at all. The same goes with calculus, which is another section of math which I disliked.

The highest order of mathematics: "logic", cannot be forcefully taught. You can only pick it up through experience. This is the most important part of programming, and this is the part which most successful programmers are rich in. Logic differs from logical operators because logic is much more difficult and much broader than logical operators. Logic is the thing in mathematics that allow you to think of proofs in the math field, and algorithms in the programming field. This applies to QB, and even more in
other lower level programming languages, like C and ASM. Logic is the thing that separates good programs and bad programs. In some ways, logic is our so-called "common sense", but logic is even more than common sense; logic is common sense used actively.

All in all, remember the crux of this rant: you don't really need advanced math to program, at least in QB. A high school grade is enough. So if you have a younger friend or brother (or even yourself) who is thinking about programming, go on. There is always room for improvement, and you don't need many mathematical skills to start programming.

If you wish to read more articles like this, please visit http://qbtalk.zext.net/

This article was written by: Singsong - http://qbtalk.zext.net

All site content is © Copyright 2001, HyperRealistic Games. This excludes content submitted by other people.