question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :an_aluminium_cube_sheared do 4 kind :numerical 5 describes "The edge of an aluminium cube is %{edge} long. One face of the cube is firmly fixed to a vertical wall. " \ 6 "A mass of %{mass} is then attached to the opposite face of the cube. The shear modulus of aluminium is " \ 7 "%{modulus}. Taking g as %{gravity}, %{deflection}, in metres?" 8 given edge: "10 cm" 9 given mass: "100 kg" 10 given modulus: "25 GPa" 11 given gravity: "9.8 m/s2" 12 asks deflection: "what is the vertical deflection of this face" 13 end
1 require_relative "../questions/an_aluminium_cube_sheared" 2 require_relative "../science/mechanical_properties_of_solids/shear_modulus" 3 4 solve :an_aluminium_cube_sheared , using: ShearModulus do 5 objects :cube , :hanging_mass 6 7 take edge: cube . face_length 8 take mass: hanging_mass . mass 9 take modulus: cube . shear_modulus 10 take gravity: g 11 12 deduce_from "aluminium cube" , cube . face_width => cube . face_length , cube . height => cube . face_length 13 deduce_from "attached to the opposite face" , cube . shearing_force => hanging_mass . mass * g 14 15 deflection = cube . shift 16 answer deflection :, in: "m" , figures: 3 17 18 conclusion "The hanging weight drags the free face down along itself, a shear; aluminium is so rigid " \ 19 "that the face drops by far less than a thousandth of a millimetre." 20 end
1 require_relative "../solutions/an_aluminium_cube_sheared" 2 3 play_with :an_aluminium_cube_sheared do 4 title "An Aluminium Cube Sheared" 5 end