## Place Value Method Simulation

## written by Teresa Carrigan

- What is it?
- How it works
- How to use it
- Things to notice
- Things to try
- Extending the model
- NetLogo features
- Related models
- Credits and References
- For more information
- Download the model

## 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.

## 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.

## HOW TO USE IT

If you want examples from a specific base: Use thenumber-of-digitsslider to set the number of digits that the counter can hold. Use thebaseslider to set the base. Now press thesetupbutton. 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

randombutton to generate an arbitrary base, number-of-digits, and number.The

slow-motionslider 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

stepbutton 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

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

quizbutton will generate a random number using the base andnumber-of-digitssliders, 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-againbutton starts the exact problem from the beginning. You may then click either thestepbutton or thegobutton to see the same demonstration.

## 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.

## 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.

## 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.

## 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.

## RELATED MODELS

## 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:

Contact Teresa Carrigan for appropriate licenses for redistribution for profit.

- this copyright notice is included.
- this model will not be redistributed for profit without permission from Teresa Carrigan.
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.

## FOR MORE INFORMATION

For more information converting from another number base to decimal, see one of these textbooks:

- Null, L. and Lobur, J.
Essentials of Computer Organization and Architecture, First Edition, Jones & Bartlett, page 38.- Dale, N. and Lewis, J.
Computer Science IlluminatedSecond Edition, Jones and Bartlett, pages 35-39.

HomeApplets 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.