Place Value Method Simulation

written by Teresa Carrigan



Top

WHAT IS IT?

This model demonstrates the Place Value method of converting from another base to decimal. You may choose any base in the range of two to sixteen.

Top

HOW IT WORKS

The Place Value method first determines the powers by counting the digits starting with zero on the right. Next, the place value of each digit is determined. The place value is the base to the power determined in the first step. The third step is to multiply each digit by its place-value. The last step is to add all the products calculated in the third step. This gives us the decimal equivalent of an unsigned representation in another base.

Top

HOW TO USE IT

If you want examples from a specific base: Use the number-of-digits slider to set the number of digits that the counter can hold. Use the base slider to set the base. Now press the setup button. This will generate a random number with that many digits in that base (although it is possible to have leading zeroes).

If you do not care which base is used, click the random button to generate an arbitrary base, number-of-digits, and number.

The slow-motion slider is an easy way to adjust the speed of the display. Set it to zero if you want to show the final result as quickly as possible. 0.5 is a good setting for most purposes.

The step button demonstrates the next step of the place value method, and then stops so you can take notes. This is useful when you are first learning the method.

The go button does all remaining steps, at a speed determined by the slow-motion slider. This is useful when you do not need to take notes between each step, or do not wish to press the step button several times to get an answer. If you want to pause the demonstration, simply click the go button a second time and it will stop after it finishes the current step. You may then click go a third time to resume.

The quiz button will generate a random number using the base and number-of-digits sliders, and then ask you to convert it to decimal. If you want to drill conversion from binary, set the base to 2 and the number-of-digits to the maximum. If you want to drill conversion from hexadecimal, set the base to 16, and the number-of-digits to a small number unless you have a calculator and a lot of patience.

The show-again button starts the exact problem from the beginning. You may then click either the step button or the go button to see the same demonstration.

Top

THINGS TO NOTICE

When the base is 2 (binary) the digits are only 0 and 1. In this case, you don't really need the third step (multiplying); just add the place values for the digits that are 1, dropping the digits that are 0.

When the base is smaller than ten, the decimal equivalent will have at most the same number of digits as the original number, and usually it will have fewer digits. When the base is larger than ten, the decimal equivalent will have at least the same number of digits as the original number, and usually it will have more digits.

Top

THINGS TO TRY

Set slow-motion to 0.5, click random, and then click go.

Set the sliders to a problem type you want to drill, then click setup. Attempt one step at a time on paper, and then click the step button to check that you did that step correctly.

Top

EXTENDING THE MODEL

Modify the model to show fixed point representation; that is, specify a given number of digits to the right of the decimal place.

Allow the user to input a starting digit pattern.

Allow the user to input a decimal number, and then display the corresponding digit pattern.

Top

NETLOGO FEATURES

Extensive use is made of "patch-at" and "BREED-at".

It was awkward when it should be impossible to have more than one turtle at a given location to be required to say "random-one-of" in order to return a single turtle instead of an agent set.

Top

RELATED MODELS

Top

CREDITS AND REFERENCES

This model was written by Teresa W. Carrigan, 2004.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:

  1. this copyright notice is included.
  2. this model will not be redistributed for profit without permission from Teresa Carrigan.
Contact Teresa Carrigan for appropriate licenses for redistribution for profit.

To refer to this model in academic publications, please use: Carrigan, T. (2004). Place Value Method Simulation model. Blackburn College, Carlinville, IL.

In other publications, please use: Copyright 2004 by Teresa W. Carrigan. All rights reserved.

Top

FOR MORE INFORMATION

For more information converting from another number base to decimal, see one of these textbooks:
  1. Null, L. and Lobur, J. Essentials of Computer Organization and Architecture, First Edition, Jones & Bartlett, page 38.
  2. Dale, N. and Lewis, J. Computer Science Illuminated Second Edition, Jones and Bartlett, pages 35-39.


Home

Applets on this website were written by Teresa Carrigan in 2004, for use in computer science courses at Blackburn College, with the exception of the Fireworks applet. The applets made with NetLogo require Java 1.4.1 or higher to run. The applets made with NetBeans require Java 1.4.2 or higher to run. Applets might not run on Windows 95 or Mac OS 8 or 9. You may obtain the latest Java plugin from Sun's Java site.