question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_coil_of_a_hundred_turns do 4 kind :numerical 5 describes "Consider a tightly wound %{turns}-turn coil of radius %{radius}, carrying a current of %{current}. " \ 6 "%{field}, in teslas?" 7 given turns: "100" 8 given radius: "10 cm" 9 given current: "1 A" 10 asks field: "What is the magnitude of the magnetic field at the centre of the coil" 11 end
1 require_relative "../questions/a_coil_of_a_hundred_turns" 2 require_relative "../science/moving_charges_and_magnetism/magnetic_field_of_currents" 3 4 solve :a_coil_of_a_hundred_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: 3 13 14 conclusion "Every turn adds its own field at the centre, each the current over twice the radius times μ₀." 15 end
1 require_relative "../solutions/a_coil_of_a_hundred_turns" 2 3 play_with :a_coil_of_a_hundred_turns do 4 title "A Coil of a Hundred Turns" 5 end