Super Calculators: The Math of Computers
Computers touch nearly every area of life in today’s modern world. Calculations carried out on computers have helped cure diseases, ensure our buildings can withstand amazing forces and entertain us with complex computer animations. Of the numerous ways math relates to computers, we will look specifically at three areas of number systems, robotics and computer animation.
One of the first math skills we master is how to count. Then we learn to manipulate those numbers using various mathematical operations. At the core of a computer is the ability to represent numbers and perform math operations. When we represent numbers we use the digits the 10 symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. We then use a set of rules or an algorithm to express values larger the defined symbols we have. We simply start over at the beginning of the symbols and add a new symbol to the left.
Think of the number 9. When we want to add one more to this quantity we have run out of single symbols to express the new amount. So instead we call it 10. In this way we can think of numbers like an odometer on an old car. When ever the digits for one digit in the number makes a full revolution, the number in the next highest position moves to the next number. Life proceeds as normal and we just think of these symbols as the numbers them selves.
But for a computer to keep track of numbers, using 10 distinct symbols or states to represent a number is problematic. You see, in a general sense the computer is just an electrical circuit. A computer needs to represent numbers using only electricity. We could take a voltage and divide it into ten different regions and call each of them our numbers. But it turns out this is really hard and it is much easier, cheaper and faster to represent only two states, 1 and 0. But can we still count to all the numbers? Sure we can, now each wheel on our odometer will only have two numbers. So we start counting: 0, 1… what now? Well, we apply the same rules we are familiar with. The right most digit rolls around and a new digit is added to the left. Let’s see what happens when we count to 10 in decimal with our new number system.
- 0000 (0)
- 0001 (1)
- 0010 (2)
- 0011 (3)
- 0100 (4)
- 0101 (5)
- 0110 (6)
- 0111 (7)
- 1000 (8)
- 1001 (9)
- 1010 (10)
Well maybe these two digits will work out after all. No writing all of these zeros and ones can get pretty tiring, pretty quickly. There has got to be a way to write things in a more compact form. We could write the numbers as decimal again but then it takes some extra thinking to move things back to binary. What if we could represent each of the 16 patters for four binary numbers using a unique symbol? What would we call 1010? Computer scientists opted to call the number after 9 A. The numbers after A are B,C,D,E,F. Why? Well mostly just because but also because they were familiar symbols that we are used to seeing in ascending order.
Let’s look at the digits that are available in each number system side by side. All of these just give us a symbol to express a value using a set of rules.
The same basic operations we use in decimal can be extended to other number systems. Binary values also open up the possibility of something called Boolean Algebra. Boolean Algebra uses familiar words like AND, OR, NOT and gives them mathematical meaning. As computing evolved important math operations emerged and these were given new names like XOR (Exclusive OR) and NAND (NOT AND) . Lot’s of simple math operations could be chained together to form more complex things like memory and advanced math operations.
As the calculating power of computers grows, they are able to perform ever more complex calculations. Advances in computers also helped scientists and engineers find ways to represent more and more of the physical world as electrical signals. Special circuitry can represent electrical signals as numbers. Once information is in the form of a number the computer can do it’s lightning fast math operations to manipulate the data.
Besides being really fast at math, computers can also store information and execute different instructions based on the results of different calculations. A person programs the computer behave in different ways based on calculations they specify. The final piece of the equation that more circuitry can translate numbers into electrical signals.
With these pieces of translating events in the real world to numbers, memory, logical branching and transfer of numbers to the physical world, we start getting a fairly complex system. We can even do something like check for obstacles and move a wheel forward if no obstacles are found. Combine a lot of these feedback loops together and you get what we know today as a robot.
When we draw something we draw the shapes and colors we see. If we wanted to draw a scene from a different angle we would draw another picture. How does a computer draw something on the screen? Remember that the computer does not see the world the way we do. It only deals in numbers. So we have to represent the thing to be drawn in numbers. For example, we can use the xyz points on a Cartesian coordinate system.
With points in space we can give further information about which points are connected to one another, colors of regions and other properties like how reflective a surface is. A computer can combine all of this numeric information into a model that it can then use to simulate the behavior of light from different vantage points. This whole process may take millions or billions of calculations to produce the colors that represent a view in space. The computer can save a few calculations and thus time by doing quicker calculations that allow certain calculations to be skipped. For example, we do not need to determine the color for the back side of an object that is not visible.
The advantage of having this information in a model the computer can process is that the computer can repeat the same set of calculations from ANY vantage point in the 3D world. And even though millions and billions of things is a mind boggling amount, modern computers can do millions of calculations each SECOND.
We can go even further and use the computer to simulate physics equations, material behaviors and other complex phenomenon. I dabble in this industry my self, but Tony DeRose from Pixar does good job breaking down specific animation principles using math from Middle School and High School.
At the core of a computer we find math. If you wish to create new things in technology it will likely also involve math in some way. Simple math operations have been stacked up to form complex systems that can interact with the physical world and make choices based on those inputs. Computers also use math to simulate the physical objects and calculate how light and various forces would interact with that system over time. This only scratches the surface of the wide variety of things math and computers make available.
- Binary, Hexadecimal and Octal Number Systems, TI Basic Developer http://tibasicdev.wikidot.com/binandhex
- Hour of Code, code.org https://code.org/learn
- Pixar Animation in A Box, Khan Academy https://www.khanacademy.org/partner-content/pixar