question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :the_long_way_round_velocity do 4 kind :numerical 5 describes "A hotel is %{distance} from the station along a straight road, but a dishonest driver takes a " \ 6 "23 km route and gets there in %{time}. %{average_velocity}, " \ 7 "in km/h?" 8 given distance: "10 km" 9 given time: "28 min" 10 asks average_velocity: "What is the size of the taxi's average velocity" 11 end
1 require_relative "../questions/the_long_way_round_velocity" 2 require_relative "../science/motion_in_a_plane/motion_in_a_plane" 3 4 solve :the_long_way_round_velocity , using: MotionInAPlane do 5 take distance: :x , time: :Delta_t 6 assume x_0: "0 km" 7 take average_velocity: :v_av 8 answer find_value ( :average_velocity , in: "km/h" , figures: 3 ) 9 10 conclusion "Average velocity asks only how far the hotel is from the station, so the detour " \ 11 "makes the taxi slower by this measure, not faster. The two agree only for a " \ 12 "straight run." 13 end
1 require_relative "../solutions/the_long_way_round_velocity" 2 3 play_with :the_long_way_round_velocity do 4 title "The Long Way Round: Velocity" 5 end