question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :across_the_current do 4 kind :numerical 5 describes "A motorboat heads north at %{boat_speed} through a current that flows at %{current_speed} toward 60° east of south. %{speed}, in km/h?" 6 given boat_speed: "25 km/h" 7 given current_speed: "10 km/h" 8 asks speed: "How fast does it actually move" 9 end
1 require_relative "../questions/across_the_current" 2 require_relative "../science/motion_in_a_plane/vectors" 3 4 solve :across_the_current , using: Vectors do 5 take boat_speed: :A , current_speed: :B 6 deduce_from "toward 60° east of south" , phi: "120 deg" 7 take speed: :R 8 answer find_value ( :speed , in: "km/h" , figures: 3 ) 9 10 conclusion "The boat's own velocity and the current's add as vectors, head to tail; the current " \ 11 "partly opposes the boat, so the sum is less than either would suggest by adding " \ 12 "their speeds." 13 end
1 require_relative "../solutions/across_the_current" 2 3 play_with :across_the_current do 4 title "Across the Current" 5 end