question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_solenoid_of_five_layers do 4 kind :numerical 5 describes "A closely wound solenoid %{length} long has 5 layers of windings of 400 turns each. The diameter of the " \ 6 "solenoid is 1.8 cm. If the current carried is %{current}, %{field}, in teslas?" 7 given length: "80 cm" 8 given current: "8.0 A" 9 asks field: "estimate the magnitude of B inside the solenoid near its centre" 10 end
1 require_relative "../questions/a_solenoid_of_five_layers" 2 require_relative "../science/moving_charges_and_magnetism/magnetic_field_of_currents" 3 4 solve :a_solenoid_of_five_layers , using: MagneticFieldOfCurrents do 5 objects :solenoid 6 7 take length: solenoid . length_of_the_coil 8 take current: solenoid . current 9 10 deduce_from "5 layers of windings of 400 turns each" , solenoid . turns => 2000 11 12 field = solenoid . field_inside 13 answer field :, in: "T" , figures: 2 14 15 conclusion "Inside a long solenoid the field depends only on the turns on each metre and the current, not on " \ 16 "how wide the solenoid is." 17 end
1 require_relative "../solutions/a_solenoid_of_five_layers" 2 3 play_with :a_solenoid_of_five_layers do 4 title "A Solenoid of Five Layers" 5 end