Our latest edition, Issue 11, is available now. Enjoy the articles online or scroll down to view the magazine as a PDF.

Features

• In conversation with Trachette Jackson

We chat with Trachette about her work in mathematical oncology, her role models, and boosting diversity in mathematics
• How to cheat at cards

Kevin Houston teaches us how to deal ourselves the best hand

Mara Kortenkamp, Erin Henning and Anna Maria Hartkopf give us a tour of Polytopia, a home for peculiar polytopes
• Automated joke generation

I like my towns like I like my Alex: Bolton
• Kepler’s barrels

Sam Hartburn orders wine by the barrel, but wonders if she's getting the most wine
• What can you do with this space?

Nobody could draw a space filling curve by hand, but that doesn’t stop Andrew Stacey
• Weirdonacci numbers

Like Fibonacci, but weird. Robert J Low and Thierry Platini explain
• On the cover: Apollonian packing

David Sheard explores the rich mathematics and history behind the Apollonian packing, and the cover of issue 11
• Polynomials’ order

Yuliya Nesterova orders some polynomials around

Fun

• Launch day puzzle hunt

Celebrate the launch of issue 11 by taking part in our puzzle hunt
• Prize crossnumber, Issue 11

£100 of MathsGear goodies to be won if you can solve it
• What is the shape of you?

Are you a torus? A cone? Ed Spheran? Find out by answering a maximum of five easy questions
• Dear Dirichlet, Issue 11

Grant applications, musical media and last-minute Olympics training are the topics readers have sent in to the professor's postbox this issue
• Top ten vote issue 11

Vote for your favourite maths-themed day out
• Page 3 model: Cooking spaghetti

Some saucy modelling

• What’s hot and what’s not, Issue 11

Fashion is fleeting, Chalkdust regulars are not.
• Top Ten: pictures of scorpions

The definitive chart of the best pictures of scorpions

or

In conversation with Trachette Jackson

Michigan. Image: Wikimedia commons user Wapcaplet, CC BY-SA 3.0.

Oncology, the study of cancer, is just one of many specialisms which increasingly employs the predictive power of applied mathematics. This issue we chat with Trachette Jackson, professor of mathematics at the University of Michigan, to learn about the surprising effectiveness of mathematics in the treatment of cancer, as well as to hear about her own journey into mathematical oncology.

Modelling in medicine

Cancer cells. Image: Public domain.

Trachette starts by bringing us up to date on how mathematics has been used in cancer treatment. “The mathematical approach has been applied to just about every aspect of tumour growth, starting decades ago.” One aspect is cancer therapeutics: “We write down equations that describe the mechanism of action of new drugs and how the tumour responds, then make predictions about how best to deliver those drugs.” Another aspect is more fundamentally biological, such as how cells are transformed: “You can find mathematical equations about the probabilities of acquiring mutations and under what circumstances a tumour forms, as well as what the composition of that tumour will be and how many cells in that tumour will have these different mutations.” This sort of modelling allows us to diagnose or assess the risk of cancer developing, as well as treat it. Continue reading

How to cheat at cards

As a child I didn’t want to be a mathematician—I didn’t even know that was a job. Instead, for a short time, my dream was to be a crime-fighting card cheat. My interest arose from the TV series Sword of Justice where the main character obtained some help from card cheats in his quest to take down the despicable crime syndicate that had framed him and sent him to prison. (The opening credits on YouTube will attest to the programme’s brilliance.)

Despite the incompatibility of combining crime-fighting and card cheating I told my family that that was to be my chosen career. Unfortunately, I wasn’t very good at it, usually announcing my intentions to cheat before offering to play a quick game with someone. Nonetheless, to this day my family refuse to play cards with me—even Uno.

Along the way, I did learn a thing or two though. So allow me to explain to you an impressive trick that all the best card cheats know and that has some interesting mathematics hidden behind it.

The perfect shuffle

Every card cheat needs to be able to give the appearance of shuffling a deck of cards so that it remains in order. However, there is an entirely legitimate shuffle that allows us to cheat: the perfect shuffle. It mixes the cards but in a perfectly known and determined way.

