question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_car_lift do 4 kind :numerical 5 describes "In a car lift compressed air exerts a force on a small piston having a radius of %{small_radius}. This " \ 6 "pressure is transmitted to a second piston of radius %{large_radius}. The mass of the car to be lifted " \ 7 "is %{mass}. Taking g as %{gravity}, %{force}, in newtons?" 8 given small_radius: "5.0 cm" 9 given large_radius: "15 cm" 10 given mass: "1350 kg" 11 given gravity: "9.8 m/s2" 12 asks force: "what force must the air exert on the small piston" 13 end
1 require_relative "../questions/a_car_lift" 2 require_relative "../science/mechanical_properties_of_fluids/pascals_law" 3 4 solve :a_car_lift , using: PascalsLaw do 5 objects :small , :large , :car 6 7 take small_radius: small . piston_radius 8 take large_radius: large . piston_radius 9 take mass: car . mass 10 take gravity: g 11 12 deduce_from "This pressure is transmitted" , large . pressure => small . pressure 13 deduce_from "The mass of the car to be lifted" , large . thrust => car . mass * g 14 15 force = small . thrust 16 answer force :, in: "N" , figures: 2 17 18 conclusion "The large piston has nine times the area of the small one, so the air needs only a ninth " \ 19 "of the car's weight to hold it up." 20 end
1 require_relative "../solutions/a_car_lift" 2 3 play_with :a_car_lift do 4 title "A Car Lift" 5 end