question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :two_parallel_wires do 4 kind :numerical 5 describes "Two long and parallel straight wires A and B carrying currents of %{current_a} and %{current_b} in the " \ 6 "same direction are separated by a distance of %{apart}. %{force}, in newtons?" 7 given current_a: "8.0 A" 8 given current_b: "5.0 A" 9 given apart: "4.0 cm" 10 asks force: "Estimate the force on a 10 cm section of wire A" 11 end
1 require_relative "../questions/two_parallel_wires" 2 require_relative "../science/moving_charges_and_magnetism/magnetic_field_of_currents" 3 require_relative "../science/moving_charges_and_magnetism/magnetic_force" 4 5 solve :two_parallel_wires , using: [ MagneticFieldOfCurrents , MagneticForce ] do 6 objects :a , :b 7 8 take current_a: a . current 9 take current_b: b . current 10 take apart: b . distance_from_the_wire 11 12 deduce_from "parallel straight wires" , B => b . field_near_a_wire 13 deduce_from "a 10 cm section of wire A" , a . length_in_the_field => "10 cm" 14 15 force = a . force_on_a_wire 16 answer force :, in: "N" , figures: 1 17 18 conclusion "Wire B's field circles it and crosses wire A square on, pushing on A's current; currents in the " \ 19 "same direction pull together." 20 end
1 require_relative "../solutions/two_parallel_wires" 2 3 play_with :two_parallel_wires do 4 title "Two Parallel Wires" 5 end