## 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.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "gedanken451.wordpress.com", "fetch_time": 1547760304000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2019-04/segments/1547583659340.1/warc/CC-MAIN-20190117204652-20190117230652-00061.warc.gz", "warc_record_offset": 503545782, "warc_record_length": 14593, "token_count": 739, "char_count": 3312, "score": 4.03125, "int_score": 4, "crawl": "CC-MAIN-2019-04", "snapshot_type": "latest", "language": "en", "language_score": 0.9486129283905029, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00033-of-00064.parquet"}