question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :the_resistivity_of_a_wire do 4 kind :numerical 5 describes "A negligibly small current is passed through a wire of length %{length} and uniform cross-section " \ 6 "%{area}, and its resistance is measured to be %{resistance}. %{resistivity}, in Ω m?" 7 given length: "15 m" 8 given area: "6.0e-7 m2" 9 given resistance: "5.0 Ω" 10 asks resistivity: "What is the resistivity of the material at the temperature of the experiment" 11 end
1 require_relative "../questions/the_resistivity_of_a_wire" 2 require_relative "../science/current_electricity/ohms_law" 3 4 solve :the_resistivity_of_a_wire , using: OhmsLaw do 5 objects :wire 6 7 take length: wire . length_of_the_conductor 8 take area: wire . cross_section 9 take resistance: wire . resistance 10 11 resistivity = wire . resistivity 12 answer resistivity :, in: "Ω m" , figures: 2 13 14 conclusion "Resistance grows with length and shrinks with cross-section; what is left over belongs to the " \ 15 "material alone." 16 end
1 require_relative "../solutions/the_resistivity_of_a_wire" 2 3 play_with :the_resistivity_of_a_wire do 4 title "The Resistivity of a Wire" 5 end