question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :eighteen_centimetres_from_a_charged_sphere do 4 kind :numerical 5 describes "A spherical conductor of radius 12 cm has a charge of %{charge} distributed uniformly on its surface. " \ 6 "%{field} at a point %{distance} from the centre of the sphere, in N/C?" 7 given charge: "1.6e-7 C" 8 given distance: "18 cm" 9 asks field: "What is the electric field" 10 end
1 require_relative "../questions/eighteen_centimetres_from_a_charged_sphere" 2 require_relative "../science/electric_charges_and_fields/electric_field" 3 4 solve :eighteen_centimetres_from_a_charged_sphere , using: ElectricField do 5 objects :sphere , :point 6 7 take charge: sphere . charge 8 take distance: point . separation ( from: sphere ) 9 10 field = point . field_of_a_charge ( by: sphere ) 11 answer field :, in: "N/C" , figures: 2 12 13 conclusion "Outside the sphere its charge acts as if gathered at the centre, so the field falls off as the " \ 14 "square of the distance from there." 15 end
1 require_relative "../solutions/eighteen_centimetres_from_a_charged_sphere" 2 3 play_with :eighteen_centimetres_from_a_charged_sphere do 4 title "Eighteen Centimetres from a Charged Sphere" 5 end