question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_lift_speeding_up do 4 kind :numerical 5 describes "A man of mass %{mass} stands on a weighing scale in a lift which is moving upwards with a uniform " \ 6 "acceleration of %{acceleration}. Taking g as %{gravity}, %{reading}, in newtons?" 7 given mass: "70 kg" 8 given acceleration: "5 m/s2" 9 given gravity: "10 m/s2" 10 asks reading: "what would be the reading on the scale" 11 end
1 require_relative "../questions/a_lift_speeding_up" 2 require_relative "../science/laws_of_motion/newtons_second_law" 3 4 solve :a_lift_speeding_up , using: NewtonsSecondLaw do 5 objects :man , :scale 6 axes :y 7 man . goes ( :riding ) 8 deduce_from "Taking g as" , man . weight . direction => - y 9 10 take mass: man . mass 11 take acceleration: man . acceleration . magnitude 12 take gravity: g 13 14 deduce_from "upwards" , man . acceleration . direction => y 15 deduce_from "stands on a weighing scale" , man . force ( by: scale ). direction => y 16 17 reading = man . force ( by: scale ). magnitude 18 answer reading :, in: "N" 19 20 conclusion "Speeding up upward, the scale must both hold the man up and push him faster, so it reads more " \ 21 "than his weight." 22 end
1 require_relative "../solutions/a_lift_speeding_up" 2 3 play_with :a_lift_speeding_up do 4 title "A Lift Speeding Up" 5 end