187 is almost right on the money. So your sim is pretty accurate
Printable View
187 is almost right on the money. So your sim is pretty accurate
I have a small idea... I think (not 100% sure) that the rate of change of the distance between the wolf and chicken is CONSTANT. Which means that the distance between them decreases linearly. The other guy on the forum told me I was pretty close... But I still can't figure it out hahaha...
It's obviously true when they move directly away from or toward each other, but in this 'curved' scenario, I can't see it so quickly :p I think it's true though.
I'm pretty sure the other guy knows, he just wants me to figure it out on my own.
Let's see... If the distance between wolf and chicken decreases linearly, then if you stay in the wolf's point of view, isn't it simply a case where the chicken slowly moves in a straight line towards the wolf? That is, if we also rotate with the wolf.
I might try simulating that in my sim...
EDIT
If I only take into account the movement of the wolf, I indeed get half a raindrop shaped path for the chicken. But, we also need to rotate the view so that the wolf keeps facing the same direction! One sec ;)
hmmm... let me think about this... what do you mean exactly by the curved distance? Do you mean the path that the wolf ends up taking? If so, let's call it s. The rate of change with respect to time is ds/dt, which is the wolf's speed. So yeah that's definitely constant.
Do you mean the linear distance? Yeah run that in the sim and see what you get... That would be interesting....
I mean the distance between the two.
Well, I must admit I have no idea how to make my simulation rotate itself :p
I have been able to move the viewer with the wolf, by simply substracting the distance the wolf moved from both the wolf and the chicken. So, the wolf remains stationary, and the chicken moves towards the wolf in a raindrop shape.
To rotate it however... I'm kinda lost :p
Right now I've got this in XNA (C#):
Code://1. Move chicken
C.Position.X += C.Direction.X * C.Speed;
C.Position.Y += C.Direction.Y * C.Speed;
//2. Update wolf direction
W.Direction.X = C.Position.X - W.Position.X;
W.Direction.Y = (C.Position.Y - W.Position.Y);
// normalize
float norm = (float)Math.Sqrt((Math.Pow(W.Direction.X, 2) + Math.Pow(W.Direction.Y, 2)));
W.Direction.X = W.Direction.X / norm;
W.Direction.Y = W.Direction.Y / norm;
W.Rotation = (float)Math.Atan(W.Direction.Y / W.Direction.X);
//3. Move wolf
float dX = W.Speed * (float)Math.Cos(W.Rotation);
float dY = W.Speed * (float)Math.Sin(W.Rotation);
W.Position.X += dX;
W.Position.Y += dY;
//// Let's keep the wolf on the same position
W.Position.X -= dX; W.Position.Y -= dY;
C.Position.X -= dX; C.Position.Y -= dY ;
I am pretty much certain that, in the wolf's frame of reference, the chicken merely moves towards the wolf in a straight line. Think about it. Imagine you are the wolf! Why would it not be a straight line? If it's not a straight line, that means you must be 'looking ahead' in order to intercept the chicken, which is exactly what the wolf does NOT do.
Just compute the distance...
Use the x,y coords of the wolf and chicken and compute the distance each iteration to see how it changes.
Yeah, the other dude just confirmed... From the wolf's perspective, it's simply a straight line. The chicken moves towards him at constant speed in a straight line.
So what can we deduce from that?
I don't think the chicken moves towards the wolf at a constant speed. The wolf initially closes in on the chicken at a rate of v_wolf, but by the end he's closing in at a rate of v_wolf-v_chicken. It's still an interesting idea; I'll file it as another avenue to try.
Assuming a chicken speed of 3m/s and a wolf speed of 5m/s. When they first start out, the chicken is going perpendicular to the wolf. So the wolf is gaining on the chicken at a rate of 5m/s.
As they end up closer and closer to heading in the same direction, the rate of closure drops down to 2 m/s, because the wolf is gaining at 5 m/s and the chicken is moving at 3 m/s.
Because of this, it's not possible that the wolf is gaining on the chicken at a constant speed. If so, your answer would be (distance separating)/(difference in speeds). So with the initial numbers of 200m / 2m/s that'd be 100 seconds they would travel. (or 300m chicken and 500m wolf)
Yeah both fizziii and jemidiah are right.
Your logic makes sense, but I'm not convinced yet. I'm talking about the wolf's frame or reference, in which the wolfs speed is ZERO!
Okay, we'll deal with the wolf's frame of reference. At the beginning, the side of the chicken is coming towards the wolf at 5m/s.
As time progresses, the chicken rotates away from the wolf, and the chicken's speed towards the wolf reduces towards 2 m/s.
Edit: You could also look at it with the chicken & wolf having identical speeds. At time zero, the wolf is moving towards the chicken at his speed and the chicken is not moving away.
Then for all practical purposes, the wolf ends up chasing the chicken with both of them traveling the same speed resulting in the chicken moving towards the wolf (from the wolf's perspective) at a speed of 0m/s.... so the speed of the chicken from the wolf's perspective can not be constant.
Looking at it from the wolf's frame of reference is very similar to considering the distance separating the two. That distance does not decrease constantly.
I've been thinking about it more and have shown one nice thing, at least. Consider the average speed of the wolf in only the horizontal direction. For him to capture the chicken, he must move a distance d in time tc. Extending my ideas from my first post, you can show
d = tc*v_wolf*g(s) where s = v_chicken/v_wolf.
The average speed of the wolf in the horizontal direction is then v_wolf*g(s). Working backwards from the answer, it turns out g(s) = 1-s^2; that is, the average speed of the wolf has a correction factor of (1-s^2). The partial derivative of this factor with respect to s is proportional to s--this (along with a few border conditions) is enough to give the answer.
If we can find some reason to say that the correction factor scales in this manner [that is, dg/dp is proportional to s) as the ratio of the chicken to the wolf's speed increases, the answer follows immediately.
I've thought more about my other approach with symmetries. It could certainly work, but it would appear magical and I would need knowledge of the solution curves to find a symmetry, so I've put that on hold.
Okay so for those of you who have been following this thread I think it's time to post the so-called 'simple' solution. Here it goes. I'm putting it in white so you don't have to read it if you don't want to:
Simple Solution:
In order to figure out how far the chicken gets you simply take the average of two distances -- how far the chicken gets if the wolf and chicken run directly at each other and the distance when running directly away from each other. I'll leave the math to you guys since it's very easy.
(Spoiler warning, uses knowledge of the simple solution to work backwards)
I read the simple solution a few weeks ago and have been mulling it over since. I can see where someone would figure it out from the algebra, but I haven't been able to find a reason to "see" it, and I've gone through more than a few ideas. Sometimes the solution of a particular problem is out of reach while the solution to a more general version is easy to see. In that spirit, I've generalized the problem to allow the sheep (or chicken, whatever poor little animal you want) to move at some given angle. That is, my question is--at what time tc, given some initial separating distance d, wolf speed w, sheep speed s, and sheep angle theta [theta = pi/2 in the original version] does the wolf hit the sheep.
The question then becomes a problem of analyzing the function tc(theta), considering the other parameters as pre-chosen constants. First we see that tc(0) <= tc(theta) <= tc(pi) for all theta by thinking about the problem's physical meaning. We also know that tc(pi/2) = [tc(0) + tc(pi)] / 2 from the "simple" solution. My first guess was to say that tc(theta) is a linear function of theta. I tested this, and unsurprisingly it's not. After further experimental testing, though, I've found out something that to me was shockingly concise: tc(theta) is a sinusoid. In fact I've found that
tc(theta) = tc(0) + [1-cos(theta)] * [tc(pi) - tc(0)] / 2
In some special cases, this gives the following:
tc(0) = tc(0) + 0 * [tc(pi) - tc(0)] / 2 = tc(0)
tc(pi) = tc(0) + 2 * [tc(pi) - tc(0)] / 2 = tc(pi)
tc(2pi) = tc(0) + 0 * [tc(pi) - tc(0)] / 2 = tc(0)
...and most importantly...
tc(pi/2) = tc(0) + 1 * [tc(pi) - tc(0)] / 2 = [tc(pi) + tc(0)] / 2 as in the "simple" solution.
Limitations on tc(theta): it has to have the edge case behavior that we've found at theta=0, pi, and 2pi, as well as pi/2. It has to be infinitely differentiable everywhere since it's describing something without any discontinuities in any of its derivatives. It has to be periodic with period 2pi. These alone are quite restrictive, though they don't force a sinusoid.
From this equation for tc, the "simple" solution follows directly, since tc(0) = d / (w + s), tc(pi) = d / (w - s) from some basic reasoning. It's a very powerful statement for this problem, neatly bundling up the time (and therefore points) of collision for every orientation at any parameter value. *Proving* that equation, though... I haven't thought about that much, yet.
One nice thing is that we don't need this equation in its entirety to solve the original problem. We only need one fact about tc(theta): that it's symmetrical about pi/2 in the sense that [tc(pi/2 - theta) + tc(pi/2 + theta)]/2 = tc(pi/2) is enough. This alone forces tc(pi/2) = [tc(pi) + tc(0)] / 2. Put it in other words, after grinding all of this out and refining it, we get this wonderful result:
The "simple" answer follows from the fact that if we take the original problem and change it by causing the sheep to run at an angle deflected toward the wolf, we decrease the time till capture by the same amount we would increase the time till capture by doing the opposite deflection away from the wolf. I feel like there's some nice physical reason for this property but I'm out of steam for a while on this problem.
I'll clean up my experimentation code some and post it with a nice graph hopefully tomorrow.
Attached is my testing code and a screenshot.
The code runs trials of the wolf chasing the sheep, with the wolf starting on the x axis and the sheep running away at some angle theta. Whenever the wolf catches the sheep, a red dot is graphed. The accuracy is only a few significant figures, but it's good enough to see general trends.
The top slider controls the "theta" in 1 degree increments. Whenever it's changed, the wolf and sheep get run and their collision point appears in red--individual trials should be almost instant. The collision for the initial problem--that is, with theta = 90 degrees--is graphed in green.
The "Go!" button moves the slider from 0 degrees to 360 degrees, graphing the collision positions for the current wolf speed setting at all angles. It also graphs the experimental collision time in the graph window.
The bottom slider controls the wolf speed. You can consider the sheep to have speed 50, so the slider starts at 51.
The Theory/Actual/Diff label should probably be ignored.
The graph has theta on the x axis (0 to 360 degrees), and experimental collision time on the y axis. However, the graph isn't centered at the origin--the lowest y-value shown is the theoretical collision time for the current parameters with theta = 0, and the highest y-value shown is the theoretical collision time for the current parameters with theta = 180 degrees. You can see the shape of the graph is identical as the wolf speed varies.
The Graph! button graphs a sinusoid on the graph. It matches perfectly with the results of the experimental trials.
In the screenshot, I've run the wolf and sheep for 4 different wolf run speed values, and have used the Go! button to run those trials for every degree from 0 to 360. The graph shows the experimental results for the most recent wolf run speed which happened to be 55. If I hit the Graph! button, a sinusoid would be graphed over the blue curve, and (having done it myself), it fits perfectly. This resulted in the master equation I gave in my previous post, which in a special case gives the "simple" solution to the original problem.
I still haven't been able to derive this equation or it's symmetry property, though. Even just saying that the collision time is a function of cos(theta) is enough to give the answer, but I can't say why that would have to be the case. Maybe someone has an idea?