question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_clamped_string_s_tension do 4 kind :numerical 5 describes "The transverse displacement of a string (clamped at its both ends) is given by y(x, t) = 0.06 sin (2π/3 x) " \ 6 "cos (120 πt) where x and y are in m and t in s. The length of the string is %{length} and its mass is " \ 7 "%{mass}. %{tension}, in newtons?" 8 given length: "1.5 m" 9 given mass: "3.0e-2 kg" 10 asks tension: "Determine the tension in the string" 11 end
1 require_relative "../questions/a_clamped_string_s_tension" 2 require_relative "../science/waves/waves_on_a_string" 3 4 solve :a_clamped_string_s_tension , using: WavesOnAString do 5 objects :string 6 7 take length: string . length_of_the_string 8 take mass: string . mass 9 10 deduce_from "sin (2π/3 x)" , string . wave_number => "120 deg/m" 11 deduce_from "cos (120 πt)" , string . angular_frequency => "60 rev/s" 12 13 tension = string . tension 14 answer tension :, in: "N" , figures: 3 15 16 conclusion "The two waves that make up the standing wave run at the speed the tension sets against the mass per " \ 17 "metre, so that speed squared times the mass per metre is the tension." 18 end
1 require_relative "../solutions/a_clamped_string_s_tension" 2 3 play_with :a_clamped_string_s_tension do 4 title "A Clamped String's Tension" 5 end