from math import sqrt
# Given data
I_dc=300 # in mA
C=200 # in micro F
V_max= 24 # in volt
V_r_rms= 2.4*I_dc/C # in volt
V_r_peak= sqrt(3)*V_r_rms # in volt
V_dc= V_max-V_r_peak # in volt
V_in_low= V_max-V_r_peak # in volt
print "Minimum input voltage = %0.2f volt" %V_in_low
# Given data
I_L= 0.5 # in amp
R_L=25 # in ohm
V_R=12 # in volt (since using 7812 voltage regulator)
V_L= I_L*R_L
R=V_R/I_L # in ohm
print "Resistance required = %0.f ohm" %R
V_out= V_R+V_L # in volt
print "Output voltage = %0.1f volt" %V_out
V_in= V_out+2 # in volt
print "Input voltage = %0.1f volt" %V_in
# Given data
R1= 240 # in ohm
R2= 1.2 # in kohm
R2=R2*10**3 # in ohm
V_out= 1.25*(1+R2/R1) # in volt
print "Regulated output voltage = %0.1f volt" %V_out
# Given data
R1= 40 # in ohm
I_Q= 10 # in mA
I_Q=I_Q*10**-3 # in amp
V_REF= 15 # in volt
# When R2 is set at minimum i.e.
R2= 0 # in ohm
V_out= (1+R2/R1)*V_REF + I_Q*R2 # in volt
print "Minimum output voltage = %0.f volt" %V_out
# When R2 is set at maximum i.e.
R2= 200 # in ohm
V_out= (1+R2/R1)*V_REF + I_Q*R2 # in volt
print "Minimum output voltage = %0.f volt" %V_out
# Given data
R1= 2.5 # in kohm
R1= R1*10**3 # in ohm
R2= 1 # in kohm
R2= R2*10**3 # in ohm
V_REF= 1.25 # in volt
I= V_REF/R2 # in amp
# This current also flows through R1. So the output voltage
V_out= I*(R1+R2) # in volt
print "Output voltage = %0.3f volt" %V_out
# Given data
R1= 3 # in kohm
R1= R1*10**3 # in ohm
R2= 1 # in kohm
R2= R2*10**3 # in ohm
V_REF= 1.25 # in volt
V_in=20 # in volt
V_out= V_REF*(R1+R2)/R2 # in volt
D=V_out/V_in*100 # in percent
print "Duty cycle = %0.f %%" %D