question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_coil_turned_by_a_field do 4 kind :numerical 5 describes "A %{turns} turn closely wound circular coil of radius %{radius} carries a current of %{current}. It is " \ 6 "free to turn in a uniform magnetic field of %{field}, and has turned until its axis is at %{angle} to " \ 7 "the field. %{torque}, in N m?" 8 given turns: "100" 9 given radius: "10 cm" 10 given current: "3.2 A" 11 given field: "2 T" 12 given angle: "90 deg" 13 asks torque: "What is the magnitude of the torque on the coil" 14 end
1 require_relative "../questions/a_coil_turned_by_a_field" 2 require_relative "../science/moving_charges_and_magnetism/current_loop_in_a_field" 3 4 solve :a_coil_turned_by_a_field , using: CurrentLoopInAField do 5 objects :coil 6 7 take turns: coil . turns 8 take radius: coil . radius 9 take current: coil . current 10 take field: B 11 take angle: coil . angle_to_the_field 12 13 torque = coil . torque 14 answer torque :, in: "N m" , figures: 2 15 16 conclusion "The coil is a magnet of moment turns times current times area; the field twists it hardest " \ 17 "when its axis stands across the field." 18 end
1 require_relative "../solutions/a_coil_turned_by_a_field" 2 3 play_with :a_coil_turned_by_a_field do 4 title "A Coil Turned by a Field" 5 end