All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 The farmer and the pig (Posted on 2008-11-13)
A farmer wants to catch a pig which is 100 meters away from him. They start running at the same time. The pig runs straight ahead, initially perpendicular to the line farmer-pig, at constant speed. The farmer always runs in the direction where he sees the pig (also at constant speed).

If the ratio of the speeds is 3:1 (farmer:pig), how far would the pig have traveled till the farmer caught it?

 See The Solution Submitted by pcbouhid No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 numerical integration (spoiler) | Comment 1 of 5

DEFDBL A-Z
dt = .00001
px = 0
fx = 0
fy = 100
DO
hypot = SQR((px - fx) ^ 2 + fy * fy)
dfx = 3 * dt * (px - fx) / hypot
dfy = 3 * dt * fy / hypot
px = px + dt
fx = fx + dfx
fy = fy - dfy
t = t + dt
LOOP UNTIL fx >= px OR fy <= 0
PRINT USING "###.########"; t; px; fx; fy

The above program simulates the chase and is thereby a numerical integration of the process.  It finds:

37.49999905 37.49999905 37.49999341 -0.00000000

That is, the farmer and the pig meeting 37.5 meters to the right of the pig's original position, that being how far the pig traveled.

 Posted by Charlie on 2008-11-13 18:43:08

 Search: Search body:
Forums (1)