Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The Ant Problem

  1. Mar 7, 2013 #1
    Suppose there is an ant at each of the four corners of a square with side length 1, such that (0,0) and (1,1) are at opposite corners of the square. The ant at (0,0) is facing the ant at (1,0) is facing the ant at (1,1) and so forth. Each ant will choose its path such that it is always facing the ant in front of it. If you can imagine this situation, the ants should all meet at the center of the square. Assume the ants are traveling at some constant velocity 1 as well.

    This situation can be described as a system of differential equations. Each ant travels in a path that is identical to some rotation of the other paths. For example, the path that ant (1,0) takes is a 90 degree counter-clockwise rotation of the path that ant (0,0) takes. Therefore, if ant (0,0) travels on path [itex](x(t),y(t))[/itex], then ant (1,0) travels on path [itex](1-y(t),x(t))[/itex]. At any given point in time, ant (0,0) will be facing ant (1,0) such that [itex]\frac{y'(t)}{x'(t)}=\frac{x(t)-y(t)}{1-x(t)-y(t)}[/itex]. Let's go ahead and state the entire system as it applies to ant (0,0):

    [itex]x'(t)^2+y'(t)^2=1[/itex]: Implies that velocity is constant

    If anyone knows how to attack a problem like this please share your insight!
    Last edited: Mar 8, 2013
  2. jcsd
  3. Mar 7, 2013 #2


    User Avatar
    Gold Member

    I don't know the math but I know the answer is a logarithmic spiral (well, 4 of them).

    Maybe if you work it backwards in polar coordinates, with all 4 starting at the origin and moving away from each other, that will do it for you.
  4. Mar 7, 2013 #3


    User Avatar
    Homework Helper

    The equation [itex]\frac{y'(t)}{x'(t)}=\frac{1-x(t)-y(t)}{x(t)-y(t)}[/itex] blows up at t=0 because x(0) = y(0) = 0, while x'(0) = 1. The LHS and RHS thus don't seem to agree at t=0. Is there a mistake in the equation?
    Last edited: Mar 7, 2013
  5. Mar 8, 2013 #4
    Mute I fixed it. It was flipped
  6. Mar 8, 2013 #5
    This will be far simpler to work out in polar coordinates. Why dont' you work out formulas for r'(t) and theta'(t) ?

    If you want to convert back to rectangular in the end, then x(t)=r(t)cos(\theta(t))...

    EDIT: Just to clarify, in polar coordinates your origin should be the center of the square, not the initial point of one of the ants.
    Last edited: Mar 8, 2013
  7. Mar 10, 2013 #6
    Square the second equation and combine it with the first to obtain:


    This coupled pair of ODE's looks like a fairly straightforward system to solve analytically.
    Last edited: Mar 11, 2013
  8. Mar 11, 2013 #7
    Ok in polar coordinates, set up the origin as the center of the square. After any amount of time the ants will still form a square with the same center. So you can draw the velocity vector of which points inward at a forty five degree angle with the radial direction. And its length is 1. using the radial component, r' = const. Using the angular component, (rtheta)' = const. You just find the constants from looking at the simple diagram, and then solve for r(t) and then solve for theta(t). ezpz.
  9. Mar 11, 2013 #8
    Here's some more ezpz. Substitute:
    to obtain:

    Initial condition: [tex]X=Y=\frac{1}{2}[/tex]
  10. Mar 14, 2013 #9


    User Avatar
    Science Advisor

    Which is the same as
    [tex]\frac{dY}{dX}= -\frac{X- Y}{X+ Y}[/tex]
    Y(1/2)= 1/2.
  11. Mar 14, 2013 #10
    Hi HallsofIvy,
    I haven't been able to solve the trajectory equation analytically when expressed in this form, although, of course, that doesn't mean that it can't be done. On the other hand, the analytic solution to the pair of parametric coupled ODEs that I gave is very straightforward. Have you been able to solve the single ODE analytically? I haven't been able to work my analytic solution parameterized in terms of [itex]\xi[/itex] into a form that eliminates [itex]\xi[/itex].

  12. Mar 14, 2013 #11
    This is a rational equation, and also an Abel equation of the second kind.
    The solution can be obtained implicitly as:
    [itex]-\frac{1}{2}\ln(\frac{x^2+y^2}{x^2})-\arctan(\frac{y}{x})-\ln(x) = C[/itex]

    Better stick to the decoupled system, which is easier to solve because it's linear, just decouple and solve individually:
    [itex]x(t)=e^{-t}(c_1\sin(t)+c_2\cos(t)), y(t)=e^{-t}(c_2\sin(t)-c_1\cos(t))[/itex]

    edit: (oops, sorry for giving it away!)
  13. Mar 18, 2013 #12
    I came across a similar problem with 3 ants about 10 years ago, and spent hours and hours on it before forgetting about it. This just reminded me about it!

    Looking at the maths involved it seems I had no chance. :rofl:
  14. Mar 18, 2013 #13
    Bigfoot, your solution is incorrect. The trajectory should have constant speed and yours decays exponentially. The solution should reach the origin in finite time.

    Also, the equation that Halls wrote down is an example of a first order homogeneous equation. So you could solve it using another change of variables. u =Y/X. Perhaps that is what bigfoot did to get his implicit solution. Still, I agree with Chester, solutions in terms of t are much clearer here.

  15. Mar 19, 2013 #14
    I disagree, regarding Bigfoot's solution. It looks OK to me. He simply inadvertently used t as the parametric variable, rather than my [itex]\xi[/itex] (and used x and y instead of my X and Y). You can easily find the relationship between t and [itex]\xi[/itex] once you know the solution for X and Y. I think you will find that when t is infinite, [itex]\xi[/itex] is equal to unity.

  16. Mar 19, 2013 #15
    Oh I see. You're right of course. I saw the t and my mind forgot about the change of variables.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook