question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_coil_of_a_hundred_small_turns do 4 kind :numerical 5 describes "A circular coil of wire consisting of %{turns} turns, each of radius %{radius} carries a current of " \ 6 "%{current}. %{field}, in teslas?" 7 given turns: "100" 8 given radius: "8.0 cm" 9 given current: "0.40 A" 10 asks field: "What is the magnitude of the magnetic field B at the centre of the coil" 11 end
1 require_relative "../questions/a_coil_of_a_hundred_small_turns" 2 require_relative "../science/moving_charges_and_magnetism/magnetic_field_of_currents" 3 4 solve :a_coil_of_a_hundred_small_turns , using: MagneticFieldOfCurrents do 5 objects :coil 6 7 take turns: coil . turns 8 take radius: coil . radius 9 take current: coil . current 10 11 field = coil . field_at_the_centre 12 answer field :, in: "T" , figures: 2 13 14 conclusion "Every turn adds its own field at the centre, so the field grows with the turns and the current " \ 15 "and falls as the coil gets wider." 16 end
1 require_relative "../solutions/a_coil_of_a_hundred_small_turns" 2 3 play_with :a_coil_of_a_hundred_small_turns do 4 title "A Coil of a Hundred Small Turns" 5 end