14
$\begingroup$

$5$ ants are initially arranged on the corners of a regular pentagonal table (edges are long $L$), as showed in this picture:
enter image description here

At some point they all start moving with a constant speed $S$ and, at any moment, pointing the previous ant in counterclockwise order (as in the picture). They keep moving until they meet in the center $O$ of the table.

How long does it take to meet in $O$?
Also, how many times each ant rotated around $O$?

Notes: Consider the ants as points. Also, I kindly ask to everyone not to close-vote this question as math problem because it features a counterintuitive solution!

$\endgroup$
  • $\begingroup$ "Previous" usually means "opposite direction", so the "previous and in counterclockwise order" would be the "next and in clockwise order", the opposite of your diagram. Right? $\endgroup$ – Mooing Duck Apr 3 '15 at 16:38
  • $\begingroup$ By previous I mean the "one who precedes". Anyway, to avoid confusion, check the picture, it's pretty self-explanatory. $\endgroup$ – leoll2 Apr 3 '15 at 17:28
  • 1
    $\begingroup$ Sorry, I was unclear. I was hoping you could edit the question to avoid confusing people. $\endgroup$ – Mooing Duck Apr 3 '15 at 17:34
  • $\begingroup$ Wouldn't they just infinitely spiral towards the middle, never reaching it? $\endgroup$ – CactusCake Apr 3 '15 at 18:17
11
$\begingroup$

They take time $\left(1 + \frac{1}{\sqrt{5}}\right) L/S $. They rotate infinitely many times.

Each ant moves towards the next ant, decreasing the distance between them, but the other answer is moving slightly angled away. The ants remain in a pentagon, so this angle doesn't change, and the distance decreases at a constant rate. We'll find this rate, and from it determine when the ants meet.

Each ant moves towards the next one at speed $S$. But, the chased ant is also moving, angled away. Only the component of its velocity parallel to their displacement matters; the perpendicular component doesn't change their distance. These components are $(S \cos (2\pi/5), S \sin(2\pi/5))$, so the ant is increasing its distance away at rate $S \cos (2\pi/5))$. So, in total, the distance decreases at rate $S (1 - \cos (2\pi/5))$.

Dividing their initial distance $L$ by this rate gives the time to meet. Using Wolfram Alpha to express this in radicals gives $$\left(1 + \frac{1}{\sqrt{5}}\right) L/S $$

After rotating through some angle around the center, the ants are still in a regular pentagon, but scaled down. Since the angle of rotation isn't affected by scale, they still need to rotate through the same angle as they did at the start. So, that angle must be infinite.

$\endgroup$
  • 1
    $\begingroup$ This was a nice problem, but the trig for the pentagon was a bit ugly -- it wouldn't have been needed for a square. $\endgroup$ – xnor Apr 3 '15 at 10:47
  • 1
    $\begingroup$ Nice! Another solution: The circumcenter of the ants is also moving at speed S; the circumradius of the table is L/2sin(π/5), so this gives L/2sin(π/5)S, which is the same value. $\endgroup$ – Aravind Apr 3 '15 at 11:43
  • $\begingroup$ Aravind, the circumcenter (intended as the intersection of axis) of the 5 ants isn't moving! $\endgroup$ – leoll2 Apr 3 '15 at 12:45
  • $\begingroup$ You are on the right path toward the solution, though your answer is incorrect yet! Could you please add more details about how you got to that formula, so that I can help you to determine your mistake? $\endgroup$ – leoll2 Apr 3 '15 at 13:04
  • $\begingroup$ @leoll2 Yeah, going through my reasoning made me realize my velocity calculation was faulty. Is it right now? $\endgroup$ – xnor Apr 3 '15 at 19:55
2
$\begingroup$

Taking a slant on xnor's idea, consider the velocity of any ant towards $O$. I'll use the standard figures for the internal angle of a regular pentagon and the radius of a circumscribed circle from wikipedia. Name the vertices $A,B,C,D,E$ starting at the top and working clockwise, and let $\theta = \angle OAB$.

By symmetry, $\angle OAE$ is also $\theta$, so $\angle BAE = 2\theta = 3\pi/5$ (internal angle of a regular pentagon), i.e. $\theta = 3\pi/10$.

The velocity $V$ of $A$ towards $O$ is $S \cos \theta$, so the time $T$ taken for $A$ to reach $O$ is ${AO \over V} = {L \over 2 \sin (\pi/5)} \times {1 \over S \cos \theta}$ (using the formula for the radius of a circumscribed circle).

$$\therefore T = {L \over 2S \sin (\pi/5) \cos (3\pi/10)} = {L \over 2S \sin^2(\pi/5)} \approx 1.45L/S$$

As xnor observes, the ants spiral through an unbounded angle.

As $T$ and $S$ are finite, the total scalar distance $D=TS$ traversed by each ant is also finite. Since $T \approx 1.45L/S$ from before, we also have $TS \approx 1.45L$, i.e. $D \approx 1.45L$.

The counter-intuitive result hinted at by leoll2 is then the finite time taken to traverse an infinite spiral, where the total length of the spiral is a constant factor of about 1.45 times the length of one side of the initial pentagon.

