question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_bar_magnet_turned_across_a_field do 4 kind :numerical 5 describes "A bar magnet of magnetic moment %{moment} lies aligned with the direction of a uniform magnetic " \ 6 "field of %{field}. An external torque turns the magnet so as to align its magnetic moment normal to " \ 7 "the field direction. %{torque}, in N m?" 8 given moment: "1.5 J/T" 9 given field: "0.22 T" 10 asks torque: "What is the torque on the magnet in this position" 11 end
1 require_relative "../questions/a_bar_magnet_turned_across_a_field" 2 require_relative "../science/moving_charges_and_magnetism/current_loop_in_a_field" 3 4 solve :a_bar_magnet_turned_across_a_field , using: CurrentLoopInAField do 5 objects :magnet 6 7 take moment: magnet . magnetic_moment 8 take field: B 9 10 deduce_from "normal to the field direction" , magnet . angle_to_the_field => "90 deg" 11 12 torque = magnet . torque 13 answer torque :, in: "N m" , figures: 2 14 15 conclusion "Square across the field the magnet feels the largest twist the field can give it, the moment " \ 16 "times the field." 17 end
1 require_relative "../solutions/a_bar_magnet_turned_across_a_field" 2 3 play_with :a_bar_magnet_turned_across_a_field do 4 title "A Bar Magnet Turned across a Field" 5 end