question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :water_squeezed_at_depth do 4 kind :numerical 5 describes "Taking the bulk modulus of water as %{modulus}, %{squeezed} at a depth where pressure is %{pressure}, " \ 6 "given that its density at the surface is %{density}, in kg/m³?" 7 given pressure: "80.0 atm" 8 given density: "1.03e3 kg/m3" 9 given modulus: "2.2e9 N/m2" 10 asks squeezed: "what is the density of water" 11 end
1 require_relative "../questions/water_squeezed_at_depth" 2 require_relative "../science/mechanical_properties_of_solids/bulk_modulus" 3 4 solve :water_squeezed_at_depth , using: BulkModulus do 5 objects :deep_water 6 7 take pressure: deep_water . gauge_pressure 8 take density: rho 9 take modulus: deep_water . bulk_modulus 10 11 squeezed = deep_water . density_when_squeezed 12 answer squeezed :, in: "kg/m3" , figures: 4 13 14 conclusion "The pressure squeezes the water into a slightly smaller volume, and the same mass in less " \ 15 "room is slightly denser; water is so stiff that the change is a fraction of a percent." 16 end
1 require_relative "../solutions/water_squeezed_at_depth" 2 3 play_with :water_squeezed_at_depth do 4 title "Water Squeezed at Depth" 5 end