# variable declaration
V_bias=10.0; #bias voltage in volt
R_limit=1000; #limiting resistance in ohm
r_d =10.0; #r_d value
#calculation
#IDEAL MODEL
print "IDEAL MODEL"
V_f=0; #voltage in volt
I_f=V_bias/R_limit; #foward current
V_R_limit=I_f*R_limit; #limiting voltage
print "forward voltage = %.2f volts" %V_f
print "forward current = %.2f amperes" %I_f
print "voltage across limiting resistor = %.2f volts" %V_R_limit
#PRACTICAL MODEL
print "\nPRACTICAL MODEL"
V_f=0.7; #voltage in volt
I_f=(V_bias-V_f)/R_limit; #foward current
V_R_limit=I_f*R_limit; #limiting voltage
print "forward voltage = %.2f volts" %V_f
print "forward current = %.3f amperes" %I_f
print "voltage across limiting resistor = %.2f volts" %V_R_limit
#COMPLETE MODEL
print "\nCOMPLETE MODEL"
I_f=(V_bias-0.7)/(R_limit+r_d); #foward current
V_f=0.7+I_f*r_d; #forward voltage
V_R_limit=I_f*R_limit; #limiting voltage
print "forward voltage = %.3f volts" %V_f
print "forward current = %.3f amperes" %I_f
print "voltage across limiting resistor = %.2f volts" %V_R_limit
# variable declaration
V_bias=5; #bias voltage in volt
I_R=1*10**-6; #current
R_limit=1000 #in Ohm
#calculation
#IDEAL MODEL
print "IDEAL MODEL"
I_r=0.0; #current in ampere
V_R=V_bias; #voltages are equal
V_R_limit=I_r*R_limit; #limiting voltage
print "Reverse voltage across diode = %.2f volts" %V_R
print "Reverse current through diode= %.2f amperes" %I_r
print "voltage across limiting resistor = %.2f volts" %V_R_limit
#PRACTICAL MODEL
print "\nPRACTICAL MODEL"
I_r=0.0; #current in ampere
V_R=V_bias; #voltages are equal
V_R_limit=I_r*R_limit; #limiting voltage
print "Reverse voltage across diode= %.2f volts" %V_R
print "Reverse current through diode = %.2f amperes" %I_r
print "voltage across limiting resistor = %.2f volts" %V_R_limit
#COMPLETE MODEL
print "\nCOMPLETE MODEL"
I_r=I_R; #current in ampere
V_R_limit=I_r*R_limit; #limiting voltage
V_R=V_bias-V_R_limit; #voltage in volt
print "Reverse voltage across diode = %.3f volts" %V_R
print "Reverse current through diode = %d micro Amp" %(I_r*10**6)
print "voltage across limiting resistor = %d mV" %(V_R_limit*1000)