question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :the_charge_on_a_charged_sphere do 4 kind :numerical 5 describes "A uniformly charged conducting sphere of %{diameter} diameter has a surface charge density of " \ 6 "%{density}. %{charge}, in coulombs?" 7 given diameter: "2.4 m" 8 given density: "80.0 μC/m2" 9 asks charge: "Find the charge on the sphere" 10 end
1 require_relative "../questions/the_charge_on_a_charged_sphere" 2 require_relative "../science/electric_charges_and_fields/gausss_law" 3 4 solve :the_charge_on_a_charged_sphere , using: GausssLaw do 5 objects :sphere 6 7 take diameter: sphere . diameter 8 take density: sphere . surface_charge_density 9 10 charge = sphere . charge_inside 11 answer charge :, in: "C" , figures: 3 12 13 conclusion "The charge is spread evenly over the surface, so it is the charge on each square metre times the " \ 14 "area of the sphere." 15 end
1 require_relative "../solutions/the_charge_on_a_charged_sphere" 2 3 play_with :the_charge_on_a_charged_sphere do 4 title "The Charge on a Charged Sphere" 5 end