question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_steel_rod_stretched do 4 kind :numerical 5 describes "A structural steel rod has a radius of %{radius} and a length of %{length}. A %{force} force stretches " \ 6 "it along its length. Young's modulus of structural steel is %{modulus}. %{elongation}, in mm?" 7 given radius: "10 mm" 8 given length: "1.0 m" 9 given force: "100e3 N" 10 given modulus: "2.0e11 N/m2" 11 asks elongation: "What is the elongation of the rod" 12 end
1 require_relative "../questions/a_steel_rod_stretched" 2 require_relative "../science/mechanical_properties_of_solids/youngs_modulus" 3 4 solve :a_steel_rod_stretched , using: YoungsModulus do 5 objects :rod 6 7 take radius: rod . thickness 8 take length: rod . original_length 9 take force: rod . load 10 take modulus: rod . youngs_modulus 11 12 elongation = rod . extension 13 answer elongation :, in: "mm" , figures: 3 14 15 conclusion "The force spread over the rod's cross-section is the stress; steel answers it with a " \ 16 "strain of stress over Young's modulus, and the stretch is that strain of the length." 17 end
1 require_relative "../solutions/a_steel_rod_stretched" 2 3 play_with :a_steel_rod_stretched do 4 title "A Steel Rod Stretched" 5 end