from __future__ import division
# Given data
T1 = 25 # in degree C
T2 = 100 # in degree C
del_T = T2-T1 # in degree C
V= 0.7 # barrier potential t 25°C in V
del_V = -(2)*del_T # in mV
del_V= del_V*10**-3 # in V
V_B = V- abs(del_V) # in V
print "(i) When the junction temperature is 100 °C, the barrier potential of a silicon diode = %0.2f V" %V_B
T2 = 0 # in degree C
del_T = T2-T1 # in degree C
del_V = -(2)*del_T # in mV
del_V= del_V*10**-3 #in V
V_B = V+del_V # in V
print "(ii) When the junction temperature is 0 °C, the barrier potential of a silicon diode = %0.2f V" %V_B
# Given data
T1 = 25 # in degree C
T2 = 100 # in degree C
del_T = T2-T1 # in degree C
I_S = (2)**7 *5 # in nA
I_S = (1.07)**5*I_S # in nA
print "The saturation current at 100 degree C = %0.f nA" %round(I_S)
# Given data
V_L = 10 # in V
R_L = 1*10**3 # in Ω
I_L = V_L/R_L # in A
I_L = I_L*10**3 # mA
print "The load voltage = %0.f volts" %V_L
print "The load current = %0.f mA" %I_L
# Given data
v1 = 10 # in V
v2 = 0.7 # in V
V_L = v1-v2 # in V
print "The load voltage = %0.1f V" %V_L
R_L = 1*10**3 # in Ω
I_L = V_L/R_L # in A
print "The load current = %0.1f mA" %(I_L*10**3)
P_D = v2*I_L # in watt
print "The diode Power = %0.2f mW" %(P_D*10**3)
# Given data
R_L1 = 1*10**3 # in ohm
R_L2 = 0.23 # in ohm
R_T = R_L1+R_L2 # in ohm
v1 = 10 # in V
v2 = 0.7 # in V
V_T = v1-v2 # in V
I_L = V_T/R_T # in A
print "The load current = %0.2f mA" %(I_L*10**3)
V_L = I_L*R_L1 # in V
print "The load voltage = %0.1f V" %V_L
# Given data
V_o = 0.7 # in V
print "The value of V_o = %0.1f V" %V_o
E = 10 # in V
V_D = V_o # in V
R = 330 # in ohm
I1 = (E - V_D)/R # in A
I1 = I1*10**3 # in mA
print "The value of I1 = %0.2f mA" %I1
I_D1 = I1/2 # in mA
print "The value of I_D1 = %0.2f mA" %I_D1
I_D2 = I_D1 # in mA
print "The value of I_D2 = %0.2f mA" %I_D2
# Given data
V_i = 12 # in V
V_D1 = 0.7 # in V
V_D2 = 0.3 # in V
R = 5.6*10**3 # in ohm
V_o = V_i - V_D1 - V_D2 # in V
print "The value of Vo voltage = %0.f V" %V_o
I_D = V_o/R # in A
I_D = I_D*10**3 # in mA
print "The value of I_D = %0.2f mA" %I_D
# Given data
V1 = 24 # in V
V2 = 6 # in V
V_D1 = 0.7 # in V
R = 3*10**3 # in ohm
I = (V1 - V2 - V_D1)/R # in A
I = I * 10**3 # in mA
print "The current = %0.2f mA" %I
# Given data
r= 20 # in Ω
R_B= 15 # in Ω
V_K1= 0.2 # in V
V_K2= 0.6 # in V
V= 100 # in V
R1= 10*10**3 # in Ω
# Vo= V_K1+r*I1 = V_K2+R_B*I2
# Resulting current I= I1+I2 or
# (V-Vo)/(R1) = (Vo-V_K1)/r + (Vo-V_K2)/R_B
Vo= (r*R_B*V+R1*R_B*V_K1+R1*r*V_K2)/(R1*R_B+R1*r+r*R_B) # in V
I1= (Vo-V_K1)/r # in A
I2= (V_K2-Vo)/R_B # in A
print "The value of I1 = %0.2f mA" %(I1*10**3)
print "The value of I2 = %0.2f mA" %(I2*10**3)
# Given data
I_D = 10 # in mA
I_D = I_D * 10**-3 # in A
V_D = 0.5 # in V
r_F1 = V_D/I_D # in ohm
print "The value of r_F1 = %0.f ohm" %r_F1
I_D = 20 # in mA
I_D = I_D * 10**-3 # in A
V_D = 0.8 # in V
r_F2 = V_D/I_D # in ohm
print "The value of r_F2 = %0.f ohm" %r_F2
I_D = -1 # in µA
I_D = I_D * 10**-6 # in A
V_D = -10 # in V
r_R = V_D/I_D # in ohm
print "The value of r_R = %0.f Mohm" %(r_R*10**-6)
# Note: There is calculation error to evaluate the value of r_F1. So the asnwer in the book is wrong.
# Given data
R= 5.6*10**3 # in Ω
I_D = 0 # in A
V_D = 0 # in V
E= 12 # in V
Vo= I_D*R # in V
print "The value of I_D = %0.f A" %I_D
print "The value of Vo = %0.f V" %Vo
V_D1 = 0 # in V
V_D2 = E -V_D1 - Vo # in V
print "The value of V_D2 = %0.f V" %V_D2
# Given data
E = 20 # in V
V_D1 = 0.7 # in V
V_D2 = 0.7 # in V
V2 = E - V_D1 - V_D2 # in V
R1 = 3.3*10**3 # in ohm
R2 = 5.6*10**3 # in ohm
I2 = V2/R2 # in A
I2 = I2*10**3 # in mA
print "The current through resistor R2 = %0.2f mA" %I2
I1 = V_D2/R1
I1 = I1 * 10**3 # in mA
print "The current through resistor R1 = %0.2f mA" %I1
I_D2 = I2-I1 # in mA
print "The current through diode D2 = %0.2f mA" %I_D2
# Given data
V1 = 12 # in V
V2 = 0.3 # in V
V_o = V1-V2 # in V
print "The output voltage = %0.1f V" %V_o
# Given data
print "Part (a) Analysis using approximate diode model"
V_D = 0.7 # in V
print "The value of V_D = %0.1f V" %V_D
E = 30 # in V
V_R = E-V_D # in V
print "The value of V_R = %0.1f V" %V_R
R = 2.2 * 10**3 # in ohm
I_D = V_R/R
I_D = I_D * 10**3 # in mA
print "The value of I_D = %0.2f mA" %I_D
print "Part (b) Analysis using ideal diode model"
V_D = 0 # in V
print "The value of V_D = %0.f V" %V_D
V_R = E # in V
print "The value of V_R = %0.f V" %V_R
I_D = V_R/R
I_D = I_D * 10**3 # in mA
print "The value of I_D = %0.2f mA" %I_D
# Given data
V1 = 20 # in V
V2 = 0.7 # in V
V = V1-V2 # in V
R = 20 # in ohm
I = V/R # in A
print "The current through resistance = %0.3f A" %I
# Given data
R1= 2 # in kΩ
R2= 2 # in kΩ
V=19 # in V
V_o = (V*R1)/(R1+R2) # in V
print "The output voltage = %0.1f V" %V_o
# Given data
V1 = 0.7 # in V
V2 = 5 # in V
V_o = V1-V2 # in V
R = 2.2*10**3 # in ohm
I_D = -V_o/R
I_D = I_D * 10**3 # in mA
print "The output voltage = %0.1f volts" %V_o
print "The current through diode = %0.2f mA" %I_D
# Given data
V_gamma = 0.7 # in V
R1 = 5*10**3 # in ohm
R2 = 10*10**3 # in ohm
V=5 # in V
print "Part (a)"
I_R2 = (V-V_gamma-(-V))/(R1+R2) # in A
I_D2 = I_R2 # in A
print "The value of I_D1 and I_D2 = %0.2f mA" %(I_D2*10**3)
V_o = V - (I_D2 * R1) # in V
print "The value of Vo = %0.1f V" %V_o
V_A = V_o - V_gamma # in V
print "The value of V_A = %0.1f V" %V_A
print "Part (b)"
V_I = 4 # in V
V_A= V_I-V_gamma # in V
Vo= V_A+V_gamma # in V
I_R1= (V-Vo)/R1 # in A
I_D2= I_R1 # in A
print "The value of I_D2 = %0.1f mA" %(I_D2*10**3)
I_R2= (V_A-(-V))/R2 # in A
I_D1= I_R2-I_R1 # in A
print "The value of I_D1 = %0.2f mA" %(I_D1*10**3)
print "The value of Vo = %0.f volts" %Vo
# Given data
V_S = 6 # in V
V_D = 0.7 # in V
R = 10 # in K ohm
R = R*10**3 # in ohm
I_T = (V_S-V_D)/R # in A
print "The total current = %0.f µA" %(I_T*10**6)
# Given data
V_S = 5 # in V
V_D = 0.7 # in V
R1 = 1.2 * 10**3 # in ohm
R2 = 2.2 * 10**3 # in ohm
I_T = (V_S-V_D)/(R1+R2)
I_T = I_T * 10**3 # in mA
print "The total circuit current = %0.2f mA" %I_T
# Given data
V_S = 4 # in V
V_D1 = 0.7 # in V
V_D2 = 0.7 # in V
R = 5.1*10**3 # in ohm
I_T = (V_S-V_D1-V_D2)/R # in A
print "The total current = %0.f µA" %round(I_T*10**6)
# Given data
V_S = 10 # in V
R1 = 1.5*10**3 # in ohm
R2 = 1.8*10**3 # in ohm
I_T = V_S/(R1+R2) # in A
print "Using the ideal diode, the total current = %0.2f mA" %(I_T*10**3)
V_D1 = 0.7 # in V
V_D2 = 0.7 # in V
I_T = (V_S-V_D1-V_D2)/(R1+R2) # in A
print "Using the pracitcal diode, the total current = %0.2f mA" %(I_T*10**3)
# Given data
V_S = 5 # in V
V2 = 3 # in V
R = 500 # in ohm
I_D2 = (V_S-V2)/R # in A
I_D2 = I_D2 * 10**3 # in mA
print "The diode current = %0.f mA" %I_D2
# Given data
V_S = 2 # in V
R = 100 # in ohm
I_D = V_S/R
I_D = I_D * 10**3 # in mA
print "Part (a)"
print "The diode current = %0.f mA" %I_D
V_K = 0.7 # in V
I_D1 = (V_S-V_K)/R
I_D1 = I_D1*10**3 # in mA
print "Part (b)"
print "The diode current = %0.f mA" %I_D1
R_f = 30 # in ohm
I_D2 = (V_S - V_K)/(R+R_f)
I_D2 = I_D2 * 10**3 # in mA
print "Part (c)"
print "The diode current = %0.f mA" %I_D2
# Given data
R1= 1 # in kΩ
R2= 0.47 # in kΩ
V_o1 = 0.7 # in V
print "The value of Vo1 = %0.1f V" %V_o1
V_o2 = 0.3 # in V
print "The value of Vo2 = %0.1f V" %V_o2
I1 = (20-V_o1)/R1 # in mA
I2 = (V_o2-V_o1)/R2 # in mA
I = I1 + I2 # in mA
print "The current = %0.2f mA" %I
# Given data
V1 = 10 # in V
V2 = 0.7 # in V
R1 = 1*10**3 # in ohm
R2 = 2*10**3 # in ohm
I = (V1-V2)/(R1+R2) # in A
V_o = I * R2 # in V
print "The output voltage = %0.1f V" %V_o
I_D = I/2 # in A
print "The diode current = %0.2f mA" %(I_D*10**3)
# Given data
V1 = 20 # in V
V2 = 0.7 # in V
R = 4.7*10**3 # in ohm
I = (V1-V2)/R # in A
I_D = I/2 # in A
print "The diode current = %0.2f mA" %(I_D*10**3)
V_o = I_D*R # in V
print "The output voltage = %0.2f V" %V_o
#Note : The answer in the book is wrong.
# Given data
V1 = 15 # in V
V2 = 0.7 # in V
V3 = 5 # in V
R = 2.2 # in K ohm
I_D = (V1-V2+V3)/R # in mA
print "The diode current = %0.2f mA" %I_D
V_o = (R * I_D) - V3 # in V
print "The output voltage = %0.1f V" %V_o
# Given data
V1 = 16 # in V
V2 = 0.7 # in V
V3 = V2 # in V
V4 = 12 # in V
R = 4.7 # in K ohm
I = (V1-V2-V3-V4)/R # in mA
print "The current = %0.3f mA" %I
V_o = (I * 10**-3 * R * 10**3) + V4 # in V
print "The output voltage = %0.1f V" %V_o