A perfect (out) shuffle.

A standard deck has 52 cards. Split them into two equal piles and then interweave the piles so that the new order of cards alternates between the two piles.

The effect on the deck is shown on the right, where the cards are labelled 0 to 51 for reasons which will become clear later.

Instructions on how to do the shuffle are given below. Admittedly, it is not easy and plenty of practice is required but is satisfying once learned and has an impressive ‘wow!’ reaction when performed.

Eight perfect shuffles

What can we do with the perfect shuffle when we have learned it? First we have an interesting—and hopefully surprising—fact:

Perfect shuffle a deck eight times. It is now back in the order you started with!

Modular arithmetic is also used by clocks: they count the time mod 12.

With this you can perform a surprising trick. Put the deck in new deck order. If you perfect shuffle it five times, then the deck looks shuffled. There are patterns if one looks closely but you can show it to someone and with a straight face claim it is mixed up. Do the perfect shuffle three times for them—so now you have done it eight times in total—and to your spectator’s bafflement the deck is suddenly in order!

How can we use mathematics to prove this surprising fact? We start by numbering our cards. As above, from top to bottom, we shall number them 0 to 51, rather than the usual 1 to 52.

Next we use modular arithmetic. Arithmetic modulo $n$ is where we consider all numbers that have the same remainder after division by $n$ to be equivalent numbers. So $5=17 \mod 4$ means that 5 and 17 are equivalent modulo 4 as they both have remainder 1 after division by 4. Sometimes people write $5\equiv 17 \mod 4$ rather than using the equals sign.

With our 0 to 51 numbering the formula for finding where a card goes to after a perfect shuffle is relatively easy:

(Except for card 51) the card at position $x$ goes to position $2x \mod 51$.

For example, card 7 goes to $2 \times 7 \mod 51 = 14 \mod 51$, ie position 14. Note that this is the 15th physical card in the deck as we started counting at 0.

Similarly card 35 goes to \begin{align*} 2 \times 35 \mod 51 &= 70 \mod 51 \\ &= 51 + 19 \mod 51\\ &= 19. \end{align*} That is, card 35 goes to position 19.

Note that the card 7 gets lower in the deck and card 35 gets higher. So immediately we see that a perfect shuffle is beginning to mix the cards.

The formula has the exception of card 51. It is easy to see in the picture on the previous page that this card does not move and so we don’t have to worry about it in the formula—we will ignore it from now on.

But why does this $x\mapsto 2x \mod 51$ result hold? Consider first the top half of the deck, ie all the cards in positions 0 to 25. During the shuffle, the two cards in a pair of consecutive cards get a card between them. So the new positions of the top half cards will be multiplied by 2. Since we can have at most $2\times 25=50$, which is less than 51, we get $x\mapsto 2x\mod 51$ since $2x$ is in this case actually equal to $2x\mod 51$ (rather than just congruent).

For the bottom half cards we see that their positions should also be multiplied by 2 since they get cards between them. However, we note that card 26 (the top card of the bottom half of the deck) needs to go to position 1 (the second physical card position!). One way to do this is to take mod 51 (since $2\times 26 \mod 51 = 1$). It is easy to check that we can use this for all the other cards.

Now let’s see what happens when we do eight perfect shuffles on a particular card, say card 12. We just repeat the process that the card in position $x$ will go to position $2x \mod 51$: $\begin{array}{lccrcr} {\text{once}} & 12 & \to & 24 \mod 51 & & \\ {\text{twice}} & 24 & \to & 48 \mod 51 & & \\ {\text{three times}} & 48 & \to & 96 \mod 51 & =& 45\mod 51 \\ {\text{four times}} & 45 & \to & 90 \mod 51 & =& 39\mod 51 \\ {\text{five times}} & 39 & \to & 78 \mod 51 & =& 27\mod 51 \\ {\text{six times}} & 27 & \to & 54 \mod 51 &=& 3 \mod 51 \\ {\text{seven times}} & 3 & \to & 6 \mod 51 & & \\ {\text{eight times}} & 6 & \to & 12 \mod 51 &=& 12 \mod 51. \end{array}$ Of course, that doesn’t prove that this happens for the whole deck. I may have been cheating by picking one that worked—and you should never trust a card cheat! So let’s do the calculation for a general $x$. If we repeat the $2x\mod 51$ operation we get $2(2x)\mod 51$. Continuing in this way for the full 8 times we see card $x$ goes to position $2^8x\mod 51$. Simplifying mod 51 we get \begin{align*} 2^8 x \mod 51 &= 256 x \mod 51 \\ &=\left( (5\times 51) x + x \right) \mod 51\\ &=\left( 0 + x \right) \mod 51\\ &=x. \end{align*}

