# Modeling Motion Python Examples

This page serves as an index to the program code referred to in the computer science section of Modeling Motion. I will post individual programs and saved scripts of interactive sessions from the lectures.

# Winter Quarter

# Spring Quarter

## Week 1

- driver.py A driver oscillator for the week 1 lab on resonanace.
- ca1d.py and ca.py - A 1-dimensional cellular automaton.

## Week 2

- mass/spring examples - A system of masses and springs for the week 2 lab on mass-spring systems.
- predprey.py - The predator prey model from Callahan chapter 8.
- predpreyvec.py - A vector field graph of the predator prey system
- pendulum.py - A phase portrait of the undamped pendulum system.
- lorenz.py - The time and phase portraits of the famous Lorenz system showing it chaotic attractor.
- sensitivity.py - A time series plot of one variable,
*x*, in the Lorenz system plotted twice with slightly different initial conditions showing how sensitive a chaotic system is to initial conditions. - life.py - John Conway's famous 2-D CA called "The Game of Life".

## Week 3

## Week 4

- decoder.py and digital.py - Starting point for week 4 computing lab on digital logic.

## Week 5

- processor files - files needed to run the MM1 processor simulator. Run "simulator.py" with the correct "*.mm1" file substituted in the definition of the
`program_file`

variable. - surface.py - A program for visualizing functions of 2 variables by drawing a wireframe mesh.

## Week 6

- Tkinter GUI examples - My examples plus links to documentation and other examples.

## Week 7

- sinewave.py - Staring point for assignment due week 7.
- taylor - several versions of a program plotting taylor polynomial approximations to the sine function. taylor3.py responds to the arrow keys.
- tree - several versions of a recursive tree drawing program with some GUI controls.

## Week 8

- power.py, and power2.py - POWER program from Callahan and a slightly modified one to graph both the function and its power spectrum.
- detector.py, and detector2.py - DETECTOR program from Callahan and modified version.
- powerspectrum.py - The program developed in class.
- signals.py, testsignals.py - A set of classes for signal processing and a test program for exercising them.
- bouncetk.py - The bouncing red ball with a slider added to control gravity—an example similar to the take home test question (hint,hint).

## Week 9

- square.py,triangle.py, signals.py - Two examples summing up Fourier
series to get non-sinusoidal periodic signals and the
`signals.py`module they import.