12 August 2020
by Rebecca Waters

Urban Maths: Who Let the Dog Out?

I became a dog owner in 2018 and one of the big constants in my life has become the need to walk Sparkle, my adorable spaniel and Labrador mix (aka @SparkleSprockerdor). I tend to walk Sparkle in a number of local parks, and walk between them through Victorian terraced streets built on a grid system. Whilst the grid system may inspire a future 'Urban Maths' article, today I am going to concentrate on the parks. [latexpage] When in the park, I use an 8 m retractable lead to enable her to get lots of exercise at a speed greater than I am comfortable moving at. It occurred to me that the way she moves would create some interesting graphs, and be a great way to think about parametric equations. The first equation I thought about was one where I walk in a straight line, and Sparkle approximately circles round me at a distance of 8 m. Let's think about the maths of this. Assume I walk at 1 m s$^{-1}$ and Sparkle runs at approximately 2 m s$^{-1}$, as convenient figures to illustrate the mathematics. Throughout this article, my position vector in metres can be written as \begin{equation}\begin{pmatrix}t\0\end{pmatrix},\end{equation} where $t$ is the time in seconds. If Sparkle were just to run in a circle, starting at the point $(8,0)$, her position would be: \begin{equation} 8 \begin{pmatrix} \cos kt \[.03cm] \sin kt \end{pmatrix}, \end{equation} where $k$ is chosen to define the speed. As we are assuming a speed of 2 m s$^{-1}$ and noting that the circle above with radius 8 m has circumference $16\pi$, then Sparkle will take $8\pi$ s to run around it. Thus, we require: \begin{equation} 2\pi = 8\pi k. \end{equation} Hence, $k = 0.25$ and the equation for Sparkle running in a circle becomes: \begin{equation} 8 \begin{pmatrix} \cos 0.25t \[.03cm] \sin 0.25t \end{pmatrix}. \end{equation} Using rules around addition of vectors, we can now create an approximate model for Sparkle circling me as I walk along the $x$-axis at 1 m s$^{-1}$ starting at the origin, assuming that Sparkle is constantly changing her velocity slightly to maintain the taut lead at 8 m: \begin{equation} \begin{pmatrix} t + 8\cos 0.25t \[.03cm] 8 \sin 0.25t \end{pmatrix}, \end{equation} which is illustrated in Figure 1. Sparkle's path whilst circling me on a taut lead The risk with this style of walking is that the lead wraps round the walker, thus creating a different graph. I leave that as an exercise for the enthusiastic reader! The other way that Sparkle behaves when she is on the 8 m lead is to weave from left to right ahead of me. I imagine this is her gun dog breeding coming to the fore, as I think this would be how she would have been bred to flush game from woodland. Although Sparkle has never been trained, or used, for this purpose, it is interesting to see these characteristics emerge. Thinking about how to model this, again I will take the stationary case first. Assume I stand at the origin. Sparkle starts at $(8,0)$ and then moves along an arc of radius 8 with the lead making a maximum angle of $45^{\circ}$ ($\pi/4$ radians) with the $x$-axis. Initially, Sparkle's position could be described as: \begin{equation} 8 \begin{pmatrix} \cos 0.25t \[.03cm] \sin 0.25t \end{pmatrix}, \end{equation} as before, but this only works until the angle made is $\pi/4$: \begin{equation} \pi/4 = 0.25t. \end{equation} Hence, rather pleasingly, $t = \pi$ s. Naturally one has to add in a $t$ element in the $x$ component to incorporate my movement, and then add in some translation factors (fractional multiples of $\pi$) in the different sections. In fact, for the period $-\pi$ s to $\pi$ s, this equation would hold whilst Sparkle is running in an anticlockwise direction: \begin{equation} \begin{pmatrix} t + 8\cos 0.25t \[.03cm] 8\sin 0.25t \end{pmatrix}. \end{equation} For the period $\pi$ s to $3\pi$ s, she will be running clockwise and her position would be: \begin{equation} \begin{pmatrix} t + 8\cos \left(0.25t + \dfrac{3\pi}{2}\right) \[.5cm] 8\sin \left(0.25t + \dfrac{\pi}{2}\right) \end{pmatrix}. \end{equation} In fact, the full four vectors to describe her path as she weaves from side to side ahead of me, as I walk along the $x$-axis at 1 m s$^{-1}$ starting at the origin, assuming the lead is taut, are, for integer $k$, as follows. For $(2k-1)\pi \le t < (2k + 1)\pi$, where $k$ mod $4 = 0$, then Sparkle's movement is modelled by: \begin{equation} \begin{pmatrix} t + 8\cos 0.25t \[.03cm] 8\sin 0.25t \end{pmatrix}. \end{equation} For $(2k-1)\pi \le t < (2k + 1)\pi$, where $k$ mod $4 = 1$, then Sparkle's movement is modelled by: \begin{equation} \begin{pmatrix} t + 8\cos \left(0.25t + \dfrac{3\pi}{2}\right) \[.5cm] 8\sin \left(0.25t + \dfrac{\pi}{2}\right) \end{pmatrix}. \end{equation} For $(2k-1)\pi \le t < (2k + 1)\pi$, where $k$ mod $4 = 2$, then Sparkle's movement is modelled by: \begin{equation} \begin{pmatrix} t + 8\cos (0.25t + \pi) \[.03cm] (8\sin 0.25t + \pi) \end{pmatrix}. \end{equation} For $(2k-1)\pi \le t < (2k + 1)\pi$, where $k$ mod $4 = 3$, then Sparkle's movement is modelled by: \begin{equation} \begin{pmatrix} t + 8\cos \left(0.25t + \dfrac{\pi}{2}\right) \[.5cm] 8\sin \left(0.25t + \dfrac{3\pi}{2}\right) \end{pmatrix}. \end{equation} These give the graph in Figure 2. Sparkle's path weaving side to side ahead of me, assuming the lead is taut Reflecting on these curves, it occurred to me that a simpler model might be more realistic. Sparkle does not tend to be at the extreme end of the lead, so perhaps a different model is required. For the second mathematical model, let Sparkle's $y$ coordinate be driven by a sine curve, which would be: \begin{equation} k \sin ct, \end{equation} where $k$ and $c$ are chosen to make the speed and lead length 'work'. Given her maximum distance from the $x$-axis should again be when the lead makes an angle of $\pi/4$ radians with the $x$-axis, and the maximum lead length remains 8 m, the greatest distance from the $x$-axis will be $8\sin(\pi/4)$, so $k = 4\sqrt2$ m (${\approx} 5.66$ m). This will take Sparkle $2\sqrt 2$ s (${\approx}2.83$ s) to run. This means $c$ needs to be chosen such that \begin{equation} \sin(c \times 2\sqrt{2}) = 1. \end{equation} Thus, \begin{equation} c\times 2\sqrt 2 = \frac{\pi}{2}. \end{equation} Hence, \begin{equation} c = \frac{\pi}{4\sqrt 2} = \frac{\pi \sqrt 2}{8}. \end{equation} Thus, with the movement in the $x$ direction simply being at 1 m s$^{-1}$ in time with me, the equation becomes: \begin{equation} \begin{pmatrix}t + 4\sqrt 2\[.5cm] 4\sqrt 2\sin \left(\dfrac{\pi\sqrt 2}{8}t \right)\end{pmatrix}, \end{equation} which is shown in Figure 3. Sparkle's path as she weaves from side to side ahead of me, assuming lead is not always taut This is (unsurprisingly) the simplest looking curve and I suspect closest to Sparkle's actual path, as it allows her time to turn corners and the lead would not be permanently taut (which it is not when I walk her). It might be an interesting lesson to convert this into an $(x,y)$ equation. I leave that to the enthusiastic reader or dog lover! Although in creating the three sets of parametric equations I have made some simplifying assumptions in respect of the real behaviour of a dog, I think the curves created, which have exploited parametric equations, trigonometry and modular arithmetic, are rather interesting examples of using real-world experiences to inspire mathematical thought.

Edward Rochead CMath CSci FIMA Dstl

Acknowledgements

The graphs were created using www.desmos.com. The author would like to thank Emma Bowley and Ronni Bowman for support in creating the graphs and animations and to Mike Lane and Linda Knutsen for reviewing the article. 'Urban Maths' cartoonist: Adrian Metcalfe The views and opinions expressed herein are those of the author and do not necessarily reflect those of Dstl. Reproduced from Mathematics Today, August 2020 Download the article, Urban Maths: Who Let the Dog Out? (pdf)
Image credit: Sparkle courtesy of Edward Rochead