question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_spring_s_mass_at_its_fastest do 4 kind :numerical 5 describes "A spring having with a spring constant %{constant} is mounted on a horizontal table. A mass of %{mass} " \ 6 "is attached to the free end of the spring. The mass is then pulled sideways to a distance of " \ 7 "%{distance} and released. %{speed}, in m/s?" 8 given constant: "1200 N/m" 9 given mass: "3 kg" 10 given distance: "2.0 cm" 11 asks speed: "Determine the maximum speed of the mass" 12 end
1 require_relative "../questions/a_spring_s_mass_at_its_fastest" 2 require_relative "../science/oscillations/spring_oscillator" 3 4 solve :a_spring_s_mass_at_its_fastest , using: SpringOscillator do 5 objects :block 6 7 take constant: block . spring_constant 8 take mass: block . mass 9 take distance: block . amplitude 10 11 speed = block . maximum_speed 12 answer speed :, in: "m/s" , figures: 2 13 14 conclusion "All the spring's energy is the mass's motion as it passes the middle, " \ 15 "where its speed is the angular frequency times the amplitude." 16 end
1 require_relative "../solutions/a_spring_s_mass_at_its_fastest" 2 3 play_with :a_spring_s_mass_at_its_fastest do 4 title "A Spring's Mass at Its Fastest" 5 end