The Drunkard's Walk
Q. A drunkard in a narrow lane takes 5 steps forward and 3 back, again and again, each step 1 mm long and 1 ss long. How long before he falls into a pit 13 mm ahead?
How it's solved
Solved with Velocity
Given
- m
- s
- m
- forward = 5
- back = 3
Assumed
- m
Working
- m, s
- displacement a time
- m/s
- m, sm/s
- m, m/s, s
- displacement a time
- m
- change of position
- m
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
- m, m/s, sm
Conclusion
Following him second by second is the point: averaging his progress would miss that he gets there at the end of a forward stretch, before he can step back.
The web of concepts
given read from the words equation asked
The Ruby that solves it
The question and its solution are small Ruby files. The engine runs them.
1require_relative "../physics"23question :the_drunkards_walk do4 kind :scq5 describes "A drunkard in a narrow lane takes %{forward} steps forward and %{back} back, again and again, each step " \6 "%{step} long and %{step_time} long. How long before he falls into a pit %{pit} ahead?"7 given forward: 58 given back: 39 given step: "1 m"10 given step_time: "1 s"11 given pit: "13 m"1213 option "37 s"14 option "39 s"15 option "52 s"16 option "65 s"17end1require_relative "../questions/the_drunkards_walk"2require_relative "../science/motion_in_a_straight_line/velocity"34solve :the_drunkards_walk, using: Velocity do5 take step: :Delta_x, step_time: :Delta_t, pit: :x6 assume x_0: "0 m"7 step = value_of(:Delta_x)8 tick = value_of(:Delta_t)9 pit = value_of(:x)10 forward = find_value :v_av, given: { Delta_x: step, Delta_t: tick }11 back = find_value :v_av, given: { Delta_x: -step, Delta_t: tick }12 rhythm = [ forward ] * value_of(:forward) + [ back ] * value_of(:back)13 x = value_of(:x_0)14 t = 015 rhythm.cycle do |v|16 x = find_value :x, given: { x_0: x, v_av: v, Delta_t: tick }17 t += tick18 break if x >= pit19 end2021 answer t2223 conclusion "Following him second by second is the point: averaging his progress would miss that " \24 "he gets there at the end of a forward stretch, before he can step back."25endplayground.rb
1require_relative "../solutions/the_drunkards_walk"23play_with :the_drunkards_walk do4 title "The Drunkard's Walk"5endThe laws it drew on
| quantity | written | units | within | from |
|---|---|---|---|---|
| position | m | — | Velocity | |
| displacement | m | — | Velocity | |
| path length | m | — | Velocity | |
| time taken | s | 0 … 1e+05 | Velocity | |
| average velocity | m/s | — | Velocity | |
| average speed | m/s | — | Velocity | |
| starting position | m | — | Velocity | |
| final position | m | — | Velocity |