1require_relative "../physics"23question :pushed_two_ways do4 kind :numerical5 describes "A body of %{mass} is pushed by two forces at right angles to each other, %{first_force} and " \6 "%{second_force}. %{acceleration}, in m/s²?"7 given mass: "5 kg"8 given first_force: "8 N"9 given second_force: "6 N"10 asks acceleration: "How strongly does it accelerate"11end
1require_relative "../questions/pushed_two_ways"2require_relative "../science/laws_of_motion/newtons_second_law"34solve :pushed_two_ways, using: NewtonsSecondLaw do5 objects :body, :first_pusher, :second_pusher6 body.goes(:pushed)78 take mass: body.mass9 take first_force: body.force(by: first_pusher).magnitude10 take second_force: body.force(by: second_pusher).magnitude1112 deduce_from "at right angles", first_force.perpendicular_to(second_force)13 deduce_from "How strongly", body.net_force => :positive1415 acceleration = body.acceleration.magnitude16 answer acceleration:, in: "m/s2"1718 conclusion "At right angles the two forces add like the sides of a right triangle, and the body " \19 "accelerates along the hypotenuse at that force over its mass."20end
1require_relative "../solutions/pushed_two_ways"23play_with :pushed_two_ways do4 title "Pushed Two Ways"5end