question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_pipe_open_at_both_ends do 4 kind :numerical 5 describes "A pipe, %{length} long, is open at both ends. Taking the speed of sound in air as %{speed}, " \ 6 "%{harmonic} a %{source} source?" 7 given length: "30.0 cm" 8 given speed: "330 m/s" 9 given source: "1.1 kHz" 10 asks harmonic: "which harmonic mode of the pipe resonates" 11 end
1 require_relative "../questions/a_pipe_open_at_both_ends" 2 require_relative "../science/waves/standing_waves" 3 4 solve :a_pipe_open_at_both_ends , using: StandingWaves do 5 objects :pipe 6 7 take length: pipe . length_of_the_pipe 8 take speed: v 9 take source: pipe . frequency 10 11 harmonic = pipe . harmonic 12 answer harmonic :, figures: 2 13 14 conclusion "An open pipe sounds every whole multiple of its fundamental, the speed over twice its " \ 15 "length; the source is twice that fundamental." 16 end
1 require_relative "../solutions/a_pipe_open_at_both_ends" 2 3 play_with :a_pipe_open_at_both_ends do 4 title "A Pipe Open at Both Ends" 5 end