Problem 202. the fly, the train, the second train, and their Zeno's paradox
You have heard this one: A train leaves station A and travels with constant velocity v1. A second train leaves station B (at a distance d) and travels in opposite direction with constant velocity v2.
What you may have not heard is that a fly left station A at the same time as the first train (and in the same direction) flying with a constant velocity v3 ( v3>v1 and v3>v2 ). When the fly reached the second train it turned around and kept flying in the opposite direction. When it reached the first train it turned around again, and so forth, until its tragic demise (when the two trains collided).
The question is: what distance has the fly traveled in total (summing all its going and coming back the rails) before meeting its end?
Your function should take as input the scalars v1, v2, v3, and d, and it should return s the total distance traveled by the fly (up to 1% error allowed)
Solution Stats
Problem Comments
-
1 Comment
It's seems that even if we consider that the fly is always colliding with the same train (instead of zig-zagging between trains), the results are always the same.
Solution Comments
Show commentsProblem Recent Solvers70
Suggested Problems
-
The Hitchhiker's Guide to MATLAB
3296 Solvers
-
Reverse the Words (not letters) of a String
440 Solvers
-
541 Solvers
-
Make a run-length companion vector
638 Solvers
-
309 Solvers
More from this Author38
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!