Hence, we have proved that eight shuffles move the card in position $x$ back to position $x$. If we have a different number of cards in our deck, then the number of perfect shuffles needed to return the deck to its original order varies. For example, a deck with 50 cards needs 21 perfect shuffles. The number of shuffles required for the deck is called the order. The following table shows the order of the perfect shuffle for a selection of decks where $N$ denotes the number of cards:

$N$ order
4 2
6 4
8 3
10 6
12 10
14 12
16 4
18 8
50 21
52 8
54 52

The word order arises due to a connection with group theory and the order of elements of a certain group. The details of this and many more hardcore mathematical facts can be found in Magic Tricks, Card Shuffling and Dynamic Computer Memories by S Brent Morris: one of its appendices is a list of all orders for $N$ up to 200.

Binary fun with in and out perfect shuffles

Up to this point I have talked of a perfect shuffle, ie singular. In fact, there are two types:

• A perfect out shuffle: the top card remains the top card.
• A perfect in shuffle: the top card becomes the second card.

A perfect in shuffle.

The perfect out shuffle is just what have been calling the perfect shuffle. The in shuffle is the new one. Its effect on deck order can be seen below—the top card ends up ‘in’ the deck.

By combining out and in shuffles we can move the top card to anywhere in the deck. And, as we shall see, from a mathematical perspective we get a surprising appearance of binary.

Alex Elmsley (1929–2006) was a mathematician and magician. He studied physics and mathematics at the University of Cambridge before becoming interested in computers. Among magicians he is known for inventing a convincing false count of cards which is now known as the Elmsley Count.

Elmsley was very interested in the perfect shuffle (which among magicians is also known as the Faro shuffle) and investigated the mathematics behind it. In particular, he found a method for moving the top card to any position in the deck through a sequence of in and out shuffles.

Let us suppose we wish to move the top card to position $k$ in the deck. (We keep the numbering of the cards from 0 to 51 so the top card is in position 0.) To move the card via a sequence of in and out shuffles we proceed as follows:

Translate $k$ to binary. Then do out and in shuffles where $\text{out} = 0$ and $\text{in} = 1$.

Note how brilliant it is that ‘o’ looks like 0 and ‘i’ looks like 1.

For example, suppose we want to move the top card to position 13. Well, 13 is written as 1101 in binary. So we do ‘i i o i’: in in out in.

Moving the top card to position 13.

So why does this work? Imagine we have a card in position $x$ in the top half of the deck. (The case of the bottom half is similar and is, of course, left as an exercise.) What does an out shuffle do to the binary representation of the number? Since an out shuffle is $x\mapsto 2x \mod 51$ it just adds a zero to the representation. So, a card at position 101 moves to 1010. This is no different to when we tell children that to multiply by 10 they can just place a 0 at the end.

Now, an in shuffle is given by $x\mapsto 2x +1 \mod 52 .$ That is, multiply by 2, add 1 and take mod 52 (note, not 51 this time). This can be checked in the same way as for the out shuffle. For a binary representation this will just add a 1 to the end. Thus, the card in position 101 moves to position 1011.

To put this all together, consider what happens in the above example where we move the top card to position 13. That is, we apply in in out in and track the progress of the initial top card. The first in shuffle moves the top card to position 1 in the deck. The second in shuffle moves it to 11. The out moves it to 110 and the last in moves it to position 1101.

OK, so this is an unexpected and charming appearance of binary but it only moves one card. That’s useful, but let’s see how we can move more cards and cheat in a real game.

