Curves of Pursuit

I was delighted that the first applied maths assignment of the year I received was focussed on one of my key interests: algorithmic programming (despite it being a very simple task programmatically). The scenario is that a rabbit travels at a constant speed of 10m/s from the origin to (100, 0). There’s also a fox who starts at (0, 50) and runs with a speed of v directly towards where the rabbit is at any time.

The assignment was to use a mathematical model (which treats time as a discrete variable) and, by plotting points on graph paper, to find out the minimum speed of the fox to catch the rabbit before it gets to (100, 0); naturally this was job for Excel!

I’ve got the excel spreadsheet as an attachment, downloadable here. I’ve tried to explain everything in comments, but the formulae may need a bit of explaining here. If you go to the ‘Calculations’ tab, the first column is ‘t’ – the discrete time variable (time gets quantised into ticks like a computer game). The next two coumns are the rabbit’s x and y coords; it’s fairly easy to work out how that’s calculated. Columns E and F are the fox’s coords; at each tick it adds to the previous coord the ‘movement vector’ – how far the fox moves per tick in both x and y axes (in cartesian coordinates of course) per tick (columns J and K). For these, essentially, the fox has to move v units towards the rabbit at each tick. To do this, a program would draw an imaginary trajectory from the fox to the rabbit and get the fox to move v units along this line every tick; this is what I got Excel to simulate. This means I basically need to get a vector of magnitude v at every tick, and my task was to come up with a formula to work out this in cartesian coordinates. Let’s draw a diagram and revise some primary school maths:

Apologies if this seems patronising. Here, I’ve turned everything into similar (AAA similarity) right-angled triangles, the hypotenuse of the smaller one representing the path the fox runs in 1 tick, and that of the larger one representing the imaginary trajectory. The maths is painfully simple but some of my friends couldn’t work it out (Set 1 Maths at St Paul’s School…) so it’s included here for their benefit. The operator is supposed to be a dot (multiplication) even though it looks woefully like a minus sign. And now we’ve got our formula for the fox’s x and y increments per tick! Now it’s a simple matter of dragging formulae on Excel and we’ve got 257 rows of ticks.

I then added some extra stuff to allow changing of the time interval to smaller and smaller values for greater accuracy. The problem with this model is that when the fox catches the rabbit, it overshoots and the model has it turning back on itself back towards the rabbit; I exploited this as a detection method for when the fox catches the rabbit. Ultimately this is a fairly crap model, but it was pretty fun to write (and make fun of). The real reason why I blogged this was to share this: try setting the fox’s speed to numbers higher than 50 with a time interval of 1 – you get rather interesting results. Sheet 3 is just an additional sheet which shows the fox’s minimum speed to catch the rabbit at different time intervals which I shamefully worked out manually (should have used a macro) – part of the prep.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: