question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :how_high_the_air_goes do 4 kind :numerical 5 describes "The density of the atmosphere at sea level is %{density}. Assume that it does not change with altitude. " \ 6 "Taking g as %{gravity} and the pressure at sea level as %{sea_level}, %{height}, in metres?" 7 given density: "1.29 kg/m3" 8 given gravity: "9.8 m/s2" 9 given sea_level: "1.01e5 Pa" 10 asks height: "how high would the atmosphere extend" 11 end
1 require_relative "../questions/how_high_the_air_goes" 2 require_relative "../science/mechanical_properties_of_fluids/pressure_at_depth" 3 4 solve :how_high_the_air_goes , using: PressureAtDepth do 5 objects :sea_level 6 7 take density: rho 8 take gravity: g 9 take sea_level: sea_level . pressure 10 11 deduce_from "how high would the atmosphere extend" , P_a => "0 Pa" 12 13 height = sea_level . depth 14 answer height :, in: "m" , figures: 3 15 16 conclusion "Sea level sits at the bottom of an ocean of air; if the air were as dense all the way up, " \ 17 "its pressure would be used up within a few kilometres." 18 end
1 require_relative "../solutions/how_high_the_air_goes" 2 3 play_with :how_high_the_air_goes do 4 title "How High the Air Goes" 5 end