- home
- PDF (letter size)
- PDF (legal size)

Fall, 2018 Compiled on May 25, 2020 at 4:48am

Four bugs on corners of a rectangle are standing at positions \(\left ( 0,0\right ) ,\left ( 0,2\right ) ,\left ( 1,2\right ) ,\left ( 1,0\right ) \). Bug 1 starts to move directly towards bug 2, while bug 2 moves directly towards bug 3 and bug 3 moves directly towards bug 4 and bug 4 moves directly towards bug 1. All are moving with unit speed. Motion is clockwise. Find the equations of motions and make animation of the motion.

The following diagram shows the initial positions of all four bugs and what happens after \(\Delta t\) has elapsed.

The four bugs are initially located at corners of rectangle. The width is \(h=1\) and the height is \(L=2\). Since each bug moves with the same speed toward the bug next to it (clockwise), then by symmetry, the four bugs will remain on the corners of a rectangle as time passes, but the rectangle will become smaller and rotate clockwise as the bugs spiral towards the center of the original rectangle where they all meet. The following diagram illustrates such motion after some \(\Delta t\) has elapsed.

We see that at each instance of time, each bug remains at the corner of a scaled down version of the original rectangle, which is rotating and the bug’s velocity is straight toward the bug position it is chasing. What this means is that bug 1 motion is always at \(90^{0}\) to the path of bug 2. And bug 2 motion is at \(90^{0}\) to the path of bug 3 and so on.

To obtain the equation of motion for each bug, we will look at each bug’s position relative to the bug it is chasing. Starting with bug 1 relative to bug 2 with the help of the following diagram

The position vector of bug 1 is \(\vec{r}_{1}\left ( t\right ) \) and the position vector of bug 2 is \(\vec{r}_{2}\left ( t\right ) \). Therefore \(\vec{v}_{1}=\frac{d\vec{r}_{1}\left ( t\right ) }{dt}=\left \vert \vec{v}_{1}\right \vert \hat{r}\) where \(\hat{r}\) is unit vector in the direction from bug 1 to bug 2. Hence\[ \frac{d\vec{r}_{1}\left ( t\right ) }{dt}=\left \vert \vec{v}_{1}\right \vert \frac{\vec{r}_{2}\left ( t\right ) -\vec{r}_{1}\left ( t\right ) }{\parallel \vec{r}_{2}\left ( t\right ) -\vec{r}_{1}\left ( t\right ) \parallel }\] But since \(\left \vert \vec{v}_{1}\right \vert =1\) meter per seconds then\begin{align*} \frac{d\vec{r}_{1}\left ( t\right ) }{dt} & =\frac{\left ( x_{2}\hat{\imath }+y_{2}\hat{\jmath }\right ) -\left ( x_{1}\hat{\imath }+y_{1}\hat{\jmath }\right ) }{\parallel \left ( x_{2}\hat{\imath }+y_{2}\hat{\jmath }\right ) -\left ( x_{1}\hat{\imath }+y_{1}\hat{\jmath }\right ) \parallel }\\ \left ( \frac{dx_{1}}{dt}\hat{\imath }+\frac{dy_{1}}{dt}\hat{\jmath }\right ) & =\frac{x_{2}-x_{1}}{\sqrt{\left ( x_{2}-x_{1}\right ) ^{2}+\left ( y_{2}-y_{1}\right ) ^{2}}}\hat{\imath }+\frac{y_{2}-y_{1}}{\sqrt{\left ( x_{2}-x_{1}\right ) ^{2}+\left ( y_{2}-y_{1}\right ) ^{2}}}\hat{\jmath } \end{align*}

Where \(x_{1},y_{1}\) are the coordinates of bug 1 and \(x_{2},y_{2}\) are the coordinates of bug 2. From the above, we obtain equations of motion for bug 1, where now we use \(x_{1}^{\prime }=\frac{dx}{dt}\) and \(y_{1}^{\prime }=\frac{dy}{dt}\) for bug 1.\begin{align} x_{1}^{\prime } & =\frac{x_{2}-x_{1}}{\sqrt{\left ( x_{2}-x_{1}\right ) ^{2}+\left ( y_{2}-y_{1}\right ) ^{2}}}\nonumber \\ y_{1}^{\prime } & =\frac{y_{2}-y_{1}}{\sqrt{\left ( x_{2}-x_{1}\right ) ^{2}+\left ( y_{2}-y_{1}\right ) ^{2}}}\tag{3} \end{align}

The same analysis is now done to obtain \(x_{2}^{\prime }\left ( t\right ) \) and \(y_{2}^{\prime }\left ( t\right ) \) expressions similar to (3) above for bug 2.

The position vector of bug 2 is \(\vec{r}_{2}\left ( t\right ) \) and the position vector of bug 3 is \(\vec{r}_{3}\left ( t\right ) \). Therefore \(\vec{v}_{2}=\frac{d\vec{r}_{2}\left ( t\right ) }{dt}=\left \vert \vec{v}_{2}\right \vert \hat{r}\) where \(\hat{r}\) is unit vector in the direction from bug 2 to bug 3. Hence\[ \frac{d\vec{r}_{2}\left ( t\right ) }{dt}=\left \vert \vec{v}_{2}\right \vert \frac{\vec{r}_{3}\left ( t\right ) -\vec{r}_{2}\left ( t\right ) }{\parallel \vec{r}_{3}\left ( t\right ) -\vec{r}_{2}\left ( t\right ) \parallel }\] Since \(\left \vert \vec{v}_{2}\right \vert =1\) meter per seconds then\begin{align*} \frac{d\vec{r}_{2}\left ( t\right ) }{dt} & =\frac{\left ( x_{3}\hat{\imath }+y_{2}\hat{\jmath }\right ) -\left ( x_{3}\hat{\imath }+y_{2}\hat{\jmath }\right ) }{\parallel \left ( x_{3}\hat{\imath }+y_{2}\hat{\jmath }\right ) -\left ( x_{3}\hat{\imath }+y_{2}\hat{\jmath }\right ) \parallel }\\ \left ( \frac{dx_{2}}{dt}\hat{\imath }+\frac{dy_{2}}{dt}\hat{\jmath }\right ) & =\frac{x_{3}-x_{2}}{\sqrt{\left ( x_{3}-x_{2}\right ) ^{2}+\left ( y_{3}-y_{2}\right ) ^{2}}}\hat{\imath }+\frac{y_{3}-y_{2}}{\sqrt{\left ( x_{3}-x_{2}\right ) ^{2}+\left ( y_{3}-y_{2}\right ) ^{2}}}\hat{\jmath } \end{align*}