Dealing four aces

An impressive bit of cheating is to deal yourself four aces in a game of poker—that’s a hand that is hard to beat. For our version we need a game with three other players. Take out the four aces and place them on top. A card cheat can do this secretly with ease. Now, do two perfect out shuffles. Deal the cards starting with you, ie go round in a circle giving each person a card until everyone has five cards each. You now have a hand with the four aces!

The reason that this works is simple. At the start, the pack (starting at the top) looks like

AAAAxxxxxxx…

where A denotes an ace and x denotes an indifferent card (whose value is unimportant).

Two perfect out shuffles give you all the aces (green).

Do the first shuffle and indifferent cards get placed between the aces. So we get

AxAxAxAxxxxxxx…

Do the second shuffle and we get a set up ready for a good hand when there are three other players:

AxxxAxxxAxxxAxxxxxxx…

Well, of course if you are going to cheat and win all the time, people are going to notice. To dodge this professional card cheaters would often work in pairs and the winning would alternate between the two cheaters, reducing the chances of discovery. So in this poker game of four players you need an accomplice. Suppose you are sitting in a circle with you dealing first to the person on your left and then going clockwise.

AAAA!

Wherever your accomplice sits you will be able to deal them the four aces. As before arrange the four aces on top. Suppose your partner is sitting at position 3. You need to deal them the third card—the card at position 2 in our numbering. Let’s move that top ace to position 2. In binary the number 2 is 10 so we do ‘io’ perfect shuffles. Hey presto, the top ace is now in the right place and furthermore so are the other aces as the two shuffles put three cards between each of them. A normal deal now will give your partner-in-crime all four aces. Let’s see that in a diagram:

start: AAAAxxxxxxx…
in shuffle: xAxAxAxAxxxxx…
out shuffle: xxAxxxAxxxAxxxAxxxxx…

Wherever your partner sits you can do the right sequence of in and out shuffles to ensure that they receive the aces!

If you wish to know more about card shuffling and mathematics, then the best book to read is (as mentioned already) Magic Tricks, Card Shuffling and Dynamic Computer Memories by S Brent Morris. And remember, card cheating is a crime—so don’t get caught!

How to do the perfect shuffle

Splitting the deck. Image: C Houston

The perfect shuffle requires cards in good condition so buy a new deck on which to learn and don’t use it for anything else—cards buckled in card games will not weave very well. There are various methods to achieve a perfect shuffle. This version is done ‘in the hands’ but some can be done on the table and don’t look in any way suspicious.

Squaring the cards. Image: C Houston

Hold the lower half of the deck in your left hand with fingers arranged around as above. The right hand has a similar grip but does not go all the way round and the index finger sometimes contacts the top of the deck, sometimes not.

Butt the cards together to square them up. If the cards are not square, then perfect shuffling is impossible. Press the halves together, with the right index finger touching both top cards so that the halves can be put in position. For an out shuffle the right hand part should be slightly higher so that the left hand top card will go under the right hand top card at the end of the shuffle. For an in shuffle the right hand part needs to be lower.

A perfect shuffle. Image: C Houston

Remove the index finger and begin applying pressure at the bottom corner where the two packs meet. Once interweaving has started let the deck ‘do the work’. It took me many weeks to be able to do this consistently so don’t be discouraged if you can’t do it straight away. Like many skills it needs practice!

Would you like to have a mathematical object named after yourself? You no longer need to be Pythagoras to eternalise yourself in the terminology of mathematics.

A polyhedron is not just for Christmas

This is Ecki. He lives in Polytopia.

Mathematicians currently know over a hundred trillion [1] different kinds of polyhedron and only a very small percentage of them actually have a name, like cube or pyramid. Not only does the cube possess a name and fame, it is also realised in gigantillions of models all over the world. But not for most polyhedra. These helpless shapes are nameless, unrealised, and lost in abstraction. You can help change that, today.

Who are we?

Polytopia is a foster home for all polyhedra with up to nine vertices. We give them a home, regardless of their prominence or whether they’ve already got a name. When visiting Polytopia, you’ll be able to see all the polyhedra who have already found loving homes and, more importantly, meet the ones still waiting to be adopted.

