question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_locomotive_piston do 4 kind :numerical 5 describes "The piston in the cylinder head of a locomotive has a stroke (twice the amplitude) of %{stroke}. If the " \ 6 "piston moves with simple harmonic motion with an angular frequency of %{angular_frequency}, %{speed}, " \ 7 "in m/s?" 8 given stroke: "1.0 m" 9 given angular_frequency: "200 rad/min" 10 asks speed: "what is its maximum speed" 11 end
1 require_relative "../questions/a_locomotive_piston" 2 require_relative "../science/oscillations/simple_harmonic_motion" 3 4 solve :a_locomotive_piston , using: SimpleHarmonicMotion do 5 objects :piston 6 7 take stroke: piston . stroke 8 take angular_frequency: piston . angular_frequency 9 10 speed = piston . maximum_speed 11 answer speed :, in: "m/s" , figures: 2 12 13 conclusion "The piston moves fastest through the middle of its stroke, at the angular frequency times half " \ 14 "the stroke." 15 end
1 require_relative "../solutions/a_locomotive_piston" 2 3 play_with :a_locomotive_piston do 4 title "A Locomotive Piston" 5 end