Book Cover

Introduction to Scientific Programming
Computational Problem Solving Using:
Maple and C
Mathematica and C

Author:
Joseph L. Zachary
Online Resources:
Maple/C Version
Mathematica/C Version

Block Stacker Tutorial

In this tutorial we will explore the block-stacking problem that is discussed in Chapter 4. The tutorial will help you understand the concept of center of gravity as it applies to block stacking, and it will help you understand the counter-intuitive fact that the stack of blocks can be made to extend arbitrarily far beyond the edge of the table.


Simulation

We will be using a simulation of the block-stacking problem throughout this tutorial. You can start it by clicking on the following button.

A Java applet should appear here

The simulation begins by displaying a table with no blocks on it. The length of the table in pixels is also displayed. (A pixel is a convenient unit of measurement when using a computer display. Your computer's display is made up of thousands of tiny dots, or pixels, of color.) By using the mouse to drag the table, you can resize it. Before continuing with the tutorial, resize the table so that its length is a nice round number such as 200, 300, or 400 pixels. While you are at it, resize the simulation window so that it is at least two-and-a-half times as wide as the table is long.

The simulation allows you to stack blocks on the table. You can add and remove blocks by using the Blocks menu at the top of the simulation window. Use it now to experiment with adding and removing blocks. When you are through experimenting, use the Reset entry in the File menu to remove all of the blocks. Then add one block to the table.

You can use the mouse to drag the block back and forth. For example, try dragging the block to the right. As you do, you will notice:

Now add two more blocks to the table, and experiment with dragging the three blocks back and forth. You will notice:


Balance

As you move blocks back and forth, their colors change between green and red. Let's explore why this happens. Clicking this button

will position one block so that exactly half of it is supported by the table. The extension of the block will be half the length of the block (which is the same as the length of the table). This means that the center of gravity of the block is exactly at the edge of the table, so the block is balanced. Since it is balanced, it is displayed in green.

Now use the mouse to move the block one pixel to the right. This results in the center of gravity of the block being just beyond the edge of the table. Since it is no longer balanced, it is displayed in red. If you move the block back one pixel, it will once again be green.

What happens when there is more than one block? Clicking this button

will arrange two blocks on the table. The bottom block is extended by one-third of its length beyond the table's edge, and the top block is extended by one-third of its length beyond the bottom block's edge. As a result, the total overhang is equal to two-thirds of the length of the table.

Notice that both blocks are green, which means that both are balanced. If you drag the top block one pixel to the right, however, the bottom block will turn red. When a block turns red, it means that the block and all of the blocks above it, considered as a unit, have become unbalanced.

If you continue dragging the top block to the right, it too will turn red when more than half of its length extends beyond the block below it.

In summary, if a stack contains only green blocks, then it is balanced. If it contains any red blocks, it is unbalanced. The location of the red blocks give you information about what is causing the imbalance.


Exercises

  1. Reset the simulation and place ten blocks on the table. See how large an extension you can obtain without unbalancing the stack. Don't look at the next exercise until you've worked on this exercise for a while.

  2. Reset the simulation and place ten blocks on the table. Move the top block to the right until it turns red, and then move it slowly back slowly to the exact point at which it turns green. Repeat this with the other blocks moving from the top to the bottom. If you follow these directions precisely, you will have achieved the maximum extension possible with ten blocks.

  3. Compute the exact ratio between the block extension and the block length for the top block, then for the next block, and so on. You should obtain a series of ten fractions.

  4. The series that you obtained in the previous exercise should be approximately
    1/2, 1/4, 1/6, 1/8, 1/10, 1/12, 1/14, 1/16, 1/18, 1/20
    Why does your series not exactly equal this one?


Last modified 24Sep96.