question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :stopped_by_a_steady_force do 4 kind :numerical 5 describes "A body of %{mass} is moving at %{speed} when a steady force of %{force} starts to act against " \ 6 "its motion. %{time}, in seconds?" 7 given mass: "20 kg" 8 given speed: "15 m/s" 9 given force: "50 N" 10 asks time: "How long does it take to stop" 11 end
1 require_relative "../questions/stopped_by_a_steady_force" 2 require_relative "../science/laws_of_motion/newtons_second_law" 3 4 solve :stopped_by_a_steady_force , using: NewtonsSecondLaw do 5 objects :body 6 axes :x 7 body . goes ( :stopping ) 8 9 take mass: body . mass 10 take speed: body . initial_velocity 11 take force: body . net_force . magnitude 12 13 deduce_from "against its motion" , body . net_force . direction => - x 14 deduce_from "to stop" , body . final_velocity => "0 m/s" 15 16 time = stopping . time_taken 17 answer time :, in: "s" 18 19 conclusion "The force slows it at a steady rate, the force over the mass, so the time to stop is " \ 20 "the speed it has to lose over that rate." 21 end
1 require_relative "../solutions/stopped_by_a_steady_force" 2 3 play_with :stopped_by_a_steady_force do 4 title "Stopped by a Steady Force" 5 end