Blog

A blog of Python-related topics and code.

Cobweb plots

A cobweb plot is often used to visulaize the behaviour of an iterated function. That is, the sequence of values obtained from setting $x_{n+1} = f(x_n)$, starting at some value $x_0$.

Evolution of a free particle

This post is based on Problem 2.22 from Griffiths, Introduction to Quantum Mechanics (Prentice Hall, 1995).

Simulating the Belousov-Zhabotinsky reaction

The Belousov-Zhabotinsky (BZ) reaction is a classical example of a non-equibrium chemical oscillator in which the components exhibit periodic changes in concentration.

The harmonically-driven pendulum

For the purposes of this article, the harmonically-driven pendulum is one whose anchor point moves in time according to $x_0(t) = A\cos\omega t$. As with previous posts, the position of the pendulum bob with time can be described using Lagrangian mechanics. In a coordinate system with the pendulum anchor initially at $(0,0)$ and the $y$-axis pointing up, the components of the bob position and velocity as a function of time are:

The spring pendulum

Following on from the previous post on the double pendulum, here is a similar Python script for plotting the behaviour of the "spring pendulum": a bob of mass $m$ suspended from a fixed anchor by a massless spring.