question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_sphere_with_an_inward_field do 4 kind :numerical 5 describes "A conducting sphere of radius 10 cm has an unknown charge. If the electric field %{distance} from the " \ 6 "centre of the sphere is %{field} and points radially inward, %{charge}, in nC?" 7 given distance: "20 cm" 8 given field: "1.5e3 N/C" 9 asks charge: "what is the net charge on the sphere" 10 end
1 require_relative "../questions/a_sphere_with_an_inward_field" 2 require_relative "../science/electric_charges_and_fields/electric_field" 3 4 solve :a_sphere_with_an_inward_field , using: ElectricField do 5 objects :sphere , :point 6 7 take distance: point . separation ( from: sphere ) 8 take field: E 9 10 deduce_from "points radially inward" , point . field_of_a_charge ( by: sphere ) => - E 11 12 charge = sphere . charge 13 answer charge :, in: "nC" , figures: 3 14 15 conclusion "Outside a charged sphere the field is as if all the charge sat at its centre; a field pointing " \ 16 "inward means the charge is negative." 17 end
1 require_relative "../solutions/a_sphere_with_an_inward_field" 2 3 play_with :a_sphere_with_an_inward_field do 4 title "A Sphere with an Inward Field" 5 end