question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :an_lcr_circuit_s_power do 4 kind :numerical 5 describes "A sinusoidal voltage of peak value %{peak} and frequency %{frequency} is applied to a series LCR " \ 6 "circuit in which R = %{resistance}, L = %{inductance} and C = %{capacitance}. %{power}, in watts?" 7 given peak: "283 V" 8 given frequency: "50 Hz" 9 given resistance: "3 Ω" 10 given inductance: "25.48 mH" 11 given capacitance: "796 μF" 12 asks power: "What is the power dissipated in the circuit" 13 end
1 require_relative "../questions/an_lcr_circuit_s_power" 2 require_relative "../science/alternating_current/series_lcr" 3 4 solve :an_lcr_circuit_s_power , using: SeriesLcr do 5 objects :circuit 6 7 take peak: circuit . peak_voltage 8 take frequency: circuit . frequency 9 take resistance: circuit . resistance 10 take inductance: circuit . inductance 11 take capacitance: circuit . capacitance 12 13 power = circuit . power_drawn 14 answer power :, in: "W" , figures: 2 15 16 conclusion "Only the resistance spends power; the inductor and the capacitor store energy and hand it back each cycle." 17 end
1 require_relative "../solutions/an_lcr_circuit_s_power" 2 3 play_with :an_lcr_circuit_s_power do 4 title "An LCR Circuit's Power" 5 end