question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_spring_s_mass_at_its_hardest_pull 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. %{acceleration}, in m/s²?" 8 given constant: "1200 N/m" 9 given mass: "3 kg" 10 given distance: "2.0 cm" 11 asks acceleration: "Determine the maximum acceleration of the mass" 12 end
1 require_relative "../questions/a_spring_s_mass_at_its_hardest_pull" 2 require_relative "../science/oscillations/spring_oscillator" 3 4 solve :a_spring_s_mass_at_its_hardest_pull , 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 acceleration = block . maximum_acceleration 12 answer acceleration :, in: "m/s2" , figures: 2 13 14 conclusion "The spring pulls hardest where it is stretched most, at the ends of the swing, " \ 15 "and there the acceleration is the angular frequency squared times the amplitude." 16 end
1 require_relative "../solutions/a_spring_s_mass_at_its_hardest_pull" 2 3 play_with :a_spring_s_mass_at_its_hardest_pull do 4 title "A Spring's Mass at Its Hardest Pull" 5 end