But what can you do?

You can help us make a change and adopt one of these little geometrical creatures. By giving them a name and building a physical model of them, you can bring them into the real world. Visit us at Polytopia today and be inspired to rescue your new best friend from the realm of abstraction.

One of the polyhedra that lives in Polytopia.

There are several definitions of polyhedra in mathematics. Let us start with talking about polygons, which you are probably already familiar with. A polygon is a two-dimensional shape, consisting of straight line segments, called edges, and points, called vertices, where two edges meet. The simplest example of a polygon is a triangle. One important type of polygon is the regular polygon: those which have edges of the same length, and with all internal angles the same. Examples of regular polygons are the equilateral triangle and the square.

“I named my polyhedron Seems to be Piez and had a lot of fun crafting it.”

“My polyhedron is called Oktavius and makes a lovely decoration for my room.”

From polygons we can naturally build up to polyhedra. A polyhedron is a geometrical object bounded by a finite number of polygons. In other words, a polyhedron is a three-dimensional object, whose faces are polygons, whose edges are the straight line segments where two such faces meet, and whose vertices are points where three or more faces meet.

One of the simplest (and most famous) polyhedra is the cube. It is built by glueing squares together and it consists of eight vertices connected by twelve edges and six faces.

In Polytopia, we are only interested in convex polyhedra, which means that all inner angles between two edges or two faces are less or equal to 180°. Thus, no indentations, holes or cavities are allowed, and all vertices and edges are ‘pointing outwards’.

The superstars of the polyhedral world are the Platonic solids. These five polyhedra, each consisting only of identical regular polygons, are named after the ancient Greek philosopher Plato. Starting with regular triangles, we can use them to build three of the five Platonic solids: the tetrahedron, the octahedron, and the icosahedron. Do you already know the two remaining Platonic solids? (Hint: one of them is the cube.)

Three Platonic solids. Who’s missing?

Now you might ask yourself: how do we differentiate the polyhedra?

“It was so much fun modelling my polyhedron Pullyeder out of chocolate ice cream, especially because I ate it afterwards!”

“Since I was in need of a new pillow, I decided to sew my polyhedron Flori into one.”

We at Polytopia distinguish polyhedra by their combinatorial type and not their geometric realisation. The combinatorial type describes the structure of the vertices, edges, and faces of a polyhedron but it is not sensitive to the size or even the shape of a polyhedron. Given two polyhedra, take out the faces as if they were made of glass. What remains is the frame of the edges. Now imagine that you can mould and transform this frame in any way you like, but you cannot disconnect any of the edges or vertices. If you can transform the frame of one polyhedron into the other without making or breaking any connections, then these two polyhedra are considered combinatorially equivalent.

The two pictures on the next page show the cube but in different geometric realisations. The one on the left looks like what you might expect and the one on the right was generated by modifying the size and shape of the usual cube. But notice that the vertices can still be matched to one another, preserving the edges’ connections. Therefore, they are combinatorially equivalent, and are both called Cube.

Cube standing up straight, and Cube slouching.

Unfortunately, even with combinatorial equivalence, there are so many different polyhedra that it is infeasible for mathematicians to name them all. That’s why we here at Polytopia invite you to name as many polyhedra as you can. Every little helps.

[1] 114,683,158,574,357 to be precise. This is the number of combinatorial types of polyhedron with up to 18 vertices. No mathematician has been able to give the number for 19 vertices exactly: so far for more than 18 vertices, only upper bounds on the number of combinatorial types are known. Even the computers we have today would take forever to construct and count all types for 19 vertices.

Automated joke generation

You wouldn’t expect a computer to be able to make up a funny joke—it seems like a uniquely human ability. In order for a computer to understand the jokes that it is making, it would need to have deep semantic understanding of words, which is infeasible. And it can be difficult to explain why a joke is funny.

However, it is feasible to use factor graphs to define a relatively simple model for what makes a specific class of jokes funny. A computer can then apply this methodology to make funny jokes, although it will not understand them.

