question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_charge_above_a_square do 4 kind :numerical 5 describes "A point charge %{charge} is a distance 5 cm directly above the centre of a square of side 10 cm. " \ 6 "%{flux}? (Hint: Think of the square as one face of a cube with edge 10 cm.)" 7 given charge: "10 μC" 8 asks flux: "What is the magnitude of the electric flux through the square, in N m²/C" 9 end
1 require_relative "../questions/a_charge_above_a_square" 2 require_relative "../science/electric_charges_and_fields/gausss_law" 3 4 solve :a_charge_above_a_square , using: GausssLaw do 5 objects :square , :cube 6 7 take charge: cube . charge_inside 8 9 deduce_from "one face of a cube" , square . electric_flux => cube . electric_flux / 6 10 11 flux = square . electric_flux 12 answer flux :, in: "N m2/C" , figures: 3 13 14 conclusion "The charge sits at the centre of a cube with the square as one face, so the flux through the cube " \ 15 "shares out equally among its six faces." 16 end
1 require_relative "../solutions/a_charge_above_a_square" 2 3 play_with :a_charge_above_a_square do 4 title "A Charge Above a Square" 5 end