# Math 481/581, Assignment 4 (Draft 5)

This assignment and assignment 3 together constitute Project 2.

## Purpose

To integrate systems of first order differential equations using a built-in ODE solver of Octave or MATLAB. To plot time series and phase diagrams and draw conclusions from these plots concerning equilibrium states, periodic solutions and chaotic behavior.

## Details

### Predator-prey population model

In class we investigated the pair of coupled logistic equations. The relevant files are:

Investigate the question whether the populations always go to an equilibrium, or perhaps whether they can oscillate. You are allowed to change the constants in the model.

### Forced pendulum with friction

In class we investicated the forced pendulum with friction, where the forcing is periodic:

It was suggested in class that by weakenning the damping term and choosing the forcing term suitable, and possibly changing the length of the pendulum one can achieve chaotic motion.

For other values of the parameters you may observe simple periodic motion following a transient phase during which the pendulum settles on its asymptotic behavior.

### Stabilizing inverted pendulum

As you know, it is possible to balance a long pole on the top of your head. You can also try to balance a pencil on a tip of your finger. If you ever tried, you know that the shorter the object, the harder the task. Does stabilizing a pole or a pencil require "intelligence"? In other words, is it necessary to react to the falling pole by some, perhaps complex, feedback mechanism?

Let us consider the following model:

This figure was created with XFig. You can obtain the source here: inverted_pendulum.fig.

Assume gravity constant g=9.8 meters / sec2. Also, assume that the mass is m=1 kg. Thus, the remaining parameters are specified using the metric system (lengths in meters, time in seconds, frequency in Hertz=1/sec).

• The length of the stick: l.
• The length of the bar connecting the moving flywheel to the base of the inverted pendulum: d.
• The radius of the flywheel: r
• The frequency of the uniform circular motion of the flywheel: f.
For simplicity, assume that there is no damping.
• Derive the differential equation satisfied by the angle formed by the inverted pendulum with the vertical direction
• Write an Octave or Matlab scripts which allow you to integrate the equations of motion.
• Write an Octave/MATLAB function named is_stable which for given parameters (l, d, r, f) will return 0 or 1, depending on whether the motion of the inverted pendulum is stabilized in the nearly-vertical position or not.

## MATLAB commands for this assignment

If you are working with MATLAB, you will not find the command lsode. I provided two files which illustrate the use of the command ode45 in MATLAB which illustrate the use of ode45:

## Maxima calculation of the second derivative

The file script.maxima provides the code which computes the second derivative of the position of the base

## More useful tricks

• test.m gives sample usage of several functions for testing values of vectors
• stick.m and xypos.m show how to generate one frame of the animation of the inverted pendulum shown in class
• expression_formats_session.txt shows a Maxima session used to convert expressions to useful formats.

## A paper

Write a paper (say, 5-7 pages) discussing your findings. Try to find similar research on the Web.

Your paper should include the plots of interesting solutions of the models. Make sure to include all files you used in the solution in your submission. Also, include all relevant references to external documents (textbooks, papers, Web pages) in BibTeX format.

## What to turn in?

The zip archive hw4.zip should be submitted by clicking here or using WebDAV.

Marek Rychlik <rychlik@u.arizona.edu>