question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :sharing_a_charge do 4 kind :numerical 5 describes "A %{capacitance} capacitor is charged by a %{battery} battery. It is disconnected from the battery and " \ 6 "connected to another uncharged %{other} capacitor. %{energy}, in joules?" 7 given capacitance: "900 pF" 8 given battery: "100 V" 9 given other: "900 pF" 10 asks energy: "What is the electrostatic energy stored by the system" 11 end
1 require_relative "../questions/sharing_a_charge" 2 require_relative "../science/electrostatic_potential_and_capacitance/capacitance" 3 4 solve :sharing_a_charge , using: Capacitance do 5 objects :charged , :other , :joined 6 7 take capacitance: charged . capacitance 8 take battery: charged . voltage 9 take other: other . capacitance 10 11 deduce_from "connected to another" , joined . capacitance => charged . capacitance + other . capacitance 12 deduce_from "disconnected from the battery" , joined . charge => charged . charge 13 14 energy = joined . energy_stored 15 answer energy :, in: "J" , figures: 2 16 17 conclusion "The charge spreads over twice the capacitance at half the voltage, so only half the energy " \ 18 "is left; the rest is lost as the charge rushes across." 19 end
1 require_relative "../solutions/sharing_a_charge" 2 3 play_with :sharing_a_charge do 4 title "Sharing a Charge" 5 end