The recurrence devised by Jean-Michel Muller[1] and described in a slightly modified form by William Kahan in a 2006 monograph[2] provides an interesting example of how the finite precision of floating point arithmetic can lead to wildly incorrect results in some circumstances. Consider the function …
A superellipse (also called a Lamé curve) is the curve described by the equation For , this is the equation of an ordinary ellipse and for that ellipse is a circle. The corresponding curve for is sometimes called a squircle. As , the curve approaches …
A cobweb plot is often used to visulaize the behaviour of an iterated function. That is, the sequence of values obtained from setting , starting at some value . The plot can reveal stable, cyclic, or chaotic behaviour as convergence to a point, a repeating …
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 …
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 …
Goldbach's conjecture is probably one of the most famous unsolved problems in mathematics. It states that Every even integer can be expressed as the sum of two primes. The number of different ways that can be expressed as the sum of two primes is known …
Viviani's curve is the line of intersection between a sphere of radius and a cylinder of radius which is tangent to the sphere and also passes through its centre. The shape has the following parametric equation: It is calculated and plotted using Matplotlib in the …
The Klauber Triangle (first proposed by the American herpetologist Laurence Monroe Klauber) is a simple way to visualize the prime numbers, similar to the Ulam Spiral. It is constructed by creating a triangle of the natural numbers and then highlighting only the primes: Here is …
The Ulam Spiral is a simple way to visualize the prime numbers which reveals unexpected, irregular structure. Starting at the centre of a rectangular grid of numbers and spiralling outwards, mark the primes as 1 and the composite numbers as 0. The following code generates …
In the gradient descent method of optimization, a hypothesis function, , is fitted to a data set, () by minimizing an associated cost function, in terms of the parameters . The cost function describes how closely the hypothesis fits the data for a given choice …