question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :pascal_s_wine_barometer do 4 kind :numerical 5 describes "Toricelli's barometer used mercury. Pascal duplicated it using French wine of density %{density}. " \ 6 "Taking g as %{gravity}, %{height} for normal atmospheric pressure of %{atmosphere}, in metres?" 7 given density: "984 kg/m3" 8 given gravity: "9.8 m/s2" 9 given atmosphere: "1 atm" 10 asks height: "what is the height of the wine column" 11 end
1 require_relative "../questions/pascal_s_wine_barometer" 2 require_relative "../science/mechanical_properties_of_fluids/pressure_at_depth" 3 4 solve :pascal_s_wine_barometer , using: PressureAtDepth do 5 objects :column_foot 6 7 take density: rho 8 take gravity: g 9 take atmosphere: column_foot . pressure 10 11 deduce_from "Toricelli's barometer" , P_a => "0 Pa" 12 13 height = column_foot . depth 14 answer height :, in: "m" , figures: 3 15 16 conclusion "Above the column is empty space, so the wine alone must press as hard as the atmosphere; " \ 17 "wine is far lighter than mercury, so its column stands far taller." 18 end
1 require_relative "../solutions/pascal_s_wine_barometer" 2 3 play_with :pascal_s_wine_barometer do 4 title "Pascal's Wine Barometer" 5 end