question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :five_millihenries_twenty_microfarads_and_a_hundred_twenty_ohms_resonating do 4 kind :numerical 5 describes "An L-C-R series circuit with L = %{inductance}, C = %{capacitance}, R = %{resistance} is connected to " \ 6 "an AC source. %{resonance} (take π² = 10), in hertz?" 7 given inductance: "5 mH" 8 given capacitance: "20 μF" 9 given resistance: "120 Ω" 10 asks resonance: "The resonant frequency of the circuit is" 11 end
1 require_relative "../questions/five_millihenries_twenty_microfarads_and_a_hundred_twenty_ohms_resonating" 2 require_relative "../science/alternating_current/series_lcr" 3 4 solve :five_millihenries_twenty_microfarads_and_a_hundred_twenty_ohms_resonating , using: SeriesLcr do 5 objects :circuit 6 7 deduce_from "take π² = 10" , pi ** 2 == 10 8 9 take inductance: circuit . inductance , capacitance: circuit . capacitance , resistance: circuit . resistance 10 11 resonance = circuit . resonant_frequency 12 answer resonance :, in: "Hz" , figures: 3 13 14 conclusion "The reactances cancel where 2πfL = 1/(2πfC), at f = 1/(2π√(LC)). With π² taken as 10, " \ 15 "2π√(LC) = 2√(10 × 5 × 10⁻³ × 20 × 10⁻⁶) = 2 × 10⁻³ s, so f = 500 Hz." 16 end
1 require_relative "../solutions/five_millihenries_twenty_microfarads_and_a_hundred_twenty_ohms_resonating" 2 3 play_with :five_millihenries_twenty_microfarads_and_a_hundred_twenty_ohms_resonating do 4 title "Five Millihenries Twenty Microfarads And A Hundred Twenty Ohms Resonating" 5 end