Successive Division Method Simulation

written by Teresa Carrigan



Top

WHAT IS IT?

This model demonstrates the successive division method of converting a positive integer from decimal to another base, which is also known as the division-remainder method. You may choose any base in the range of two to sixteen.

Top

HOW IT WORKS

First the model generates a random decimal number to convert to the specified base. The next step is to divide the decimal number by the base. The remainder becomes the right-most digit of the answer. Step three divides the quotient, again storing the remainder, even if it is zero. This process continues until the quotient is zero. The equivalent in the other base will have the same digits as the remainders, with the last remainder being the left-most digit. If the base is larger than 10, then some remainders will be larger than nine; they will have to be converted to their equivalent single digit character.

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 for the decimal number. Use the base slider to set the base. Now press the setup button. This will generate a random number with that many decimal digits. If you are converting to base 2, you will not be allowed to have five decimal digits because then the result has too many bits.

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.25 is a good setting for most purposes.

The step button does a single division, and copies the remainder to the display at the bottom. It then stops so you can take notes. This is useful when you are first learning the method.

The go button continues dividing until the quotient is zero, at a speed determined by the slow-motion slider. This is useful when you do not need to take notes between each step.

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.

The quiz button will generate a random number using the number-of-digits slider, and ask you to convert it to the base on the base slider. If you want to drill conversion to hexadecimal, set the base to 16 and the number-of-digits to a small number.

Top

THINGS TO NOTICE

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

Successive division is Horner's method in reverse.

Top

THINGS TO TRY

Set slow-motion to 0.25, 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 decimal number, and then display the corresponding digit pattern.

Top

NETLOGO FEATURES

"ask max-one-of stack with [stack-name = "done" ] [ xcor]" was very useful in finding the right-most turtle of breed stack. The stack-name was used to indicate the state of the turtle.

"set heading towardsxy-nowrap to-x to-y" was used to guide the remainder to the correct place in the stack at the bottom.

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). Successive Division 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 about successive division, see one of these textbooks:
  1. Null, L. and Lobur, J. Essentials of Computer Organization and Architecture, First Edition, Jones and Bartlett, pages 39-41.
  2. Dale, N. and Lewis, J. Computer Science Illuminated, Second Edition, Jones and Bartlett, pages 42-43.


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.