question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_copper_ball_in_oil do 4 kind :numerical 5 describes "The terminal velocity of a copper ball of radius %{radius} falling through a tank of oil at 20 °C is " \ 6 "%{terminal}. Density of oil is %{oil}, density of copper is %{copper}. Taking g as %{gravity}, " \ 7 "%{viscosity}, in kg/(m s)?" 8 given radius: "2.0 mm" 9 given terminal: "6.5 cm/s" 10 given oil: "1.5e3 kg/m3" 11 given copper: "8.9e3 kg/m3" 12 given gravity: "9.8 m/s2" 13 asks viscosity: "what is the viscosity of the oil at 20 °C" 14 end
1 require_relative "../questions/a_copper_ball_in_oil" 2 require_relative "../science/mechanical_properties_of_fluids/stokes_law" 3 4 solve :a_copper_ball_in_oil , using: StokesLaw do 5 objects :ball 6 7 take radius: ball . radius 8 take terminal: ball . terminal_velocity 9 take oil: sigma 10 take copper: ball . density 11 take gravity: g 12 13 viscosity = eta 14 answer viscosity :, in: "kg m-1 s-1" , figures: 2 15 16 conclusion "At its terminal velocity the ball's weight, less the oil's buoyancy, is matched by Stokes' " \ 17 "drag, which grows with the viscosity; so the speed it settles to measures the viscosity." 18 end
1 require_relative "../solutions/a_copper_ball_in_oil" 2 3 play_with :a_copper_ball_in_oil do 4 title "A Copper Ball in Oil" 5 end