question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_square_coil_in_a_field do 4 kind :numerical 5 describes "A square coil of side 10 cm consists of %{turns} turns and carries a current of %{current}. The coil " \ 6 "is suspended vertically and the normal to the plane of the coil makes an angle of %{angle} with the " \ 7 "direction of a uniform horizontal magnetic field of magnitude %{field}. %{torque}, in N m?" 8 given turns: "20" 9 given current: "12 A" 10 given angle: "30 deg" 11 given field: "0.80 T" 12 asks torque: "What is the magnitude of torque experienced by the coil" 13 end
1 require_relative "../questions/a_square_coil_in_a_field" 2 require_relative "../science/moving_charges_and_magnetism/current_loop_in_a_field" 3 4 solve :a_square_coil_in_a_field , using: CurrentLoopInAField do 5 objects :coil 6 7 take turns: coil . turns 8 take current: coil . current 9 take angle: coil . angle_to_the_field 10 take field: B 11 12 deduce_from "A square coil of side 10 cm" , coil . area => "100 cm2" 13 14 torque = coil . torque 15 answer torque :, in: "N m" , figures: 2 16 17 conclusion "A coil's magnetic moment is its turns times its current times its area, whatever its shape, and " \ 18 "the field turns it with the sine of the angle between the moment and the field." 19 end
1 require_relative "../solutions/a_square_coil_in_a_field" 2 3 play_with :a_square_coil_in_a_field do 4 title "A Square Coil in a Field" 5 end