Complete the code to describe the output voltage of a half-wave rectifier during the positive half-cycle.
output_voltage = input_voltage [1] 1 if input_voltage > 0 else 0
The output voltage of a half-wave rectifier is the input voltage multiplied by 1 during the positive half-cycle, and zero otherwise.
Complete the code to calculate the average output voltage of a half-wave rectifier given peak voltage Vp.
average_voltage = ([1] * Vp) / 3.1416
The average output voltage of a half-wave rectifier is (2 * Vp) / π.
Fix the error in the code calculating RMS voltage of a half-wave rectifier.
rms_voltage = Vp / [1]The RMS voltage of a half-wave rectifier is Vp / 2. Here, 2.0 is used as a divisor in the code to correct the error.
Fill both blanks to complete the expression for the output current of a half-wave rectifier given input current i_in.
i_out = i_in if i_in [1] 0 else [2]
The output current is equal to the input current when the input current is greater than zero; otherwise, it is zero because the diode blocks negative current.
Fill all three blanks to create a dictionary comprehension that maps input voltages to output voltages of a half-wave rectifier.
output_map = { [1]: [2] if [3] > 0 else 0 for [1] in input_voltages }This dictionary comprehension iterates over input voltages, assigning each voltage to the output voltage if it is positive; otherwise, zero.
