question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :east_of_a_wire_running_south do 4 kind :numerical 5 describes "A long straight wire in the horizontal plane carries a current of %{current} in north to south " \ 6 "direction. %{field} at a point %{distance} east of the wire, in teslas?" 7 given current: "50 A" 8 given distance: "2.5 m" 9 asks field: "What is the magnitude of B" 10 end
1 require_relative "../questions/east_of_a_wire_running_south" 2 require_relative "../science/moving_charges_and_magnetism/magnetic_field_of_currents" 3 4 solve :east_of_a_wire_running_south , using: MagneticFieldOfCurrents do 5 objects :wire 6 7 take current: wire . current 8 take distance: wire . distance_from_the_wire 9 10 field = wire . field_near_a_wire 11 answer field :, in: "T" , figures: 1 12 13 conclusion "The field circles the wire; by the right-hand rule, with the current running south, it points " \ 14 "upward on the east side." 15 end
1 require_relative "../solutions/east_of_a_wire_running_south" 2 3 play_with :east_of_a_wire_running_south do 4 title "East of a Wire Running South" 5 end