question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_bar_magnet_twisted_by_a_field do 4 kind :numerical 5 describes "A short bar magnet placed with its axis at %{angle} with a uniform external magnetic field of " \ 6 "%{field} experiences a torque of magnitude equal to %{torque}. %{moment}, in J/T?" 7 given angle: "30 deg" 8 given field: "0.25 T" 9 given torque: "4.5e-2 J" 10 asks moment: "What is the magnitude of magnetic moment of the magnet" 11 end
1 require_relative "../questions/a_bar_magnet_twisted_by_a_field" 2 require_relative "../science/moving_charges_and_magnetism/current_loop_in_a_field" 3 4 solve :a_bar_magnet_twisted_by_a_field , using: CurrentLoopInAField do 5 objects :magnet 6 7 take angle: magnet . angle_to_the_field 8 take field: B 9 take torque: magnet . torque 10 11 moment = magnet . magnetic_moment 12 answer moment :, in: "J/T" , figures: 2 13 14 conclusion "A field twists a magnet towards itself with a torque that grows with the magnet's moment and with " \ 15 "the sine of the angle between them, so a measured torque at a known angle gives the moment." 16 end
1 require_relative "../solutions/a_bar_magnet_twisted_by_a_field" 2 3 play_with :a_bar_magnet_twisted_by_a_field do 4 title "A Bar Magnet Twisted by a Field" 5 end