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

# Rod Stacking Tutorial

In this tutorial we will explore the rod stacking problem that is discussed in Chapter 13. The tutorial will help you understand the mathematics behind the model for the three-rod problem that is developed in the text.

## Simulation

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

A Java applet should appear here

The simulation displays eight rods that are arranged roughly as in Figure 13.1 of the text. The center coodinates of the three bottom rods are known, as are the radii of all eight rods. The problem that is studied in Chapter 13 is to determine the center coordinates of the remaining five rods.

If you click the mouse inside on of the supported rods, several things will happen.

• The rod that you clicked will turn orange.

• The two supporting rods will turn violet.

• A close-up view of the three highlighted rods will appear on the right side of the simulation. The radius of each rod will be displayed, as will the center coordinates of the two supporting rods.
If you put the mouse inside of a supported rod and then drag it, that rod will be resized. This allows you to rearrange the rod stack (within limits).

The close-up view that appears in the right panel of the simulation will be similar to Figure 13.3 from the text. We will refer to the two violet rods as the "left" and "right" rods, and we will refer to the orange rod as the "top" rod. For example, X_left, Y_left, and R_left are the x-coordinate, y-coordinate, and radius of the left rod.

As in Figure 13.3, we will refer to the five lines as a, b, c, d, and e as follows:

• a is the line from the left rod to the top rod.

• b is the line from the right rod to the top rod.

• c is the line from the left rod to the right rod.

• d is the horizontal leg of the right triangle.

• e is the vertical leg of the right triangle.

Recall from the text that the lengths of these lines can be determined as follows:

• a = R_left + R_top

• b = R_right + R_top

• c = sqrt((X_right - X_left)^2 + (Y_right - Y_left)^2)

• d = X_right - X_left

• e = Y_right - Y_left

Two angles meet at the center of the left rod. The top one is alpha, and the bottom one is beta. Recall that

• cos(beta) = d/c

• sin(beta) = e/c

• cos(alpha) = (a^2 + c^2 - b^2) / 2ac

• sin(alpha) = sqrt(1 - cos(alpha)^2)
From a, b, c, d, e, cos(beta), sin(beta), cos(alpha), and sin(alpha) it is possible to calculate the center coordinates of the supported rod.

Experiment with the simulation. For particular three-rod configurations, try to calculate the values of a, b, c, d, e, cos(beta), sin(beta), cos(alpha), and sin(alpha) using Maple or a calculator. You can check your answers by choosing the "Show Answers" option under the "Window" menu.