question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_wire_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}. %{speed}, " \ 7 "in m/s?" 8 given frequency: "45 Hz" 9 given mass: "3.5e-2 kg" 10 given density: "4.0e-2 kg/m" 11 asks speed: "What is the speed of a transverse wave on the string" 12 end
1 require_relative "../questions/a_wire_in_its_fundamental_mode" 2 require_relative "../science/waves/waves_on_a_string" 3 4 solve :a_wire_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 speed = wire . wave_speed 14 answer speed :, in: "m/s" , figures: 2 15 16 conclusion "The mass and the mass per metre give the wire's length; in the fundamental mode that length is " \ 17 "half a wavelength, and the wave runs one wavelength each period." 18 end
1 require_relative "../solutions/a_wire_in_its_fundamental_mode" 2 3 play_with :a_wire_in_its_fundamental_mode do 4 title "A Wire in Its Fundamental Mode" 5 end