question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_dipole_at_thirty_degrees do 4 kind :numerical 5 describes "An electric dipole with dipole moment %{moment} is aligned at %{angle} with the direction of a uniform " \ 6 "electric field of magnitude %{field}. %{torque}, in N m?" 7 given moment: "4e-9 C m" 8 given angle: "30 deg" 9 given field: "5e4 N/C" 10 asks torque: "What is the magnitude of the torque acting on the dipole" 11 end
1 require_relative "../questions/a_dipole_at_thirty_degrees" 2 require_relative "../science/electrostatic_potential_and_capacitance/dipole_in_a_field" 3 4 solve :a_dipole_at_thirty_degrees , using: DipoleInAField do 5 objects :dipole 6 7 take moment: dipole . dipole_moment 8 take angle: dipole . angle_to_the_field 9 take field: E 10 11 torque = dipole . torque 12 answer torque :, in: "N m" , figures: 1 13 14 conclusion "The field pulls the two charges of the dipole opposite ways, turning it toward the field; the " \ 15 "turning grows with the sine of the angle between them." 16 end
1 require_relative "../solutions/a_dipole_at_thirty_degrees" 2 3 play_with :a_dipole_at_thirty_degrees do 4 title "A Dipole at Thirty Degrees" 5 end