Animation techniques

The IPython Notebook is here.

1. Moving frame for 2d plotting

(Warning) If you run the following code in the notebook, the interrupt key Ctrl-C doesn't work. To stop the run, you should restart kernel, which is included in the "Kernel" menu. (停止には、jupyterのメニュー"Kernel"にある"Restart"を選択)

To avoid this inconvenience, you are recommended to edit a "py" file containing the below code and run it in the ipython console. To do this, an development environment such as spyder is a good choice.

Principal idea for ploting a moving frame:

The width of plot is defined by "width_plot" and the width of shifting the frame per a plotting step is given by "with_ode". (lines 24,25)

2. animation functions of matplotlib

By using animation function of matplotlib, you can save the animationtion to mpeg4 and moving gif file.

(a) a sample from web page

https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/

(b) two traces with initial values which have a tiny amount of difference

The following is an application where two trajectories which have a tiny different initial condition. You can see the difference rapidly grows.

The trajectories are updated infinitely until it's interrupted, while in the above program, trajectories are calculated initially 5000 steps and then plotted in a definite interval as the interval is shifted.

If you run jupyter on your local host, try to run the below code after uncommenting the bottom line "plt.show". Otherwise, you can try to view inline mpeg4 animation by using mpeg encoder "ffmpeg" installed in the host of jupyter.

If you would like to view this animation in line, try the below code. To run this, you have to have installed ffmpeg.