Let's make a movie!

Why a movie?

A picture is worth a thousand words! A movie could do even better. Non-linear dynamics relies on images to understand the organizing features in the complicated solutions that emerge from typically simple non-linear systems. This section is to study the Duffing Oscillator via a poor man movie technique.

Making a movie

The production of a movie requires a word of explanation. The idea is to produce a set of data files and to require Gnuplot to plot these individual data sets in the appropriate sequence to form frames for the movie. The following provides a skeleton structure to start from.

This example illustrates a Gaussian curve of varying width. The code gaussian.c calculates the Gaussian curve with a width specified on the command line.

The code Lcode.c organizes the calculation of Gaussian curves of various widths and the plotting of the data via gnuplot. It does so by building commands in strings and submitting these command to the operating system via the C function system(command).

The code Lcode.c runs a loop over k (width of the Gaussian). For each k values, Lcode.c instruct the Linux OS to

 

Duffing Oscillator

Movie of the Duffing Strange Attractor

The Duffing Oscillator strange attractors (one or two well regimes) are generated by a stroboscopic map projection of any single orbit originating from within its basin of attraction. Once past some transient time period the trajectory converges to a neighborhood region of a trajectory which generates the strange attractor by projection.

An interesting aspect of the generation of the strange attractor is that it is generated all at once so to speak. Namely the attractor is built by adding dots to it that fall everywhere on the attractor seemingly at random. The attractor is therefore refined all at once.

This build-up of the strange attractor is best illustrated by a movie.

Exercise I

Modify the code Lcode.c and gnuplotinput data file from the previous section to make this movie. Careful - download the files in a new directory not to clobber the previous files. You will also need the duffing_RK4.c and stroboscopic.c codes to produce the movie. Use the two-well chaotic solution, i.e., $\alpha=1$, $\beta=-1$, $\mu=0.25$, and $A=0.4$ . Build the images of the chaotic attractor using 200 dots to 20,000 dots by increment of 200 dots. Hint: The time is in unit of $T$.

  

Dynamical study

Finding the bifurcation digram of a non-linear model is not easy. The movie tool might help...

Exercise II

The Chaotic Attractor revisited

The stroboscopic projection of the Duffing Oscillator in the chaotic regime generates an image of the chaotic attractor. This attractor is produced via a capture of the position in phase space, $x(t)$ and $v(t)$, at time values $t_n = n T$ where $T = 2 \pi / \omega$ is the period of the driving term and $n$ an integer.

Projections at times in between full periods produce images of the chaotic attractor that look different but carry the same information about the solution.

Exercise III

  1. Modify the stroboscopic.c code to extract the chaotic attractor at times $t_n = n T$, $t_n = ( n + 1/4) T$, $t_n = ( n + 1/2 ) T$, and $t_n = ( n + 3/4 ) T$.

  2. Plot the chaotic attractor images by piping the results of the Duffing code ( two-well chaotic solution, i.e., $\alpha=1$, $\beta=-1$, $\mu=0.25$, and $A=0.4$ ) for a very long single trajectory ( 16,000 $T$ via the option -t 16000 ) into stroboscopic.c. Remove the results for a transient time of 1,000 $T$.

  3. Make a movie of the chaotic attractor consisting of 128 images of the stroboscopicly projected trajectory at $t_n = ( n + \alpha ) T$ where $\alpha$ is 128 equally spaced values in [ 0.0 , 1.0 ].

Building the Duffing Strange Attractor in a movie

We now want to build the Duffing Strange Attractor in a movie in front of your own eyes. We want to do so by launching 10,000 trajectories from an arbitrary small square with a 100x100 grid of initial conditions, as we did previously in the subsection ``Strange Attractor'' in the two well model, and following strobostically the evolution of each trajectory. This can be done using only BASH scripts and GNUPLOT.

  1. Create a subdirectory named frames

  2. Write a BASH script to solve the Duffing Oscillator for the initial conditions above and for a total time 0T, 1T, 2T, ... The data should be stored in files in the subdirectory frames. Use lexical file names.

  3. Download and run script_movie,

Enjoy the movies!



Michel Vallieres 2011-02-24