Mathematicians can use factor graphs to represent the factorisation of a function. As an example, suppose we have the function

\begin{equation*} f(X_1, X_2, X_3) = X_1 (X_1 + X_2 + X_3). \end{equation*}

Then $f$ can be factorised as \begin{equation*} f(X_1, X_2, X_3) = g(X_1) h(X_1, X_2, X_3), \end{equation*} where $g(X_1) = X_1$ and $h(X_1, X_2, X_3) = X_1 + X_2 + X_3$. ​ The factor graph for $f$ is:

It shows how $f$ can be factorised, and which variables appear in each factor. To make the graph, we label the factors in square boxes, the variables in circular boxes, and connect a variable to a factor if that variable is a term in the factor.

Factor graphs are useful for representing the factorisation of probabilities and they aid in visualising and piecing together the model’s connections. As another example, the combined probability that there will be rain on Monday and Tuesday ($R_M$ and $R_T$) can be factorised as

\begin{align*} P(R_M, R_T) &= P(R_M) P(R_T \mid R_M) \\ &= f_1(R_M) f_2(R_M, R_T). \end{align*}

Factor $f_1$ determines whether it rains on Monday, and factor $f_2$ determines if it rains on Tuesday given that it rained on Monday. The factor graph is:

Unsupervised joke generation from big data, a paper by Saša Petrović and David Matthews from 2013, is one of the most cited papers on automated joke generation. It uses factor graphs to generate jokes of the form

I like my $X$ like I like my $Y$: $\boldsymbol{Z}$.

For example:

I like my men like I like my coffee: hot.
I like my secret like I like my subset of $\mathbb{R}^2$: open.

The authors assumed that the probability that a joke of this form is funny is a function of its inputs, $(X, Y, Z)$. Technically the authors created a model for the probability that you would randomly choose the triple $(X, Y, Z)$ when choosing from a population of funny jokes. But we are interested in choosing triples that are likely to be funny. Fortunately, Bayes’ theorem tells us that the two quantities are proportional to each other. If $A$ and $B$ are random events, Bayes’ theorem says \begin{equation*} P(A \mid B) \propto P(B \mid A) P(A). \end{equation*}

We now let $A$ be the event that we choose the triple $(X, Y, Z)$, and let $B$ be the event that we choose a funny triple; so if a particular triple $(X, Y, Z)$ is more likely to be chosen by the model then its associated joke is more likely to be funny. Petrović and Matthews further assumed that $P(A \mid B)$ can be factorised using the factor graph below, which I will now go through.

Factor 1: $\text{Co-oc}_{X}, \text{Co-oc}_{Y}$

A joke of the form ‘I like my $X$ like I like my $Y$: $Z$’ will only make sense if the adjective $Z$ is often used to describe $X$ and $Y$. Without this assumption we would get anti-jokes such as

I like my goat like I like my Ferris wheel: intentional.

The factor $\text{Co-oc}_X$ is a measure of the co-occurrence. If we are given non-random values $x, z$ then we can evaluate:

\begin{equation*} \text{Co-oc}_X(x, z) = \frac{f(x, z)}{\sum_{x^\prime, z^\prime} f(x^\prime, z^\prime)}, \end{equation*}

where $f(x, z)$ counts the number of times that adjective $z$ is used to describe $x$ in a large corpus (a collection of written works). Petrović and Matthews used the Google Ngram data set as their corpus. We divide $f(x, z)$ by the sum of $f(x^\prime, z^\prime)$ over all pairs $(x^\prime, z^\prime)$ in order to scale $\text{Co-oc}_X(x, z)$ to be in the interval $[0, 1]$, like a probability (it will be used like a probability in Factor 2). $\text{Co-oc}_Y$ is just the same but with $y$ replacing $x$. ​

Factor 2: $\text{Diff}(X, Y)$

‘I like my $X$ like I like my $Y$: $Z$’ will only work as a joke if $X$ and $Y$ are quite different nouns. Without this assumption we would get anti-jokes such as:

I like my tea like I like my coffee: hot.

So the authors wanted to give a higher score to dissimilar nouns:

