Mathematics of the Harp

After my second harp post, I thought I’d keep going with some mathematics. In particular I want to answer the question: why does a harp have that shape?


A modern electric lever harp (photo: Athy)

The physics of vibrating strings gives us Mersenne’s laws, which tell us that the frequency of a string of length L is (1 / 2L) √ T / μ , where T is the tension force on the string (in newtons), and μ is the density per unit length (in kg per metre).

For a string of diameter d and density ρ, we can calculate μ = A ρ, where A = π (d / 2)2 is the cross-sectional area. Nylon has a density ρ of 1150 kg/m3. For a nylon string of 1 mm diameter, we get μ = 0.0009 kg/m. Putting 0.448 m (17.6 inches) of that string under a tension of 140 newtons (31.5 pounds force), we get a frequency of (1 / 0.896) √ 140 / 0.0009  = 440 Hz. That is, the string plays the note A.

The important thing here is that the frequency is inversely proportional to the length. Over an octave the frequency doubles, which means that the string length halves. A 36-string harp covers 5 octaves, therefore if all the strings were made of the same material under the same tension, the longest string would be 32 times the length of the shortest. Doing some calculations in R for strings of diameter 0.8 mm under a tension of 140 newtons (31.5 pounds), we would get the following harp, which has strings ranging from 7 to 224 cm in length (note that the strings run from A to A, and the C strings are red):


Image produced in R. Click to zoom.

You can see quite clearly that, starting at the treble end, there is an exponential growth in string length. That makes for a terribly unwieldy instrument, and creates all sorts of problems in playing. In practice, we make bass strings thicker (and usually of heavier material) and we vary the tension as well – although, to make life easier for the harpist, we want the properties of the strings to vary reasonably smoothly. If we re-do our calculations with string diameters varying linearly from 3 mm to 0.6 mm, and tension varying linearly from 210 newtons at the bass end to 60 newtons at the treble end, we get a much more realistic-looking harp:


Image produced in R. Click to zoom.

We can flatten out the curve at the top a little by changing the way we vary the strings (after all, a guitar manages to span 2 octaves with all the strings being the same length). However, we cannot eliminate that curve completely – it is the inevitable result of spanning so many octaves, combined with the mathematics of exponential growth.

      
Left: an exponential curve (red) and a similar polynomial (dashed). Right: the quotient of the two functions (green) compared to a straight line (grey). Click images to zoom.

Mathematically speaking, the modifications to the strings have the effect of dividing an exponential function by some kind of polynomial (as shown above). Over a short range of x values, we can find a polynomial that fits the exponential well, and gives us strings of the same length. Over a wide range of x values, however, the exponential wins out. Furthermore, exponential growth is initially slow (sub-linear), so that (starting at the right of the harp), growth in string length is slower than the linear shift provided by the sloping base, which means that the top of the harp curves down. After a few octaves, growth in string length speeds up, and so the top of the harp curves up again.

A similar situation arises with the strings of a piano, although these are usually hidden from view:


Inside of a piano (photo: Alexandre Eggert)

And to finish, here is one of my favourite classical harpists in action:


Advertisements

Computational anthropology – Sororities and colour rules

A recent blog post about US sororities published the above slide from Sigma Delta Tau, dating from 2013 and outlining a palette of acceptable dress colours.

Founded a century ago, Sigma Delta Tau is a historically Jewish sorority with an interest in philanthropy. Their slogan is “empowering women,” and in some way that I cannot possibly understand, this is achieved partly through extremely detailed guidelines on attire. However, the slide above does make a good case study in computational anthropology.

Whenever we have a set of OK/Not OK pronouncements like these, decision tree learning is a good tool for extracting the underlying pattern (I used the rpart package in R). For colours, we can perform analysis using hue, saturation, and value. In this case, the first restriction computed by the tool (and reinforced in the text of the slide) is “don’t go too light” – the sorority requires a colour value below about 79. The second restriction in the decision tree is “not too blue” – specifically a hue lower than about 182. Saturation is not identified as important in the decision tree analysis.

The diagram below highlights the acceptable colour region and the specific examples from the slide above. Of course, this only gives clarity to what the social rule is. It does not explain why the social rule exists, or what social goals the rule might achieve. For that, we must turn to traditional anthropology – although even here, social simulation can provide computational assistance.


The Blue Mountains Water Skink


The endangered Blue Mountains Water Skink, Eulamprus leuraensis (photo: “Sarshag7”)

I have previously mentioned my interest in ecological niche modelling and amphibians. The cute little skink above, native to the Blue Mountains near Sydney, is sadly endangered. The black circles in the map below show online occurrence records for the skink. These range in altitude from approximately 530 to 1,170 m.

The blue area shows a predicted potential range for the species, based on MaxEnt modelling using those occurrence records and BioClim climate data. The model does not take into account the skink’s need for sedge and shrub swamps with permanently wet boggy soils – there are readily available online land cover datasets, but these have insufficient spatial resolution to identify the 30 or so swamps in which the skink is found. The predicted potential range for the skink is consequently very much exaggerated, and covers 1,320 sq km, of which 63% falls within national parks or other protected areas. Hopefully that is enough to stop this beautiful amphibian from becoming extinct, although it continues to face threats from urban sprawl, feral cats, and vegetation changes.


Chromatic polynomials