Note: thanks to leoll2 for pointing out the trig simplification.

$\endgroup$
  • $\begingroup$ So we're getting different answers? $\endgroup$ – xnor Apr 3 '15 at 22:48
  • $\begingroup$ @xnor Looks like it - cross check? $\endgroup$ – Lawrence Apr 3 '15 at 22:53
  • $\begingroup$ Correct! The final formula is a bit rough (did you realize that cos(3pi/10)=sin(pi/5)? If you can, please edit it the formula to make it look slightly more elegant :-) $\endgroup$ – leoll2 Apr 4 '15 at 16:01
  • 1
    $\begingroup$ @leoll2 Thanks! I've made the change and propagated the correct evaluation to the rest of the answer. Please excuse my rusty trig. Nice problem and interesting end result. $\endgroup$ – Lawrence Apr 4 '15 at 16:17
1
$\begingroup$

Each ant is 11 pixels in diameter. So, given a bounding radius of 5.5 pixels and a start radius of 130 pixels (I approximated the diagram), they travel 3.82 radians before running into each other, at a rate of 2 pixels per iteration and assuming Float32 as the maximum accuracy.

Here is a live demo I created in javascript.

View the Demo https://jsfiddle.net/FlavorScape/7tawcgfw/

As you can see, after it completes, they spin off into infinity (because the bounding box does not stop them from approaching the line below the Float32 accuracy, is considered zero and all points gravitate to -1,1 from the "fake" center at 200 until they hit actual pixel 0,0 then do some other stuff, i'm not sure why.

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

    <script language="javascript">

      window.onload = function(){
          var ants = [];
          var radius = 106;
          var center = [200,200];
          var step = 2;
          var interval = 33;
          var antRadius = 11;
          var done= false;
          var t = 0;
          var startRotation4;

          var angle = 0;
          for( var i = 0; i < 5; i ++ )
          {
              angle += 2 * Math.PI / 5;

              var ant = document.getElementById( 'ant-' + i);

              ant.style.left = Math.sin(angle ) * radius + center[0] + 'px';
              ant.style.top = Math.cos( angle)  * radius + center[1] + 'px';

              var dx = parseInt( ant.style.left) - 200;
              var dy = parseInt( ant.style.top ) - 200;
              startRotation4 = Math.atan2( dy, dx);

              ants.push( ant );
          }

          var travelled = 0;

          setInterval(function(){

              document.getElementById( 'readout').innerText = 't=' + t + ' a=' + travelled ;



              //chase the tail
              for( var i = 0; i < 5; i ++ )
              {
                  var target = ants[ i - 1];
                  var ant = ants[i];
                  if( ! target )
                  {
                      target= ants[4];
                  }

                  var dx = parseInt( target.style.left) - parseInt( ant.style.left );
                  var dy = parseInt( target.style.top ) - parseInt( ant.style.top );

                  var angle = Math.atan2( dy, dx );

                  var velX = Math.cos( angle ) * step;
                  var velY = Math.sin( angle ) * step;



                  ant.style.left = parseInt( ant.style.left ) + velX + 'px';
                  ant.style.top = parseInt( ant.style.top ) + velY + 'px';

                  //just detect if they're touching (center plus radius collision)
                  var ctX = parseInt( target.style.left) + 5.5;
                  var ctY = parseInt( target.style.top )+ 5.5;

                  var cX =  parseInt( ant.style.left ) + 5.5;
                  var cY = parseInt( ant.style.top ) + 5.5;

                  if (  i == 4 )
                  {
                      var endDx = parseInt( ant.style.left) - 200;
                      var endDy = parseInt( ant.style.top ) - 200;
                      travelled = Math.abs( Math.atan2( endDy, endDx) - startRotation4);
                      console.log( startRotation4 , travelled )
                  }



                  if( (Math.abs( ctX - cX ) <= antRadius ) && (Math.abs( ctY - cY ) <= antRadius))
                  {

                      if( !done && i == 4 )
                      {


                          document.getElementById('done').innerText = 'done in ' + t + ' steps. angle travelled = ' + travelled + ' radians';
                          done = true;
                      }


                  }

              }

              t++;
          }, interval );



      };




    </script>

    <div id="ant-0" style="background-color:#f00; width:11px; height:11px; position:absolute"></div>
    <div id="ant-1" style="background-color:#f00; width:11px; height:11px; position:absolute"></div>
    <div id="ant-2" style="background-color:#f00; width:11px; height:11px; position:absolute"></div>
    <div id="ant-3" style="background-color:#f00; width:11px; height:11px; position:absolute"></div>
    <div id="ant-4" style="background-color:#f00; width:11px; height:11px; position:absolute"></div>


    <div id="readout"></div>
    <div id="done"></div>
</body>
</html>
$\endgroup$
  • $\begingroup$ Ants are points, no dimensions... $\endgroup$ – leoll2 Apr 3 '15 at 21:06
  • 1
    $\begingroup$ Duh, I'm just being facetious, while also being pixel accurate to the diagram. So my answer is more or less accurate if you take the diagram literally. Plus the demo is animated, so I should get points for animating the scenario =) $\endgroup$ – FlavorScape Apr 3 '15 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.