A linear transformation in two dimensions can be visualized through its effect on the two orthonormal basis vectors and . In general, it can be represented by a matrix, , which acts on a vector to map it from a vector space spanned by one …
A previous blog post dealt with packing circles into a circle. To fill an arbitrary shape, a slightly different approach is needed. The code is presented in my github repo. A black-and-white PNG image should provided (the black areas to be filled). The ShapeFill class …
The following code attempts to pack a predefined number of smaller circles (of random radii between two given limits) into a larger one. The algorithm simply selects a random set of radii, sorts them into decreasing order (so the larger circles get placed first), and …
SVG may not be the most obvious choice for depicting a 3-D object, but with some care over the perspective and ordering of the plotted points, it can be done. The code is below and relies on a single import for the colour scheme, palettes.py, …
The following code plots a two-dimensional object and its bounding box for several rotations about an arbitrary point. Three types of bounding box are considered: (1) the original bounding box, rotated by the same amount as the object, (2) the bounding box to that bounding …
A Moiré pattern is an interference pattern that occurs when two grids of repeating lines or shapes are rotated by a small amount relative to one another (oblig. xkcd). A recent application concerned the experimental verification of Hofstadter's butterfly: Douglas Hofstadter (he of Gödel, Escher, …
A Reuleaux polygon is a curvilinear polygon built up of circular arcs. For an odd number of vertices, it has a constant width, and for this reason many polygonal coins, such as the UK's 50p piece and this Bermudian dollar coin are Reuleaux polygons. This …
The previous blog post described the normal modes of a chain swinging under its own weight. Here we describe the motion of a chain after an arbitrary displacement as a linear combination of such normal modes. The code for this project is on my github …
The description of the oscillations of a hanging chain was a problem in mechanics solved by Daniel Bernoulli in the 18th century and which led to the discovery of the class of functions known as Bessel functions. The code for this article is hosted on …
A recent tweet by Fermat's Library noted that the Fundamental theorem of arithmetic provides a novel (if inefficient) way of determining whether two words are anagrams of one another. The Fundamental theorem of arithmetic states that every integer greater than 1 is either a prime …