1require_relative "../physics"23question :a_bulb_on_the_mains do4 kind :numerical5 describes "A light bulb is rated at %{power} for a %{supply} supply. %{peak}, in volts?"6 given power: "100 W"7 given supply: "220 V"8 asks peak: "What is the peak voltage of the source"9end
1require_relative "../questions/a_bulb_on_the_mains"2require_relative "../science/alternating_current/resistor_on_ac"34solve :a_bulb_on_the_mains, using: ResistorOnAc do5 objects :bulb67 take power: bulb.power_drawn8 take supply: bulb.rms_voltage910 peak = bulb.peak_voltage11 answer peak:, in: "V", figures: 31213 conclusion "A supply is rated by its rms voltage, the steady voltage that heats a resistor as much; the " \14 "sine wave peaks higher by the square root of two."15end
1require_relative "../solutions/a_bulb_on_the_mains"23play_with :a_bulb_on_the_mains do4 title "A Bulb on the Mains"5end