play phryzby with physics

The Drunkard's Walk

solved Velocity

Q. A drunkard in a narrow lane takes 5 steps forward and 3 back, again and again, each step 1 mΔx=1m long and 1 sΔt=1s long. How long before he falls into a pit 13 mx=13m ahead?

x₀ = 0 mx = 13 m

How it's solved

Solved with Velocity

Given

  • Δx=1m
  • Δt=1s
  • x=13m
  • forward = 5
  • back = 3

Assumed

  • x0=0m
Working
  1. Δx=1m, Δt=1s
  2. displacement a timevav=ΔxΔt
  3. vav=1m/s
  4. Δx=−1m, Δt=1s⇒vav=−1m/s
  5. x0=0m, vav=1m/s, Δt=1s
  6. displacement a timevav=ΔxΔt
  7. Δx=1m
  8. change of positionΔx=x-x0
  9. x=1m
  10. x0=1m, vav=1m/s, Δt=1s⇒x=2m
  11. x0=2m, vav=1m/s, Δt=1s⇒x=3m
  12. x0=3m, vav=1m/s, Δt=1s⇒x=4m
  13. x0=4m, vav=1m/s, Δt=1s⇒x=5m
  14. x0=5m, vav=−1m/s, Δt=1s⇒x=4m
  15. x0=4m, vav=−1m/s, Δt=1s⇒x=3m
  16. x0=3m, vav=−1m/s, Δt=1s⇒x=2m
  17. x0=2m, vav=1m/s, Δt=1s⇒x=3m
  18. x0=3m, vav=1m/s, Δt=1s⇒x=4m
  19. x0=4m, vav=1m/s, Δt=1s⇒x=5m
  20. x0=5m, vav=1m/s, Δt=1s⇒x=6m
  21. x0=6m, vav=1m/s, Δt=1s⇒x=7m
  22. x0=7m, vav=−1m/s, Δt=1s⇒x=6m
  23. x0=6m, vav=−1m/s, Δt=1s⇒x=5m
  24. x0=5m, vav=−1m/s, Δt=1s⇒x=4m
  25. x0=4m, vav=1m/s, Δt=1s⇒x=5m
  26. x0=5m, vav=1m/s, Δt=1s⇒x=6m
  27. x0=6m, vav=1m/s, Δt=1s⇒x=7m
  28. x0=7m, vav=1m/s, Δt=1s⇒x=8m
  29. x0=8m, vav=1m/s, Δt=1s⇒x=9m
  30. x0=9m, vav=−1m/s, Δt=1s⇒x=8m
  31. x0=8m, vav=−1m/s, Δt=1s⇒x=7m
  32. x0=7m, vav=−1m/s, Δt=1s⇒x=6m
  33. x0=6m, vav=1m/s, Δt=1s⇒x=7m
  34. x0=7m, vav=1m/s, Δt=1s⇒x=8m
  35. x0=8m, vav=1m/s, Δt=1s⇒x=9m
  36. x0=9m, vav=1m/s, Δt=1s⇒x=10m
  37. x0=10m, vav=1m/s, Δt=1s⇒x=11m
  38. x0=11m, vav=−1m/s, Δt=1s⇒x=10m
  39. x0=10m, vav=−1m/s, Δt=1s⇒x=9m
  40. x0=9m, vav=−1m/s, Δt=1s⇒x=8m
  41. x0=8m, vav=1m/s, Δt=1s⇒x=9m
  42. x0=9m, vav=1m/s, Δt=1s⇒x=10m
  43. x0=10m, vav=1m/s, Δt=1s⇒x=11m
  44. x0=11m, vav=1m/s, Δt=1s⇒x=12m
  45. x0=12m, vav=1m/s, Δt=1s⇒x=13m
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.

question.rb
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"17end
solution.rb
1require_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."25end
playground.rb
1require_relative "../solutions/the_drunkards_walk"23play_with :the_drunkards_walk do4  title "The Drunkard's Walk"5end
The laws it drew on
quantitywrittenunitswithinfrom
positionxm—Velocity
displacementΔxm—Velocity
path lengthdm—Velocity
time takenΔts0 … 1e+05Velocity
average velocityvavm/s—Velocity
average speedcavm/s—Velocity
starting positionx0m—Velocity
final positionxm—Velocity
x0≡xi(start of motion)
starting position
x≡xi(end of motion)
final position
di(whole)=di(part 1)+di(part 2)
path in parts
Δtw=Δtp+Δtp
time in parts
Δx=x-x0
change of position
vav=ΔxΔt
displacement a time
cav=dΔt
path a time