Just a quick experiment in creating animated surfaces in Matplotlib. The distortions to the plane are sine waves applied in octaves with a random phase, : where is the amplitude (decreasing with increasing frequency) and is the frequency of the th wave. The animation is …
A quick project inspired by this tweet by @story645 referencing Jacques Bertin's Semiology of Graphics. The function plotted is the sum of a random selection of two-dimensional Gaussian functions, with filled and line contours indicated using Matplotlib's contourf and contour methods. They are animated by …
Classification problems are a broad class of machine learning applications devoted to assigning input data to a predefined category based on its features. If the boundary between the categories has a linear relationship to the input data, a simple logistic regression algorithm may do a …
This script demonstrates the relaxation of an ensemble of colliding particles towards the equilibrium, Maxwell-Boltzmann distribution of their speeds. Unlike this previous post, the collision detection and dynamics are handled using NumPy arrays without explicit python loops (except over collision pairs), which improves the performance …
Following on from this post about the simple double pendulum, (two bobs connected by light, rigid rods), this post animates the double compound pendulum (also called a double complex or physical pendulum): two rods connected to each other, with their mass distributed along their length. …
This code continues the previous blog post on two-dimensional collisions to model Brownian motion. The code is on my GitHub page. The core classes, PeriodicParticle and PeriodicSimulation are derived from the original Particle and Simulation classes to allow periodic boundary conditions: instead of bouncing off …
This small Python project is a physical simulation of two-dimensional physics. The animation is carried out using Matplotlib's FuncAnimation method and is implemented by the class Simulation. Each "particle" of the simulation is represented by an instance of the Particle class and depicted as a …
The population dynamics simulation known as Wa-Tor was described in a previous post. When carried out on a grid with periodic boundary conditions, the Wa-Tor "universe" is topologically equivalent to a torus, as depicted below using the code provided here.
An example in Chapter 7 of the scipython book describes the numerical solution of the two-dimensional heat equation for a flat plate with edges held at a fixed temperature. The code below extends this example by considering the solution of the heat equation on the …
As described in the previous blog post charged particle moving in crossed constant magnetic and electric fields exhibits a drift velocity, , perpendicular to both and . The particle's trajectory in this situation can be found analytically. For an arbitrary , some kind of numerical …