### Archive

Posts Tagged ‘Mentor’

# Introduction

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.

# Number Systems

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.

# Robots

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.

# Computer Animation

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.

# Conclusion

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.

# References

Categories: Math Tags: , ,

## Castles in the Desert: Games of Chance and Math

Introduction

Casinos represent a mind boggling concentration of resources. It is not uncommon for casinos to be vast structures with hundreds of employees, restaurants, shopping , hotels, lavish finishes, advanced technology and extensive areas for gambling activities. All of these things are concentrated in the most unlikely of places, in a desert landscape where the blazing sun is plentiful and water is sparse. Under normal circumstances populations grow around areas high in resources like places where food can grow easily or that have access to large bodies of water. The casino hubs though, especially those in arid places like Nevada, grew because the business of gambling is extremely lucrative. The business is so lucrative that these companies can even build modern day castles in the desert.

The House Always Wins

The first thing to consider when looking at the math of gambling is the idea that the house always wins. The house, or the establishment that hosts the gambling activities, does not win every bet. There are times where individuals win both small and large sums of money. What we mean by the house always wins is that in the long term, over many, many betting transactions, the house is mathematically destined to win. For each winner there are many more losers. If the house always wins in the long run, you might ask: How often does the house win and by how much?

We’ll use a few concepts from an area of math called probability to gain an idea on how to answer that question. We’ll just scratch the surface, but it will give you an idea on how to learn more.

Basic Concepts

• Randomness
• Things happen without an order or predictable pattern
•  Experiment
• An experiment is when we do a random act to get an outcome. So we might roll a dice to see which number appears.
• Event
• The result of an experiment. In the dice rolling example we might roll a three.
• Sample Space
• All of the possible outcomes or events. A cube shaped dice has six possible outcomes.
• Probability
• The chance something will happen. Usually expressed as a fraction. The probability of all events in a sample space adds up to 1. I have a one in six chance that a three will be rolled on a dice
• Independent Events
• Events are independent if they do not influence one another. Each time I roll a dice it does not matter what has been rolled before.
• Dependent Events
• Events are dependent if they influence one another. If I draw a card and do not replace it in the deck, then I can’t draw that card again. Specifically, if I had 10 cards and removed one, the next time I drew a card there would only be nine cards to choose from.

One Dice

Let’s think about one dice. How many ways are there to roll the dice? A cube has 6 sides so there are six ways to roll one dice.

Two Dice

What about if we roll two dice? Well there are 6 ways to roll the first dice and six ways to roll the second. The first conceptual challenge here is how do we count the events in the sample space? It is always easier to use real numbers so let’s consider that we roll 1 on the first dice. How many ways can the second dice be rolled? (6) We can repeat the thought experiment by rolling a 2 first, then a three first etc. We get something that looks like 6+6+6+6+6+6 or 6*6. We can also visualize this by organizing the outcomes in a table.

We can go further and look at how many times each sum appears in the table. We can use this information to determine the probability for each sum. For example a sum of two can be formed exactly one way (by rolling two ones) in all 36 combinations. Therefore the probability of the dice adding up to 2 is 1/36. The full distribution looks like this:

Craps

Craps is a gambling game where participants place bets on the results of rolling two dice. The rules of the game are as follows:

• The player (known as the shooter) rolls a pair of fair dice
• If the sum is 7 or 11 on the first throw, the shooter wins; this event is called a natural.
• If the sum is 2, 3, or 12 on the first throw, the shooter loses; this event is called craps.
• If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, this number becomes the shooter’s point. The shooter continues rolling the dice until either she rolls the point again (in which case she wins) or rolls a 7 (in which case she loses).

Consider the case of winning on the first throw. There are 6 ways to roll a seven and two ways to roll an eleven. This means there are eight ways out of 36 to have a winning outcome.  We can pair this information with two related bets on this outcome

The seven bet pays out 4:1. So if a dollar is bet, the player nets \$4 otherwise he loses his dollar. The gambler will win one in six tries in the long run or 16.7% of the time. So if the gambler places 1,000 one dollar bets he will win back \$668  (167 * \$4). However he will lose \$833 (833 * \$1) This means over the long run he walks out \$165 poorer.

The eleven bet pays out 15:1. So if a dollar is bet,  the player nets \$15 otherwise he loses his dollar. Similar to the 7 bet calculation , the player has a 5.6% chance of an 11 bet succeeding. If he places 1,000 one dollar bets, he will win back \$840 (56 * \$15) and lose \$944 (944 * \$1). The means over the long run he walks out \$104 poorer.

In both of the previous cases the house was the long term winner. Even though the player may feel like they are winning at some points in time, over many betting cycles the house amasses a large influx of cash. The house’s winnings  are always net positive in the long run and the player’s are always net negative.

We can use the simulator in the references below to gather the long term results of all craps bet types  for our 1,000 one dollar bet scenario. Any way you go you will walk out poorer over the long run.

Further analysis can be done on other games of chance. The outcomes are similar with the house winning in all scenarios over the long run. Some games like Black Jack provide the house a smaller edge allowing for skilled players to reap rewards. One can even observe the flow of the game and use probability to make large bets when the hands left in the deck are in the player’s favor. This is a method called card counting. This can be multiplied by having multiple players gathering information on the deck. However this practice, known as team play, is prohibited and casinos will quickly escort out or take action against players found doing it.

Just such a scenario went down when a group of MIT students devised a plan to do team play against single deck Black Jack and reap huge winnings. Their exploits are detailed in the book “Bringing Down the House”. Casinos quickly caught on to their tactics and black listed them from playing. Outside of the US the young students faced threats of physical violence when they tried to employ their tactics.

While one could argue that individuals who counted solo without the help of a team were just being good players and mastering the game, the casinos were not in the business of losing money. They quickly adjusted their games of chance to include multiple decks. This nullified the counting advantages that single decks offered. Building castles in the desert is an expensive venture and the house is going to do everything in their power to ensure that they keep winning in the long run.

So the next time you see a grand structure where there would normally not be one, think a little about why resources are concentrating there. Math is a tool that can help you solve this riddle.

Handouts

• All Possible Outcomes of Rolling Two Dice
• Probability Distribution of Rolling Two Dice

References

Videos

Categories: Math Tags: , ,

## Service Project

The Hitchhiker’s Guide to Games mentor course includes a service project element.

Our Act of Service will center around the technology theme that we established during our reading and projects. Often the same set of technology can be used to either advance or undermine mankind. As the technologists of tomorrow, it is our privilege and responsibility to ensure that technology is used to help humanity. With this concept in mind, please select acts of service that “use technology to improve and uplift those around you”

Here are a few ways that technology can improve the lives of others. Please do not feel limited to these specific examples. Use these ideas as a launch pad to greatness!

Preserving the Past

• Help someone scan and catalog all of their old family photos
• Help someone convert old home movies into a digital format
• Record the life stories of a grandparent or an elderly person. Prepare a transcript of the recording and share their story with your friends and family
• Put together a photo slide show set to music for a special event

Connecting People

• Help an elderly person have a video call with their friends or family.
• With appropriate approvals, create a website for a school, church or community group.
• Use the internet and other resources to research about your ancestors and genealogy.
• Help index historical documents such as tomb stones, census data and ship records.

Improving Lives

• Use technology in a creative way to teach something to others
• Work with your family to create a family budget. Track your progress using spread sheets and other technology.