question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :near_a_long_straight_wire do 4 kind :numerical 5 describes "A long straight wire carries a current of %{current}. %{field} at a point %{distance} from the wire, " \ 6 "in teslas?" 7 given current: "35 A" 8 given distance: "20 cm" 9 asks field: "What is the magnitude of the field B" 10 end
1 require_relative "../questions/near_a_long_straight_wire" 2 require_relative "../science/moving_charges_and_magnetism/magnetic_field_of_currents" 3 4 solve :near_a_long_straight_wire , 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: 2 12 13 conclusion "The field circles a long straight wire and weakens in step with the distance from it." 14 end
1 require_relative "../solutions/near_a_long_straight_wire" 2 3 play_with :near_a_long_straight_wire do 4 title "Near a Long Straight Wire" 5 end