question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :two_sitar_strings_playing_ga do 4 kind :numerical 5 describes "Two sitar strings A and B playing the note ‘Ga’ are slightly out of tune and produce beats of frequency " \ 6 "%{beats}. The tension in the string A is slightly reduced and the beat frequency is found to reduce to " \ 7 "%{fewer_beats}. If the original frequency of A is %{frequency_a}, %{frequency}, in hertz?" 8 given beats: "6 Hz" 9 given fewer_beats: "3 Hz" 10 given frequency_a: "324 Hz" 11 asks frequency: "what is the frequency of B" 12 end
1 require_relative "../questions/two_sitar_strings_playing_ga" 2 require_relative "../science/waves/beats" 3 4 solve :two_sitar_strings_playing_ga , using: Beats do 5 objects :a , :b , :slackened_a 6 7 take frequency_a: a . frequency 8 take beats: a . beat_frequency ( by: b ) 9 take fewer_beats: slackened_a . beat_frequency ( by: b ) 10 11 frequency = b . frequency 12 answer frequency :, in: "Hz" 13 14 conclusion "Slackening A lowers its frequency; since the beats then slow down, A was coming down towards B " \ 15 "from above, so B lies below A." 16 end
1 require_relative "../solutions/two_sitar_strings_playing_ga" 2 3 play_with :two_sitar_strings_playing_ga do 4 title "Two Sitar Strings Playing Ga" 5 end