\begin{equation*} \text{Diff}(x, y) = \frac{1}{\textrm{similarity}(x, y)}, \end{equation*}

where the similarity function is estimated from the corpus. We set the probability of seeing the (noun, adjective) pair $(x, z)$ to be $p(x, z) = \text{Co-oc}_X(x, z)$, and then define

\begin{equation*} p(x) = \frac{f(x)}{\sum_{x^\prime} f(x^\prime)}, \end{equation*}

where $f(x)$ counts the number of occurrences of $x$ in the corpus. So $p(x)$ is the probability that we would choose $x$ if we chose a random word from the corpus. We also define

\begin{equation*} p(z \mid x) = \frac{p(x, z)}{p(x)}, \end{equation*}

so $p(z \mid x)$ is the probability that you have chosen adjective $z$, given that you chose a random (noun, adjective) pair from the data set and you see that you have chosen noun $x$. We define $p(y)$ and $p(z \mid y)$ similarly. The authors then chose a similarity function that resembles a correlation function between $X$ and $Y$:

\begin{equation*} \textrm{similarity}(x, y) = \frac{\sum_z p(z \mid x) p(z \mid y)}{\sqrt{\sum_z p(z \mid x)^2 \times \sum_z p(z \mid y)^2}}. \end{equation*}

If $x = y$ then $\textrm{similarity}(x, y) = 1$, and if $x$ and $y$ are commonly described using the same adjectives then the similarity will be close to $1$. And if $x$ and $y$ are very rarely described using the same adjectives then $\textrm{similarity}(x, y)$ will be close to $0$. ​

Factors 3 & 4: $\text{Rare}(Z)$ & $\text{Sens}(Z)$

The third factor encodes that the joke is funnier if $Z$ is not a common adjective. Without this assumption we would get anti-jokes such as:

I like my dogs like I like my quality of life: good.

The third factor is just defined as the reciprocal of the frequency of adjective $z$:
\begin{equation*} \text{Rare}(z) = \frac{1}{f(z)}.\end{equation*}The final factor encodes that the joke is funnier if $Z$ has many different senses. ‘I like my $X$ like I like my $Y$: $Z$’ jokes are often funny because one meaning of $Z$ is used for $X$ and another is used for $Y$. Without this assumption we would get anti-jokes such as:

I like my rectangles like I like my parallelograms: quadrilateral.

Just because $Z$ is chosen to have multiple senses doesn’t guarantee that it will be used in different senses for $X$ and $Y$: it is just an approximation. The final factor is

\begin{equation*} \text{Sens}(z) = \textrm{senses}(z), \end{equation*}

where $\textrm{senses}(z)$ is derived from the Wordnet corpus. ​ The probability that the authors chose a particular triple $(x, y, z)$ is then given by

\begin{equation*} \frac{\text{Co-oc}_X(x, z) \text{Co-oc}_Y(y, z) \text{Diff}(x, y) \text{Rare}(z) \text{Sens}(z)}{\sum_{x^\prime, y^\prime, z^\prime} \text{Co-oc}_X(x^\prime, z^\prime) \text{Co-oc}_Y(y^\prime, z^\prime) \text{Diff}(x^\prime, y^\prime) \text{Rare}(z^\prime) \text{Sens}(z^\prime)}, \end{equation*}

where we divide by the sum of all possible triples in order to make sure that the probabilities all sum to $1$. It was too expensive to compute the sum over all possible triples $(x, y, z)$ so the authors restricted themselves to some selected values of $x$, and for each of these they computed the conditional probability of $(X, Y, Z)$ given that $X = x$, which is computationally feasible. ​ The authors tested their model, comparing the jokes that they generated to a random selection of jokes found on Twitter. A small panel judged that their method can generate funny jokes: 16.3% of the jokes generated by their model were found funny, compared to 33.1% for the Twitter jokes. Here are two of the jokes generated by their model:

I like my coffee like I like my war: cold.
I like my relationships like I like my source: open.

In summary, factor graphs can be used to represent probability models, and these can also be used to generate jokes! Why not have a go at making your own jokes using these principles—Chalkdust would love to hear from you, especially if you come up with a good mathematical joke.

