question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :heading_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. %{heading}?" 6 given boat_speed: "25 km/h" 7 given current_speed: "10 km/h" 8 asks heading: "How many degrees east of north does it actually move" 9 end
1 require_relative "../questions/heading_across_the_current" 2 require_relative "../science/motion_in_a_plane/vectors" 3 4 solve :heading_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 heading: :beta 8 answer find_value ( :heading , in: "deg" ) 9 10 conclusion "The current pushes the boat eastward as well as slowing it, so its true course " \ 11 "turns off north toward the east." 12 end
1 require_relative "../solutions/heading_across_the_current" 2 3 play_with :heading_across_the_current do 4 title "Heading across the Current" 5 end