question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :how_soon_a_stone_reaches_fifteen_metres 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?" 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 does it reach" 11 end
1 require_relative "../questions/how_soon_a_stone_reaches_fifteen_metres" 2 require_relative "../science/motion_in_a_straight_line/uniform_acceleration" 3 4 solve :how_soon_a_stone_reaches_fifteen_metres , 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 take time: flying . time_taken 12 answer find_value ( :time , in: "s" ) 13 14 conclusion "The stone is at that height twice, going up and coming down; it reaches it the first time, on the " \ 15 "way up." 16 end
1 require_relative "../solutions/how_soon_a_stone_reaches_fifteen_metres" 2 3 play_with :how_soon_a_stone_reaches_fifteen_metres do 4 title "How Soon a Stone Reaches Fifteen Metres" 5 end