question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :an_ultrasonic_scanner do 4 kind :numerical 5 describes "A hospital uses an ultrasonic scanner to locate tumours in a tissue. The operating frequency of the " \ 6 "scanner is %{frequency}. %{wavelength} in which the speed of sound is %{speed}, in metres?" 7 given speed: "1.7 km/s" 8 given frequency: "4.2 MHz" 9 asks wavelength: "What is the wavelength of sound in the tissue" 10 end
1 require_relative "../questions/an_ultrasonic_scanner" 2 require_relative "../science/waves/travelling_wave" 3 4 solve :an_ultrasonic_scanner , using: TravellingWave do 5 objects :sound 6 7 take speed: sound . wave_speed 8 take frequency: sound . frequency 9 10 wavelength = sound . wavelength 11 answer wavelength :, in: "m" , figures: 2 12 13 conclusion "Each wave travels one wavelength in one period, so the wavelength is the speed in the tissue over " \ 14 "the frequency of the scanner." 15 end
1 require_relative "../solutions/an_ultrasonic_scanner" 2 3 play_with :an_ultrasonic_scanner do 4 title "An Ultrasonic Scanner" 5 end