question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :four_capacitors_on_500_volts do 4 kind :numerical 5 describes "A network of four %{each} capacitors is connected to a %{supply} supply: three of them in series, and " \ 6 "the fourth across that row. %{equivalent}, in μF?" 7 given each: "10 μF" 8 given supply: "500 V" 9 asks equivalent: "What is the equivalent capacitance of the network" 10 end
1 require_relative "../questions/four_capacitors_on_500_volts" 2 require_relative "../science/electrostatic_potential_and_capacitance/capacitance" 3 4 solve :four_capacitors_on_500_volts , using: Capacitance do 5 objects :one , :row , :network 6 7 take each: one . capacitance 8 take supply: network . voltage 9 10 deduce_from "three of them in series" , row . capacitance => 1 / ( 3 / one . capacitance ) 11 deduce_from "the fourth across that row" , network . capacitance => row . capacitance + one . capacitance 12 13 equivalent = network . capacitance 14 answer equivalent :, in: "μF" , figures: 3 15 16 conclusion "In series the capacitances add as reciprocals, so the row of three holds a third as much; " \ 17 "across it, the fourth simply adds." 18 end
1 require_relative "../solutions/four_capacitors_on_500_volts" 2 3 play_with :four_capacitors_on_500_volts do 4 title "Four Capacitors on 500 Volts" 5 end