question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_steel_wire_as_fast_as_sound do 4 kind :numerical 5 describes "A steel wire has a length of %{length} and a mass of %{mass}. %{tension} so that speed of a transverse " \ 6 "wave on the wire equals the speed of sound in dry air at 20 °C = %{speed}, in newtons?" 7 given length: "12.0 m" 8 given mass: "2.10 kg" 9 given speed: "343 m/s" 10 asks tension: "What should be the tension in the wire" 11 end
1 require_relative "../questions/a_steel_wire_as_fast_as_sound" 2 require_relative "../science/waves/waves_on_a_string" 3 4 solve :a_steel_wire_as_fast_as_sound , using: WavesOnAString do 5 objects :wire 6 7 take length: wire . length_of_the_string 8 take mass: wire . mass 9 take speed: wire . wave_speed 10 11 tension = wire . tension 12 answer tension :, in: "N" , figures: 3 13 14 conclusion "The speed goes as the square root of the tension over the mass per metre, so matching the speed " \ 15 "of sound takes the mass per metre times that speed squared." 16 end
1 require_relative "../solutions/a_steel_wire_as_fast_as_sound" 2 3 play_with :a_steel_wire_as_fast_as_sound do 4 title "A Steel Wire as Fast as Sound" 5 end