The Fly and Trains problem

[color=#0000ff][i][color=#0000ff][i][color=#999999]This activity belongs to the GeoGebra book [url=https://www.geogebra.org/m/mes4bgft]The Domain of the Time[/url].[/color][/i][/color][/i][/color][br][br]Constant speed motion frequently appears in many pursuit or encounter problems involving two moving objects. Although textbooks often solve them as systems of two equations with two unknowns (the distance traveled and the time taken to meet), a simple reasoning based on the [b]relativity of motion[/b] ([i][b][color=#cc0000]Galileo's relativity[/color][/b][/i] with respect to the reference frame) is enough.[br][br]For an observer on one of the moving objects, the object they're on remains stationary, while the other moves with the [b]difference [/b](vectorial, that is, considering the direction of each) of the speeds of both. Using this reasoning, it’s easy to deduce the time of the encounter.[br][br]Perhaps the most famous example of this type of problem is the one involving a fly and two trains:[br][br][i]Two trains are on the same track, 100 km apart, moving towards each other at 50 km/h each. A fly starts from the front of one train and flies toward the other at 75 km/h. Upon reaching the other train, the fly turns around and flies back toward the first train, continuing this back-and-forth motion. How many kilometers does the fly travel before being squashed in the collision of the two trains?[/i][br][list][*][b]Comment[/b]: Naturally, this statement, like many others in mathematics, falls into the category of "thought experiments" and shouldn't be judged with "common sense" (since when do flies fly at a constant speed without erratic movements? At 75 km/h, more than 10 times their normal speed? What strange motive drives the fly to make those absurd back-and-forth trips? Are both train conductors blind and don’t stop upon seeing the other train? How are these data known, does the fly carry a lightweight GPS? Etc.).[/*][/list]The fame of this problem stems from the fact that when it was proposed to the great mathematician John von Neumann (1903–1957, "Johnny" to his friends), replacing the trains with bicycles, he immediately gave the correct answer. "Oh, you’ve heard the trick before," said the disappointed questioner. "What trick?" asked Johnny, confused, "I simply summed the infinite series."[br][br]In a quick mental calculation, Johnny determined the length of the first segment the fly traveled (75t = 100 − 50t, where t = 4/5, and thus length[sub]1[/sub] = 75 × 4/5 = 60 km). In that time (4/5 hour), each train would have traveled 40 km, leaving only 20 km between them, or 1/5 of the original separation. Therefore, the lengths the fly travels form a [b][color=#cc0000][i]decreasing geometric progression[/i][/color][/b], with a ratio of 1/5 and a first term of 60. The sum of the infinite terms of this series is 60/(1−1/5) = 75 km.[br][br]The alternative, the "trick," much simpler, involves shifting the focus from space to time. From the perspective of one of the trains, the other train is approaching at 100 km/h, so they will collide in 1 hour after covering the 100 km separation. Thus, [b]the fly will be flying for 1 hour[/b]. At a speed of 75 km/h, the fly will have traveled 75 km.[br][br]Let’s note that since the speed is expressed in km/h, we choose kilometers as the unit of distance in the simulation. However, as we don't want to wait an hour for the experiment to be completed, [color=#cc0000][b]we scale the time[/b] (1:180)[/color], so that each second of execution represents 3 minutes of "real" time. Naturally, scaling time also means scaling the error introduced in the simulation.[br][list][*]Note: In the construction, it’s evident that the locomotives are not to scale.[/*][/list]
[b]SCRIPT FOR SLIDER anima[/b][br][br][color=#cc0000][color=#cc0000]# Calculate the elapsed seconds dt; add one second if t1(1) < tt[/color][/color][br][color=#999999]SetValue(tt, t1(1))[br]SetValue(t1, First(GetTime(), 3))[br]SetValue(dt, (t1(1) < tt) + (t1(1) − tt)/1000)[/color] [br][color=#cc0000]# Move the fly M (at speed v) and the trains (at speed vTrain)[/color][br]SetValue(M, M + dt v)[br][color=#0000ff]SetValue(Train1, Train1 + dt vTrain)[br]SetValue(Train2, Train2 - dt vTrain)[/color][br][br][color=#cc0000]# Set the boundaries of each movement[/color][br][color=#0000ff]SetValue(v, If(x(M - Train1) < 0, (abs(v), 0), x(Train2 - M) < 0, -(abs(v), 0), v))[br]StartAnimation(anima, x(Train2 - Train1) > 0)[/color][br] [br][br][br][br][br][color=#999999][color=#999999][color=#999999][color=#0000ff][color=#0000ff][color=#999999][color=#999999]Author of the activity and GeoGebra construction: [/color][/color][/color][color=#0000ff][color=#999999][color=#999999][url=https://www.geogebra.org/u/rafael]Rafael Losada[/url].[/color][/color][/color][/color][/color][/color][/color]

Information: The Fly and Trains problem