The New York Times publishes a daily puzzle, Spelling Bee, in which players must find as many words as possible using seven letters arranged in a hexagon. Each letter may be used any number of times but the solution words must be at least four …
The Weierstrass function, named after the German mathematician Karl Weierstrass (1815 – 1897) is a real-valued function that is continuous everywhere but nowhere differentiable. It is usually expressed as a Fourier series: where and is a positive, odd integer satisfying . The code below plots …
The Digital Technology Group (DTG) at Cambridge University has been recording the weather from the roof of their building since 1995. The complete data are available to download in CSV format from the DTG website as the file weather-raw.csv. The script below visualizes these data …
A recent article, Narushin et al., "Egg and math: introducing a universal formula for egg shape", Ann. N.Y. Acad. Sci. 1505, 169 (2021) introduces a "universal" formula for the shape of eggs, including "pyriform" (pear-shaped) eggs such as those of the guillemot – supposedly, such …
Kaczmarz's algorithm is an iterative algorithm for solving a system of linear equations. In its simplest form, the equations are written in matrix form, and, starting with the initial guess for the solution, , the zero vector, successive approximations are generated by projecting onto the …
This is just a simple script that takes an image and renders it as a grid of ASCII characters in the console. The character chosen depends on the brightness of each pixel in the image: the following sequence (from densest (brightest) to least dense) is …
As a companion script to this one on UK monthly temperatures the Met Office's data on rainfall can be compared in a similar way. The script below produces "raincloud" plots of the monthly rainfall since 1891 for two regions of the UK: East Anglia (relatively …
The UK Meteorological Office offers historical data of mean monthly temperatures in different regions of the UK for download. For the purposes of this blog post, I downloaded the data corresponding to two regions: Scotland.txt and South_England.txt. There are different ways of analysing these data …
This earlier blog post presented a way of performing a non-linear least squares fit on two-dimensional data using a sum of (2D) Gaussian functions. Fitting a two-dimensional polynomial to a surface is, in principle, a linear least-squares problem, since the fitting function is linear in …
Many phenomena can be described in terms of a measured variable varying exponentially with a quantity. For example, a processes such as radioactive decay and first-order reaction rates are described by an ordinary differential equation of the form where is time, is, e.g. the number …