question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :fifteen_metres_up_on_the_way_down do 4 kind :numerical 5 describes "A stone is thrown straight up at %{throw_speed}. Taking g as %{gravity}, %{time} %{height} above the " \ 6 "point of release on its way down?" 7 given throw_speed: "20 m/s" 8 given gravity: "10 m/s2" 9 given height: "15 m" 10 asks time: "how many seconds after the throw is it" 11 end
1 require_relative "../questions/fifteen_metres_up_on_the_way_down" 2 require_relative "../science/motion_in_a_straight_line/uniform_acceleration" 3 4 solve :fifteen_metres_up_on_the_way_down , using: UniformAcceleration do 5 objects :stone 6 stone . goes ( :flying ) 7 8 deduce_from "thrown straight up" , "Taking g as" , stone . acceleration => - g 9 take throw_speed: stone . initial_velocity , gravity: g , height: stone . final_position 10 deduce_from "above the point of release" , stone . initial_position => "0 m" 11 deduce_from "on its way down" , flying . time_taken => :largest 12 take time: flying . time_taken 13 answer find_value ( :time , in: "s" ) 14 15 conclusion "The stone passes the same height twice, once going up and once coming down; the later of the " \ 16 "two times is the one on the way down." 17 end
1 require_relative "../solutions/fifteen_metres_up_on_the_way_down" 2 3 play_with :fifteen_metres_up_on_the_way_down do 4 title "Fifteen Metres Up on the Way Down" 5 end