question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :first_at_half_the_amplitude do 4 kind :numerical 5 describes "A particle moves in simple harmonic motion with amplitude %{amplitude} and period %{period}. It is " \ 6 "released from rest at its positive extreme. %{time} %{position} from the centre, in seconds?" 7 given amplitude: "10 cm" 8 given period: "2 s" 9 given position: "5 cm" 10 asks time: "How long after release is it first" 11 end
1 require_relative "../questions/first_at_half_the_amplitude" 2 require_relative "../science/oscillations/simple_harmonic_motion" 3 require_relative "../science/oscillations/periodic_motion" 4 5 solve :first_at_half_the_amplitude , using: [ SimpleHarmonicMotion , PeriodicMotion ] do 6 objects :particle 7 particle . goes ( :swinging ) 8 9 take amplitude: particle . amplitude , period: particle . period , position: particle . final_position 10 deduce_from "released from rest at its positive extreme" , particle . phase_constant => "0 rad" 11 deduce_from "after release is it first" , swinging . time_taken => :smallest 12 take time: swinging . time_taken 13 answer find_value ( :time , in: "s" , figures: 3 ) 14 15 conclusion "The particle passes the same point twice in every period, so many times fit; the first is a sixth " \ 16 "of a period after release, since the cosine falls to a half at a sixth of a turn." 17 end
1 require_relative "../solutions/first_at_half_the_amplitude" 2 3 play_with :first_at_half_the_amplitude do 4 title "First at Half the Amplitude" 5 end