What can you do with this space?

A few years back, the students and staff at my school were set an art challenge over the summer break. Those who chose to take part were given a blank postcard and asked the question: What can you do with this space?

I feel that the obvious answer to this question is ‘fill it’. But in mathematics, the combination of the words space and fill links to a very specific concept: space-filling curves. In this article, I’m going to explain what these are, and how this leads to my entry (shown above).

Space-filling curves

A detail of my postcard.

There are many variations on the theme of space-filling curves, but the original and simplest version is a continuous curve that passes through every point in the unit square. Formally, it is a continuous surjective function $\gamma \colon [0,1] \to [0,1]^2$. Note that it only needs to be continuous and doesn’t have to be differentiable, so sharp corners are allowed.

The first space-filling curve was designed by Peano in 1890. Surprisingly, his paper has no pictures. A year later, based on Peano’s work, Hilbert came up with a slightly different construction and included pictures. Hilbert curves seem to be the more popular of the two, with about 20 times more search hits on the internet. You might conclude that pictures are important in mathematics; I couldn’t possibly comment. Continue reading

On the cover: Apollonian packing

What can you do with this space? So asks Andrew Stacey. ‘Fill it’ is the prompt reply, but fill it with what? Maybe like Andrew you want to use a single curve, but I want to use circles. If you do this in the way shown above in blue, the result is called an Apollonian packing, a variant of which can be seen on the cover of this issue.

Here we shall explore the history of this entrancing object, which spans over 2000 years, and percolates into a surprising variety of mathematical disciplines. Starting in the familiar world of Euclidean geometry, Apollonian packings extend into fractal geometry and measure theory; Möbius transformations and the hyperbolic plane; and then on into the distant reaches of geometric group theory, number theory, orbital mechanics, and even ship navigation. Continue reading

Chalkdust issue 11 – Coming 17 April

The cover of issue 11

The schools are shut, the universities closed, and the nation is in lockdown—what better time to publish a magazine? Save the date because we are publishing Chalkdust issue 11 at 9am on Friday 17 April. This issue includes all of your favourites like Dear Dirichlet, What’s hot and what’s not, and the crossnumber. There is also a smörgåsbord of articles to delight your mathematical senses, and of course terrible handcrafted maths puns, the like of which you can’t find anywhere else.

Due to current circumstances we will initially publish issue 11 online only: the articles will be available on the website, and (as usual) you will be able to read the whole magazine on issuu or download a PDF. We will be printing and distributing physical copies when circumstances allow. Continue reading

On curvature: cars, clothoids and cartography

Rollercoasters and railways were originally created without using curvature calculations. People on them would experience undesirable jerk (a sharp change in curvature results in jerk or centripetal forces). You may still experience this on old railways. The image below depicts a centrifugal railway that was constructed in 1846. Nowadays, rollercoaster and railway designers use a type of curve called a clothoid or Euler spiral to make the change in curvature less abrupt, for example when riding a loop-the-loop. I will later mention a couple of applications of Euler spirals. So curvature is clearly an important concept. Let’s get to grips with how it works, and where we should consider it. Continue reading

Book of the Year 2019

A few weeks ago, we announced the 9 book shortlist for the 2019 Chalkdust Book of the Year. In this post, we announce the winner of this award.

We will be awarding two prizes: the Chalkdust Book of the Year (as chosen by our editors), and the Chalkdust Readers’ Choice (as voted for by our readers).

Chalkdust Book of the Year 2019

We found picking a winner of this award really difficult, as all the books on the shortlist were deserving of the prize (obviously, as if not they wouldn’t have made the shortlist). The one thing that set the winner apart from the other books was its appeal to both mathematicians and non-mathematicians. And the winner is:

The Maths of Life and Death

Kit Yates

This book (Amazon UK, Waterstones), as its title suggests, is all about the maths of life and death. It looks at the maths related to law, biology, medicine, the spread of diseases, and many more areas. Kit takes you through these areas with a series of interesting and well-written stories.

You can read our full review of The Maths of Life and Death here.