## INTRODUCTION

An interesting aspect of chaotic dynamics is that surprisingly simple systems can exhibit chaotic motion. In this project you will study an approximation of one such simple system, a metal pendulum swinging among magnets.

As an example, consider three magnets arranged in a small equilateral triangle around the rest point of the pendulum. After the pendulum is set swinging, it will steadily reduce the amplitude of its swing because of friction. Eventually, the pendulum will stop near one of the three magnets. If we always start the pendulum with zero velocity (just ``let it go''), its eventual stopping point will depend only on where the pendulum started. In this project, you will answer the following question. *Given the starting position of the pendulum, where will it stop?*

By answering this question for starting points that are very close together, you will see that the pendulum exhibits an essential feature of chaotic dynamics, sensitive dependence on initial conditions (SDOIC). The following three figures demonstrate this SDOIC; they each give an overhead view of the path of the swinging pendulum, with the positions of the magnets marked with diamonds. Each figure represents the same pendulum started at a slightly different point. Though the three starting positions differ by less than 0.1% (1/1000th), the pendulum stops at a different magnet each time!

## THE PROJECT

Write a Fortran program to answer the question posed above (Where will the pendulum stop?) for rectangular regions of starting points. For each starting point, the program should calculate the trajectory of the pendulum and what magnet the pendulum stops nearest. To calculate the trajectory, the program should make successive calls to a subroutine that calculates the movement of the pendulum in a tiny time step. You will be supplied with this subroutine.

The program will require the following information as input or `PARAMETER`'s.

- the size of the region of starting points
- the number of starting points to calculate in the region
- the number and positions of the magnets
- the size of a time step in the trajectory calculation
- the relative magnitudes of the frictional and gravitational forces
- stopping criteria for a swinging pendulum

The last item on the list implies an additional question that you will need to answer in order for your program to work effectively. *After you start the pendulum swinging, how do you know when it stops?* In order to calculate *where* the pendulum stops, you need to determine *when* it stops! The way you determine when it stops will define what inputs you need for stopping criteria.

The program should (at least) produce a table giving the ending magnet for each starting point. You will be able to use such a table to produce interesting images. For example, the following image shows the starting points that stop at one particular magnet. The triangle of magnets used in the above pendulum-trajectory images is also used here.

When the pendulum is started at one of the dark points, it stops at the rightmost magnet. When the pendulum is started at one of the light points, it stops at one of the other two magnets.

Notice the dark area around the rightmost magnet and the white areas around the other two magnets. This pattern should come as no surprise; a pendulum started very close to one of the magnets ends up at that magnet. The pattern further from the magnets may be a surprise, however. Notice the intricate structures. By using the program to zoom in on one of these complex regions, you will see even finer structure. Zoom in further and still finer structures will appear. What does this mean? *The image is a fractal!*

### How embarassing!

For each point in the fractal image above, even the white ones, a computer had to calculate a complete trajectory of the pendulum. Each trajectory took about 300 time steps, and each time step took about 200 arithmetic operations. That's 60,000 operations for each point. The image is 512 by 512 points, so it required around 16 billion arithmetic operations!

Notice, however, that each point on the image is a completely independent calculation; to calculate a particular point, you don't need to know anything about any other points. This means that different computers can be calculating different parts of the image at the same time, or one large *parallel* computer can be calculating different parts of the image on many different processors. This *parallel execution* can dramatically decrease the time it takes to calculate the image. Again, the essential fact allowing this efficient parallel execution is that each point represents a *completely independent* calculation. This kind of system, where there are many different independent pieces, is called *embarassingly parallel* because it is trivial to split the system up into parallel pieces. You will be able to take advantage of this ``embarassment'' by using one (or more) of the parallel computers at OSC to do your calculations. After producing a running program for execution on a single processor, you can make the necessary modifications to run on (at least) one of the parallel machines. As part of the project, you may want to run on a few of the parallel machines to compare performance.

### Creating Animations

There are many ways for you to create interesting animations. Here are some possibilities, all based on a series of ``ending magnet'' images like the one above.

- Generate a series of ``closest magnet'' images at various times. Each image will represent a certain time; the color of each point will represent the magnet
*at that time*that is closest to the pendulum when it is started*at that point*. The first image will be a very simple pattern of three uniform regions. Because the pendulum is*at*the starting point at this time, the closest magnet to the pendulum is just the magnet closest to the starting point! The last image, however, will look similar to the one shown above. The animation will show the progression from the starting points to this fractal pattern. (This type of animation is used in the project introductions.) - Zoom in on a particular region of the ``ending magnet'' image. By generating greater and greater magnifications, the fractal nature of the image will become apparent.
- Generate a series of ``ending magnet'' images with slowly varying gravitational or frictional force. This will show how the structure of the pattern depends on the magnitudes of these forces.

You are not required to choose one of these ideas for your animation. Feel free to try your own ideas!

## ANIMATIONS

**SI1998**

## REFERENCE

**Chaos and fractals: new frontiers of science.** Heinz-Otto Peitgen, Hartmut Juergens, Dietmar Saupe. Springer-Verlag, New York, 1992. *See Chapter 12.8.*

*Trey White is the OSC coordinator for the Chaos project. Trey's office is in 420-7. Please contact Trey to set up appointment(s) for consultation.*

For assistance, write si-contact@osc.edu or call 614-292-0890.