question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :three_capacitors_in_parallel do 4 kind :numerical 5 describes "Three capacitors of capacitances %{first}, %{second} and %{third} are connected in parallel. " \ 6 "%{total}, in pF?" 7 given first: "2 pF" 8 given second: "3 pF" 9 given third: "4 pF" 10 asks total: "What is the total capacitance of the combination" 11 end
1 require_relative "../questions/three_capacitors_in_parallel" 2 require_relative "../science/electrostatic_potential_and_capacitance/capacitance" 3 4 solve :three_capacitors_in_parallel , using: Capacitance do 5 objects :first , :second , :third , :combination 6 7 take first: first . capacitance 8 take second: second . capacitance 9 take third: third . capacitance 10 11 deduce_from "connected in parallel" , 12 combination . capacitance => first . capacitance + second . capacitance + third . capacitance 13 14 total = combination . capacitance 15 answer total :, in: "pF" , figures: 1 16 17 conclusion "Side by side, the capacitors each hold charge at the same voltage, so their capacitances simply add." 18 end
1 require_relative "../solutions/three_capacitors_in_parallel" 2 3 play_with :three_capacitors_in_parallel do 4 title "Three Capacitors in Parallel" 5 end