Where \(x_{2},y_{2}\) are the coordinates of bug 2 and \(x_{3},y_{3}\) are the coordinates of bug 3. The above gives the two equations of motion for bug 2, where now we use \(x_{2}^{\prime }=\frac{dx_{2}}{dt}\) and \(y_{2}^{\prime }=\frac{dy_{2}}{dt}\) for bug 2.\begin{align} x_{2}^{\prime } & =\frac{x_{3}-x_{2}}{\sqrt{\left ( x_{3}-x_{2}\right ) ^{2}+\left ( y_{3}-y_{2}\right ) ^{2}}}\nonumber \\ y_{2}^{\prime } & =\frac{y_{3}-y_{2}}{\sqrt{\left ( x_{3}-x_{2}\right ) ^{2}+\left ( y_{3}-y_{2}\right ) ^{2}}}\tag{3} \end{align}

By doing the above again for bug 3 and bug 4, it is clear the result will be similar. The ﬁnal equations of motions in vector form are\begin{align*} \mathbf{x}^{\prime } & =f\left ( \mathbf{x}\right ) \\ & \begin{pmatrix} x_{1}^{\prime }\left ( t\right ) =\frac{x_{2}-x_{1}}{\sqrt{\left ( x_{2}-x_{1}\right ) ^{2}+\left ( y_{2}-y_{1}\right ) ^{2}}}\\ y_{1}^{\prime }\left ( t\right ) =\frac{y_{2}-y_{1}}{\sqrt{\left ( x_{2}-x_{1}\right ) ^{2}+\left ( y_{2}-y_{1}\right ) ^{2}}}\\ x_{2}^{\prime }\left ( t\right ) =\frac{x_{3}-x_{2}}{\sqrt{\left ( x_{3}-x_{2}\right ) ^{2}+\left ( y_{3}-y_{2}\right ) ^{2}}}\\ y_{2}^{\prime }\left ( t\right ) =\frac{y_{3}-y_{2}}{\sqrt{\left ( x_{3}-x_{2}\right ) ^{2}+\left ( y_{3}-y_{2}\right ) ^{2}}}\\ x_{3}^{\prime }\left ( t\right ) =\frac{x_{4}-x_{3}}{\sqrt{\left ( x_{4}-x_{3}\right ) ^{2}+\left ( y_{4}-y_{3}\right ) ^{2}}}\\ y_{3}^{\prime }\left ( t\right ) =\frac{y_{4}-y_{3}}{\sqrt{\left ( x_{4}-x_{3}\right ) ^{2}+\left ( y_{4}-y_{3}\right ) ^{2}}}\\ x_{4}^{\prime }\left ( t\right ) =\frac{x_{1}-x_{4}}{\sqrt{\left ( x_{1}-x_{4}\right ) ^{2}+\left ( y_{1}-y_{4}\right ) ^{2}}}\\ y_{4}^{\prime }\left ( t\right ) =\frac{y_{1}-y_{4}}{\sqrt{\left ( x_{1}-x_{4}\right ) ^{2}+\left ( y_{1}-y_{4}\right ) ^{2}}}\end{pmatrix} \end{align*}

With initial conditions\[ \mathbf{x}\left ( 0\right ) =\begin{pmatrix} x_{1}\left ( 0\right ) \\ y_{1}\left ( 0\right ) \\ x_{2}\left ( 0\right ) \\ y_{2}\left ( 0\right ) \\ x_{3}\left ( 0\right ) \\ y_{3}\left ( 0\right ) \\ x_{4}\left ( 0\right ) \\ y_{4}\left ( 0\right ) \end{pmatrix} =\begin{pmatrix} 0\\ 0\\ 0\\ 2\\ 1\\ 2\\ 1\\ 0 \end{pmatrix} \] We can not write this as \(\mathbf{x}^{\prime }=A\mathbf{x}\) since it is not linear system. These ODE’s have to solved numerically since they are nonlinear. The following is the result of running the solution for \(1.5\) seconds with the code listing below it. This shows the bug spiraling down to the center of the original rectangle as expected.

This problem was also solved for a square instead of a rectangle. The only change needed was to make the initial conditions as follows\[ \mathbf{x}\left ( 0\right ) =\begin{pmatrix} x_{1}\left ( 0\right ) \\ y_{1}\left ( 0\right ) \\ x_{2}\left ( 0\right ) \\ y_{2}\left ( 0\right ) \\ x_{3}\left ( 0\right ) \\ y_{3}\left ( 0\right ) \\ x_{4}\left ( 0\right ) \\ y_{4}\left ( 0\right ) \end{pmatrix} =\begin{pmatrix} 0\\ 0\\ 0\\ 1\\ 1\\ 1\\ 1\\ 0 \end{pmatrix} \] The time needed to reach the center in this case is one second.

These animations will play in HTML only

Code for animation is