question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :an_lcr_circuit_at_its_natural_frequency do 4 kind :numerical 5 describes "A series LCR circuit with R = %{resistance}, L = %{inductance} and C = %{capacitance} is connected " \ 6 "to a variable-frequency %{supply} ac supply. When the frequency of the supply equals the natural " \ 7 "frequency of the circuit, %{power}, in watts?" 8 given resistance: "20 Ω" 9 given inductance: "1.5 H" 10 given capacitance: "35 μF" 11 given supply: "200 V" 12 asks power: "what is the average power transferred to the circuit in one complete cycle" 13 end
1 require_relative "../questions/an_lcr_circuit_at_its_natural_frequency" 2 require_relative "../science/alternating_current/series_lcr" 3 4 solve :an_lcr_circuit_at_its_natural_frequency , using: SeriesLcr do 5 objects :circuit 6 7 take resistance: circuit . resistance 8 take inductance: circuit . inductance 9 take capacitance: circuit . capacitance 10 take supply: circuit . rms_voltage 11 12 deduce_from "equals the natural frequency" , circuit . frequency => circuit . resonant_frequency 13 14 power = circuit . power_drawn 15 answer power :, in: "W" , figures: 2 16 17 conclusion "At its natural frequency the inductor and the capacitor cancel each other, so the resistance " \ 18 "alone limits the current and takes all the power." 19 end
1 require_relative "../solutions/an_lcr_circuit_at_its_natural_frequency" 2 3 play_with :an_lcr_circuit_at_its_natural_frequency do 4 title "An LCR Circuit at Its Natural Frequency" 5 end