This is an update to the post from February 2016 with an improved algorithm (given below) for generating pleasing random images by sequentially shifting the colour of pixels across a canvas. By using scipy.ndimage.convolve1d, one explicit Python loop can be dispensed with, speeding it up. …
Just a quick update on this blog post on visualizing the electric field of a multipole arrangement of electric charges to visualize the electric field of a capacitor (two oppositely-charged plates, separated by a distance ). The code, which uses Matplotlib's streamplot function to visualize …
A previous blog post provides a class, ColourSystem, which can be used to predict the colour (within some colour system) of a provided spectrum. This post uses the class to determine how to combine a number of light emitting diodes (LEDs), or other light sources …
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 …
Natural uranium consists largely of two isotopes, and . The less-abundant (0.72%) isotope, , is important for nuclear reactors and weapons because it is the only isotope existing in nature to any appreciable extent that can sustain a fission chain reaction (that is, it is …
The shape with the minimum surface-to-volume ratio is the sphere. The code below plots this ratio for a variety of shapes as a function of a characteristic length: Rectangular box of length with square cross section of area The minimum value of is realised for …
Langton's ant is a two-dimensional cellular automaton usually implemented on a square grid in which each cell has one of two states (white or black). The ant moves according to the simple rules: (1) on a white square turn 90° clockwise flip the square to …
The Morse oscillator code introduced in a previous blog post can be used to visualize the vibronic transitions in a diatomic molecule by creating two Morse objects (one for each electronic state) and plotting their potential energy curves and energy levels on the same Matplotlib …
More than 3000 nuclides (atomic species characterised by the number of neutrons and protons in their nuclei) are known, most of them radioactive with a half-life of less than an hour. About 250 or so of them are stable (not observed to decay using presently-available …