Solving a System of Differential Equations: Ants at the Corners of a Square

Click For Summary
SUMMARY

The discussion revolves around a system of differential equations modeling the movement of four ants positioned at the corners of a square with side length 1. Each ant moves towards the next while maintaining a constant velocity of 1, resulting in a logarithmic spiral trajectory towards the center of the square. The equations governing their motion include x'(t)^2 + y'(t)^2 = 1, and a relationship between the derivatives of their positions, which can be simplified using polar coordinates. Participants suggest various methods for solving the equations, including decoupling the system and using change of variables.

PREREQUISITES
  • Understanding of differential equations and their applications
  • Familiarity with polar coordinates and transformations
  • Knowledge of initial value problems and boundary conditions
  • Experience with solving coupled ordinary differential equations (ODEs)
NEXT STEPS
  • Study the method of solving coupled ordinary differential equations (ODEs) analytically
  • Learn about polar coordinate transformations in the context of differential equations
  • Explore the implications of initial conditions on the solutions of differential equations
  • Investigate logarithmic spirals and their mathematical properties in dynamical systems
USEFUL FOR

Mathematicians, physics students, and anyone interested in dynamical systems, particularly those studying motion and trajectories in multi-agent scenarios.

Arkuski
Messages
38
Reaction score
0
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 (x(t),y(t)), then ant (1,0) travels on path (1-y(t),x(t)). At any given point in time, ant (0,0) will be facing ant (1,0) such that \frac{y'(t)}{x'(t)}=\frac{x(t)-y(t)}{1-x(t)-y(t)}. Let's go ahead and state the entire system as it applies to ant (0,0):

x'(t)^2+y'(t)^2=1: Implies that velocity is constant
\frac{y'(t)}{x'(t)}=\frac{x(t)-y(t)}{1-x(t)-y(t)}
x(0)=0
y(0)=0
x'(0)=1
y'(0)=0

If anyone knows how to attack a problem like this please share your insight!
 
Last edited:
Physics news on Phys.org
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.
 
Arkuski said:
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 (x(t),y(t)), then ant (1,0) travels on path (y(t),1-x(t)). At any given point in time, ant (0,0) will be facing ant (1,0) such that \frac{y'(t)}{x'(t)}=\frac{1-x(t)-y(t)}{x(t)-y(t)}. Let's go ahead and state the entire system as it applies to ant (0,0):

x'(t)^2+y'(t)^2=1: Implies that velocity is constant
\frac{y'(t)}{x'(t)}=\frac{1-x(t)-y(t)}{x(t)-y(t)}
x(0)=0
y(0)=0
x'(0)=1
y'(0)=0

If anyone knows how to attack a problem like this please share your insight!

The equation \frac{y'(t)}{x'(t)}=\frac{1-x(t)-y(t)}{x(t)-y(t)} 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:
Mute I fixed it. It was flipped
 
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:
Arkuski said:
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 (x(t),y(t)), then ant (1,0) travels on path (1-y(t),x(t)). At any given point in time, ant (0,0) will be facing ant (1,0) such that \frac{y'(t)}{x'(t)}=\frac{x(t)-y(t)}{1-x(t)-y(t)}. Let's go ahead and state the entire system as it applies to ant (0,0):

x'(t)^2+y'(t)^2=1: Implies that velocity is constant
\frac{y'(t)}{x'(t)}=\frac{x(t)-y(t)}{1-x(t)-y(t)}
x(0)=0
y(0)=0
x'(0)=1
y'(0)=0

If anyone knows how to attack a problem like this please share your insight!

Square the second equation and combine it with the first to obtain:

y'=\frac{x-y}{\sqrt{(1-x-y)^2+(x-y)^2}}
x'=\frac{(1-x-y)}{\sqrt{(1-x-y)^2+(x-y)^2}}

This coupled pair of ODE's looks like a fairly straightforward system to solve analytically.
 
Last edited:
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.
 
Chestermiller said:
Square the second equation and combine it with the first to obtain:

y'=\frac{x-y}{\sqrt{(1-x-y)^2+(x-y)^2}}
x'=\frac{(1-x-y)}{\sqrt{(1-x-y)^2+(x-y)^2}}

This coupled pair of ODE's looks like a fairly straightforward system to solve analytically.

Here's some more ezpz. Substitute:
x=\frac{1}{2}-X
y=\frac{1}{2}-Y
d\xi={\sqrt{(1-x-y)^2+(x-y)^2}}dt
to obtain:
\frac{dX}{d\xi}=-X-Y
\frac{dY}{d\xi}=X-Y

Initial condition: X=Y=\frac{1}{2}
 
Which is the same as
\frac{dY}{dX}= -\frac{X- Y}{X+ Y}
Y(1/2)= 1/2.
 
  • #10
HallsofIvy said:
Which is the same as
\frac{dY}{dX}= -\frac{X- Y}{X+ Y}
Y(1/2)= 1/2.
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 \xi into a form that eliminates \xi.

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

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

edit: (oops, sorry for giving it away!)
 
  • #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. :smile:
 
  • #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.

http://en.wikipedia.org/wiki/Homogeneous_differential_equation#Homogeneous_functions
 
  • #14
Vargo said:
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.

http://en.wikipedia.org/wiki/Homogeneous_differential_equation#Homogeneous_functions

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

Chet
 
  • #15
Oh I see. You're right of course. I saw the t and my mind forgot about the change of variables.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K