question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_steel_wire_under_tension do 4 kind :numerical 5 describes "A steel wire %{length} long has a mass of %{mass}. If the wire is under a tension of %{tension}, " \ 6 "%{speed}, in m/s?" 7 given length: "0.72 m" 8 given mass: "5.0e-3 kg" 9 given tension: "60 N" 10 asks speed: "what is the speed of transverse waves on the wire" 11 end
1 require_relative "../questions/a_steel_wire_under_tension" 2 require_relative "../science/waves/waves_on_a_string" 3 4 solve :a_steel_wire_under_tension , using: WavesOnAString do 5 objects :wire 6 7 take length: wire . length_of_the_string 8 take mass: wire . mass 9 take tension: wire . tension 10 11 speed = wire . wave_speed 12 answer speed :, in: "m/s" , figures: 2 13 14 conclusion "Tension pulls a disturbance along and the wire's mass per metre holds it back; the speed is " \ 15 "the square root of their ratio." 16 end
1 require_relative "../solutions/a_steel_wire_under_tension" 2 3 play_with :a_steel_wire_under_tension do 4 title "A Steel Wire Under Tension" 5 end