Network colouring is an fascinating branch of mathematics, originally motivated by the four colour map theorem (first conjectured in 1852, but proved only in 1976). Network colouring has applications to register allocation in computers.

For each network there is a chromatic polynomial which gives the number of ways in which the network can be coloured with x colours (subject to the restriction that directly linked nodes have different colours). For example, this linear network can be coloured in two ways using x = 2 colours:

The corresponding chromatic polynomial is x (x − 1)3, which is plotted below. Zeros at x = 0 and x = 1 indicate that at least 2 colours are required.

For the Petersen network below, the chromatic polynomial is:

x (x − 1) (x − 2) (x7 − 12 x6 + 67 x5 − 230 x4 + 529 x3 − 814 x2 + 775 x − 352)

This polynomial has zeros at 0, 1, 2, and 2.2051, and is plotted below:

Chromatic polynomials provide an interesting link between elementary and advanced mathematics, as well as an interesting case study of network algorithms.


Mathematics in action: returning from a random walk


Three 2-dimensional random walks. All three start at the black circle and finish, after 100 steps, at a coloured square. Later steps are in darker colours. Considerable backtracking occurs.

We have discussed one-dimensional random walks, but it is possible to have random walks in more than one dimension. In two dimensions (above), we can go left, right, forward, and back. A random walk in two dimensions can be played as a kind of game (as can one-dimensional random walks). In three dimensions (below) we can also move vertically. Three-dimensional random walks are related to the motion of molecules in a gas or liquid.


Three 3-dimensional random walks. All three start at the black circle (in the centre of the cube) and finish, after 100 steps, at a coloured square. Later steps are in darker colours.

One very interesting question is whether a random walk ever returns to its starting point. In one dimension, the probability of returning in exactly n ≥ 1 steps is 0 if n is odd, and C(nn/2) / 2n if n is even, where C(nk) is the number of ways of choosing k items out of n, which is defined by C(nk) = n! / (k! (nk)!).

For large numbers n, Stirling’s approximation says that n! is approximately sqrt(2πn)(n/e)n. If we let m = n/2, some tedious algebra gives the probability of returning in exactly n = 2m steps as 1/sqrt(πm) ≈ 0.56/sqrt(m). When I ran some experiments I actually got a factor of 0.55, which is pretty close. Given infinite time, the expected number of times we return to the starting point is then:

0.56 (1 + 1/sqrt(2) + 1/sqrt(3) + 1/sqrt(4) + …) = ∞

This means that an eventual return to the starting point is certain. It may take a while, however – in 100 random walks, summarised in the histogram below, I once had to wait for 11452 steps for a return to the starting point.

Random walks in two dimensions can be understood as two random walks in one dimension happening simultaneously. We return in exactly n = 2m steps if both one-dimensional walks return together. The probability is therefore the one above squared, i.e. 1/(πm) ≈ 0.318/m. Again, given infinite time, the expected number of times we return to the starting point is:

0.318 (1 + 1/2 + 1/3 + 1/4 + …) = ∞

This means that a return to the starting point is also theoretically certain, although it will take much, much longer than for the one-dimensional case. In a simple experiment, four random walks returned to the starting point in 6814, 2, 21876, and 38 steps respectively, but the fifth attempt took so long that I gave up. In three or more dimensions, a return to the starting point might never occur.


Mathematics in action: Risky Random Walks


A game of Risk (photo: A.R.N. Rødner)

The board game Risk, though far from being my favourite game (and rated only 5.59/10 on Board Game Geek), nevertheless has some interesting strategic aspects and some interesting mathematical ones.


Combat units in Risk (photo: “Tambako The Jaguar”)

A key feature of the game is a combat between a group of N attacking units and a group of M defending units. The combat involves several steps, in each of which the attacker rolls 3 dice (or N if N < 3) and the defender rolls 2 dice (or 1 if M = 1). The highest value rolled by the attacker is compared against the highest rolled by the defender, and ditto for the second highest values, as shown in the picture below. For each comparison, if the attacker has a higher value, the defender loses a unit, while if the values are tied, or the defender has a higher value, the attacker loses a unit.


Comparing attacker (left) and defender (right) dice in Risk (photo: “Val42”)

Working through the 65 possibilities, the attacker will be down 2 units 29.3% of the time, both sides will have equal losses 33.6% of the time, and the attacker will be up 2 units (relative to the defender) 37.2% of the time. On average, the attacker will be up very slightly (0.1582 of a unit). A fairly simple computation (square each of the outcome-mean differences −2.1582, −0.1582, and 1.8418; multiply by the corresponding probabilities 0.293, 0.336, and 0.372 and sum; then take the square root) shows that the standard deviation of the outcomes is 1.6223.

When this basic combat step is repeated multiple times, the result is a random walk. For example, with 10 steps, the mean attacker advantage is 1.582 units, and (by the standard formula for random walks discussed in a previous post) the standard deviation is 1.6223 times the square root of the number of steps, i.e. 5.1302.

The histogram below shows the probability of the various outcomes after 10 steps, ranging from the attacker being 20 units down (0.0005% of the time) to the attacker being 20 units up (0.005% of the time). Superimposed on the plot are a bell curve with the appropriate mean and standard deviation, together with five actual ten-step random walks. While the outcome does indeed favour the attacker, there is considerable random variability here – which makes the game rather unpredictable.