For the purposes of this article, the harmonically-driven pendulum is one whose anchor point moves in time according to . 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 …
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 suspended from a fixed anchor by a massless spring. As before, the code places frames of the …
In classical mechanics, a double pendulum is a pendulum attached to the end of another pendulum. Its equations of motion are often written using the Lagrangian formulation of mechanics and solved numerically, which is the approach taken here. The dynamics of the double pendulum are …
A very simple diffusion simulation can be constructed in two dimensions by following the positions of a number of "particles" which all start off at the centre of a grid of cells. Time is assumed to progress in a series of "ticks": at each tick, …
The previous post provided some code for generating Poisson disc noise (in which no point the sample is closer than some fixed distance from any other). Here is a short program to calculate the power spectrum of this noise and compare it with the spectrum …
A set of points drawn from a uniform distribution on a two-dimensional domain typically display clustering: For computer graphics applications, it is often useful to obtain a sample of random points such that no one point is closer than some pre-determined distance from any other …
The Depth-first search algorithm is a simple approach to generating a maze. It is well described and illustrated in lots of places on the internet, so only an outline is given here. The maze is considered to consist of a grid of cells; each cell …
The Digital Object Identifier (DOI) resolution service at doi.org exposes an API for retrieving the BibTeX markup for a reference given its DOI. The following Python 3 script takes a DOI on the command line and returns the BibTeX. For example, The code is below. …
The Brachistochrone problem asks the question "what is the shape of the curve down which a bead sliding from rest and accelerated by gravity will slip, without friction, from one fixed point, to another in the least time?" Its solution is well-known and given in …
The Guardian is one of several newspapers which publish a daily "word wheel" puzzle: eight letters are arranged in a circle around a central letter and the goal is to make as many words as possible including the central letter and using each letter once. …