question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_pebble_thrown_up do 4 kind :numerical 5 describes "A pebble of mass %{mass} is thrown vertically upwards. Ignore air resistance, and take g as %{gravity}. " \ 6 "%{force} during its upward motion, in newtons?" 7 given mass: "0.05 kg" 8 given gravity: "10 m/s2" 9 asks force: "What is the magnitude of the net force on the pebble" 10 end
1 require_relative "../questions/a_pebble_thrown_up" 2 require_relative "../science/laws_of_motion/newtons_second_law" 3 4 solve :a_pebble_thrown_up , using: NewtonsSecondLaw do 5 objects :pebble , :air 6 axes :y 7 pebble . goes ( :rising ) 8 deduce_from "take g as" , pebble . weight . direction => - y 9 10 take mass: pebble . mass 11 take gravity: g 12 13 deduce_from "Ignore air resistance" , pebble . force ( by: air ) => "0 N" 14 15 force = pebble . net_force . magnitude 16 answer force :, in: "N" 17 18 conclusion "With the air left out, the only force on the pebble is its weight, downward, whether it is " \ 19 "going up, coming down or still for an instant at the top." 20 end
1 require_relative "../solutions/a_pebble_thrown_up" 2 3 play_with :a_pebble_thrown_up do 4 title "A Pebble Thrown Up" 5 end