question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_wire_s_tension_in_its_fundamental_mode do 4 kind :numerical 5 describes "A wire stretched between two rigid supports vibrates in its fundamental mode with a frequency of " \ 6 "%{frequency}. The mass of the wire is %{mass} and its linear mass density is %{density}. %{tension}, " \ 7 "in newtons?" 8 given frequency: "45 Hz" 9 given mass: "3.5e-2 kg" 10 given density: "4.0e-2 kg/m" 11 asks tension: "What is the tension in the string" 12 end
1 require_relative "../questions/a_wire_s_tension_in_its_fundamental_mode" 2 require_relative "../science/waves/waves_on_a_string" 3 4 solve :a_wire_s_tension_in_its_fundamental_mode , using: WavesOnAString do 5 objects :wire 6 7 take frequency: wire . frequency 8 take mass: wire . mass 9 take density: wire . linear_mass_density 10 11 deduce_from "fundamental mode" , wire . harmonic => 1 12 13 tension = wire . tension 14 answer tension :, in: "N" , figures: 3 15 16 conclusion "In the fundamental mode the wire's length is half a wavelength, which fixes how fast the wave " \ 17 "runs; the tension is the mass per metre times that speed squared." 18 end
1 require_relative "../solutions/a_wire_s_tension_in_its_fundamental_mode" 2 3 play_with :a_wire_s_tension_in_its_fundamental_mode do 4 title "A Wire's Tension in Its Fundamental Mode" 5 end