Today’s post is going to be a bit more abstract and a bit less applied than usual, because today I want to take Python’s Sympy symbolic algebra library for a spin. As a narrative subject, we’ll be looking at the medieval English Longbow. We’ll start with some physics by modelling the deterministic trajectory of the arrow. Then we’ll add some statistical noise to make it a bit more realistic. Lastly, we’ll do some simple Bayesian inference on the range of the longbow. And we’ll do as much of it as we can via symbolic algebra.
These are English longbowmen. The English (or Welsh) Longbow is around 1.8-2m tall, can fire 10-12 arrows per minute in the hands of a skilled archer, and its steel-tipped arrows can penetrate the armour of a medieval knight. The “draw-weight” of a longbow is considerable, and skeletons of longbow archers often have enlarged left arms. Over a lifetime, the archer’s body was actually deformed by their tool of trade. So, how far could it shoot an arrow? Let’s figure that out with physics. According to Longbow Speed Testing (!), the velocity of an arrow leaving the bow is 172-177 feet per second. Say 53m/s in metric.
The trajectory of a projectile can be computed using classical mechanics:
- is the height of the arrow
- is the horizontal distance that the arrow has travelled
- is the angle at which the arrow is fired
- is the velocity of the arrow as it leaves the bow
- is the acceleration due to gravity (~ on the surface of the earth)
- (We’re ignoring wind resistance)
Let’s start by loading this into Sympy:
At the time of writing, the hunt is still on for Malaysia Airlines flight MH370. Bayesian search theory has become topical (again). Bayesian search has been used to find crashed planes, lost hikers, sunken submarines and even missing hydrogen bombs. Bayes’ theorem is perfectly suited to search because it provides a mathematical framework for deductive reasoning.
Let’s try it out.
Here’s our (semi-fictionalised) search scenario: In 217BC, Rome and Carthage are at war. Dido’s curse still haunts the two civilisations. Carthaginian General Hannibal Barca has just annihilated a Roman army at Lake Tresimene, 180km northwest of Rome. He had already inflicted a series of crushing defeats on the Romans to the point that, after Lake Tresimene, Rome was left virtually without any field army at all. The great fear was that Hannibal would now march his war elephants on the city of Rome itself. In times of dire emergency, the Roman republic allowed for the temporary appointment of a dictator. Five days after Lake Tresimene, the senate appointed Quintus Fabius Maximus as dictator. The first question for him was: where is Hannibal now?
A delicious hoax was recently perpetrated on the highbrow literary community. It really was the tasty cake. Sometime in 2002, Arnold Harvey invented an 1862 meeting between Charles Dickens & Fyodor Dostoyevsky and had ‘evidence’ of the meeting published in a respectable literary journal. In 2011 his fabrication was briefly taken as fact and appeared in at least two Dickens biographies and numerous book reviews.
Part of Mr. Harvey’s genius was his sly reverse psychology. The meeting is mentioned in a nonchalant, matter-of-fact way towards the end of a utterly commonplace piece of scholarly boffinhood titled Dickens’s Villains: A Confession and a Suggestion. The author of the article, a pseudonymous “Stephanie Harvey,” quotes a letter from Dostoyevsky which she supposedly translated from Russian. In the letter, Dostoyevsky recalls his meeting with Dickens sixteen years after the fact. Mr/Ms. Harvey’s article appeared in vol. 98 of the literary journal the Dickensian, where it went unremarked-upon for almost ten years before biographer Claire Tomalin discovered it. She found the anecdote so “irresistable” that she put it in her tome Charles Dickens: a Life. From there the “remarkable” encounter wound up in the opening paragraph of the NYT’s review, various other reviews and biographies (including Michael Slater’s Charles Dickens: A Life Defined by Writing), and will probably continue to be recounted as fact forever in the endless echo chamber of the Interwebs. (For the interested reader, the Times Literary Supplement contains a lengthy investigation and a speculation that Mr. Harvey is some sort of rogue scholar-vigilante).
The tantalising prospect of such a meeting seems to have intoxicated many otherwise sober critics. Nobody asked the practical questions like, what language did they communicate in? Or, had Dickens ever even heard of Dostoyevsky? The London Review of Books wrote that Ms. Tomalin “might have been less susceptible had she not so badly wanted it to be true.” And we want it to be true, too! Sadly, absent a time machine, there’s no way to make it so. But we can do the next best thing: we can train machines with the words of these two authors and then set those machines to chatting with one-another.
- FYODOR: “This hatred for Russia has been already embodied in the narrative as it stands so far and the other my own .”
- CHARLES: “We know what Russia means sir says Podsnap we know what England is.”
- FYODOR: “You thirsted while in Switzerland for your home country for Russia you read doubtless many books about Russia .”
- CHARLES: “Although I saw him every day it was for some time longer to settle myself for the present in Switzerland .”
- FYODOR: “It was a recollection of Switzerland .”
- CHARLES: “I tingle again from head to foot as my recollection turns that corner and my pen shakes in my hand .”
- FYODOR: “But I had supposed that laying aside my pen and saying farewell to my readers I should be heard …”
- CHARLES: “Upon my life the whole social system as the men call it when they make speeches in Parliament is a system of Prince ‘s nails !”
- FYODOR: “Why in the English Parliament a Member got up last week and speaking about the Nihilists asked the Ministry whether it was not high time to intervene to educate this barbarous people .”
- CHARLES: “Do n’t you know that people die there ?”
- FYODOR: “But excuse me I ‘ll make merry till I die !”
Isn’t this conversation just what we’d expected?! It’s lively, and moves quickly from Mother Russia to writing to English politics to colonialism… And what strikes me is how the character of the two authors is present in their words. Dostoyevsky’s brooding existentialism, Dickens’ concern with social justice. Their words could have come straight from their books… Because they did: this conversation was automatically generated from the two author’s oeuvres.
So I got interested in ‘digital humanities’ and I wanted to try out some of their procedures for doing literary criticism with computers. One basic problem they have is how to classify texts so that, firstly, they can be searched for and found (this is the librarian’s problem), but also so that they can be grouped according to content or genre and compared with one another (a literary critic’s job). And I realised that the internet is itself a vast text classification and retrieval problem on a scale comparable to the Borgesian infinite library. The Dewey decimal system is simply not going to cut it. I learned that even as I submit these words to this blog, search engine webcrawlers are sucking them all up and throwing them into vast term-document matrices, which they use to match my words to search phrases by calculating cosine similarities and other mathematical measures of correspondence.
How to do things with words with machines 1. Awesome geek stuff! The problem I’ve made up for today: train a machine to classify a book into one of three literary genres: Seafaring, Gothic Horror or Western.