question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_swimmer_under_a_lake do 4 kind :numerical 5 describes "A swimmer is %{depth} below the surface of a lake. Taking the density of water as %{density}, g as " \ 6 "%{gravity} and atmospheric pressure as %{atmosphere}, %{pressure}, in pascals?" 7 given depth: "10 m" 8 given density: "1000 kg/m3" 9 given gravity: "10 m/s2" 10 given atmosphere: "1.01e5 Pa" 11 asks pressure: "what is the pressure on the swimmer" 12 end
1 require_relative "../questions/a_swimmer_under_a_lake" 2 require_relative "../science/mechanical_properties_of_fluids/pressure_at_depth" 3 4 solve :a_swimmer_under_a_lake , using: PressureAtDepth do 5 objects :swimmer 6 7 take depth: swimmer . depth 8 take density: rho 9 take gravity: g 10 take atmosphere: P_a 11 12 pressure = swimmer . pressure 13 answer pressure :, in: "Pa" , figures: 3 14 15 conclusion "The swimmer carries the air above the lake and the water above them too; ten metres of " \ 16 "water weighs about as much as the whole atmosphere." 17 end
1 require_relative "../solutions/a_swimmer_under_a_lake" 2 3 play_with :a_swimmer_under_a_lake do 4 title "A Swimmer Under a Lake" 5 end