question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :the_flux_leaving_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}. %{flux}, in N m²/C?" 7 given diameter: "2.4 m" 8 given density: "80.0 μC/m2" 9 asks flux: "What is the total electric flux leaving the surface of the sphere" 10 end
1 require_relative "../questions/the_flux_leaving_a_charged_sphere" 2 require_relative "../science/electric_charges_and_fields/gausss_law" 3 4 solve :the_flux_leaving_a_charged_sphere , using: GausssLaw do 5 objects :sphere 6 7 take diameter: sphere . diameter 8 take density: sphere . surface_charge_density 9 10 flux = sphere . electric_flux 11 answer flux :, in: "N m2/C" , figures: 2 12 13 conclusion "The charge on the sphere is its density times its area, and by Gauss's law all of it sends its " \ 14 "flux out through the surface." 15 end
1 require_relative "../solutions/the_flux_leaving_a_charged_sphere" 2 3 play_with :the_flux_leaving_a_charged_sphere do 4 title "The Flux Leaving a Charged Sphere" 5 end