question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :the_speed_of_sound_in_air do 4 kind :numerical 5 describes "The mass of 1 mole of air is %{molar_mass}. Taking the ratio of specific heats of air as %{gamma}, " \ 6 "%{speed}, in m/s?" 7 given molar_mass: "29.0e-3 kg/mol" 8 given gamma: "1.4" 9 asks speed: "what is the speed of sound in air at standard temperature and pressure" 10 end
1 require_relative "../questions/the_speed_of_sound_in_air" 2 require_relative "../science/waves/speed_of_sound" 3 4 solve :the_speed_of_sound_in_air , using: SpeedOfSound do 5 objects :air 6 7 take molar_mass: air . molar_mass 8 take gamma: air . ratio_of_specific_heats 9 10 deduce_from "standard temperature and pressure" , air . temperature => "273 K" , air . pressure => "1.01e5 Pa" 11 12 speed = air . speed_of_sound 13 answer speed :, in: "m/s" , figures: 3 14 15 conclusion "Sound squeezes the air too fast for heat to flow, so the springiness is the adiabatic one, " \ 16 "γ times the pressure; Newton's guess without γ came out fifteen percent slow." 17 end
1 require_relative "../solutions/the_speed_of_sound_in_air" 2 3 play_with :the_speed_of_sound_in_air do 4 title "The Speed of Sound in Air" 5 end