#Caption:Calculate (a)Resistance (b)Forward Current (c)Power dissipation (d)Peak Reverse Voltage
e=50.#Input voltage(in volts)
i=20.#Output Current(in mA)
v=0.5#Output voltage(in volts)
ir=5.#Reverse Leakage Current(in micro ampere)
vf=0.7#Forward voltage of diode(in volts)
R=v*1000./ir
print '%s %.f' %('(a)Resistance(in Kilo ohm)=',R)
I=(e-vf)/R
P=(e**2.)/R
ep=-e
print '%s %.f' %('(b)Diode Peak Reverse Voltage(in volts)=',ep)
i=i+I
print '%s %.1f' %('(c)Diode Forward Current(in mA)=',i)
p=vf*i
print '%s %.2f' %('(d)Diode Power Dissipation(in mW)=',p)
#Caption:Calculate resistance and amplitude of output signal
E=2.#Input voltage(in volts)
v=0.5#Input noise voltage(in volts)
Vf=0.7#Forward diode voltage(in volts)
i=1.#Forward current of diode(in mA)
V=E-Vf
R=V/i
print '%s %.1f %s %.1f' %('Output signal amplitude(in volts)=',V,'\nResistance(in kilo ohm)=',R)
#Caption:Calculate Resistance and diode forward current
E=10.#Input voltage(in volts)
v=9.#Output voltage(in volts)
i=1.#Output current(in mA)
vf=0.7#Diode forward voltage(in volts)
R=E-v/i
i=E-vf/R
print '%s %.f %s %.1f' %('Resistance(in kilo ohm)=',R,'\nDiode forward current(in mA)=',i)
#Caption:Calculate Resistance
V=2.7#Output voltage(in volts)
E=8.#Input voltage(in volts)
i=1.#Output current(in mA)
vf=0.7#Diode forward voltage(in volts)
i=1.#Diode forward current(in mA)
vb=V-vf
R=(E-vb-vf)/(i+i)
print '%s %.2f' %('Resistance(in kilo ohm)=',R)
#Caption:Find Zener voltage and Resistance
E=25.#Input voltage(in volts)
V=11.#Output voltage(in volts)
Vf=0.7#Forward diode voltage(in volts)
i=1.#Output current(in mA)
v=9.1#Voltage for 1N757 diode
I=20.#Current across 1N757 diode(in mA)
Vz=V-Vf
Vr=E-(Vf+v)
Iz=0.25*I
Ir=Iz+i
R=Vr/Ir
print '%s %.1f %s %.1f' %('Zener voltage(in volts)=',Vz,'\nResistance(in Kilo ohm)=',R)
#Caption:Calculate Capacitance and Resistance
E=10.#Input voltage(in volts)
f=1.#Frequency(in Khz)
Rs=500.#Source resistance(in ohms)
t=0.01#Tilt
T=1./(f)
pw=T*1000./2.
C=pw/Rs
R=pw/(t*C*1000.)
print '%s %.f %s %.f' %('Capacitance(in micro farad)=',C,'\nResistance(in kohm)=',R)
#Caption:Find Capacitance and Resistance required to design the circuit
E=20.#Input waveform amplitude(in volts)
f=2.#Frequency(in Khz)
t=0.02#Tilt
R=600.#Resistance(in ohm)
T=1./f
pw=T*1000./2.
C=pw/R
R=pw/(t*C)
print '%s %.2f %s %.f' %('Capacitance(in micro farad)=',C,'\nResistance(in kohm)=',25)
#Caption:Calculate Capacitance,Resistance and Zener Voltage
E=15.#Amplitude of input waveform(in volts)
Rs=1.#Source Resistance(in Kilo ohm)
V=9.#Output Voltage(in volts)
Vf=0.7#Diode forward voltage(in volts)
f=500.#Frequency(in hertz)
t=0.01#Tilt
T=1000./f
pw=T/2.
C=pw/Rs
R=pw/(t*C)
Vz=V-Vf
print '%s %.f %s %.f %s %.1f' %('Capacitance(in micro farad)=',C,'\nResistance(in Kilo ohm)=',R,'\nZener Voltage(in volts)=',Vz)
#Caption:Calculate Capacitance C1and C2,Diode reverse recovery time and input voltage
V=12.#Output voltage(in volts)
Vd=0.7#Diode forward voltage(in volts)
R=1.2#Load resistance(in Kilo ohm)
f=1.#Frequency(in KHz)
r=10.#Ripple in output voltage(in %)
Il=V/R
t=1000./(2.*f)
C2=(Il*t)*10.**(-3)/((r/(2.*100.))*V)
C1=(2.*Il*t)*10.**(-4)/((r/(2.*100.))*V)
trr=t/10.
Vpp=V+((r/100.)*V)+(2.*Vd)
Vp=Vpp/2.
print '%s %.2f %s %.2f %s %.f %s %.1f' %('\n C2(in micro farad)=',C2,'\n C1(in micro farad)=',C1,'\n Diode reverse recovery time(in micro sec)=',trr,'\n Input voltage(in volts)=',Vp,)