question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :oxygen_drawn_from_a_cylinder do 4 kind :numerical 5 describes "An oxygen cylinder of volume %{volume} has an initial gauge pressure of %{initial_pressure} and a " \ 6 "temperature of 27 °C. After some oxygen is withdrawn from the cylinder, the gauge pressure drops to " \ 7 "%{final_pressure} and its temperature drops to 17 °C. The molecular mass of O2 is %{molar_mass}. %{mass}, " \ 8 "in kilograms?" 9 given volume: "30 L" 10 given initial_pressure: "15 atm" 11 given final_pressure: "11 atm" 12 given molar_mass: "32 g/mol" 13 asks mass: "Estimate the mass of oxygen taken out of the cylinder" 14 end
1 require_relative "../questions/oxygen_drawn_from_a_cylinder" 2 require_relative "../science/kinetic_theory/moles" 3 4 solve :oxygen_drawn_from_a_cylinder , using: Moles do 5 objects :full , :left , :withdrawn 6 7 take volume: full . volume 8 take initial_pressure: full . pressure 9 take final_pressure: left . pressure 10 take molar_mass: full . molar_mass 11 12 deduce_from "a temperature of 27 °C" , full . temperature => "300 K" 13 deduce_from "drops to 17 °C" , left . temperature => "290 K" 14 deduce_from "An oxygen cylinder" , left . volume => full . volume 15 deduce_from "some oxygen" , withdrawn . molar_mass => full . molar_mass 16 deduce_from "withdrawn from the cylinder" , withdrawn . amount => full . amount - left . amount 17 18 mass = withdrawn . mass 19 answer mass :, in: "kg" , figures: 2 20 21 conclusion "The cylinder keeps its volume, so the ideal gas law counts the moles in it before and after; the " \ 22 "moles missing, times the mass of a mole, went out with the oxygen drawn." 23 end
1 require_relative "../solutions/oxygen_drawn_from_a_cylinder" 2 3 play_with :oxygen_drawn_from_a_cylinder do 4 title "Oxygen Drawn from a Cylinder" 5 end