from math import exp
I0=2*10**-7
Vf=0.1
I=I0*(exp (40*Vf)-1)
print "I = %0.2f"%(I*10**6),'uA'
from __future__ import division
from math import exp
I0=1*10**-3
Vf=0.22
T=298
n=1
VT=T/11600
print "VT=%0.2f"%(VT*10**3),'mV'
I=I0*(exp (Vf/(n*VT))-1)
print "I=%0.2f"%I,"A"
from math import log
from __future__ import division
I1=0.5*10**-3
V1=340*10**-3
I2=15*10**-3
V2=440*10**-3
kTbyq=25*10**-3
a=V1/kTbyq
b=V2/kTbyq
#log(I1/I2)==log(exp((b-a)/n))
n=(a-b)/(log(I1/I2))
print "value of n =",n
from __future__ import division
I300=10*10**-6
T1=300
T2=400
I400=I300*(2**((T2-T1)/10))
print "I400=%0.2f"%(I400*10**3),'mA'
from __future__ import division
rB=2.0
IF=12*10**-3
VF=0.7+IF*rB
print "VF=%0.2f"%VF,'V'
from __future__ import division
PD=0.5
VF=1
VBR=150
IF=(PD/VF)
print "IF=%0.2f"%IF,"A"
IR=(PD/VBR)
print "IR=%0.2f"%(IR*10**3),'mA'
from __future__ import division
R=330
VS=5
VD=VS
print "VD=VS=%0.2f"% VD,'V'
VR=0
print "VR=",VR
I=0
print "I=",I
from __future__ import division
VS=12
R=470
VD=0
print "VD=",VD
VR=VS
print "VR=",VR,"V"
I=(VS/R)
print "I=%0.2f"%(I*10**3),"mA"
from __future__ import division
VS=6
R1=330
R2=470
VD=0.7
RT=R1+R2
I=(VS-0.7)/RT
print "I=%0.2f"%(I*10**3),'mA'
from __future__ import division
VS=5
R=510
VF=0.7
VR=VS-0.7
print "VR=%0.2f"%VR,"V"
I=VR/R
print "I=%0.2f"%(I*10**3),"mA"
from __future__ import division
VS=6
VD1=0.7
VD2=0.7
VR=1.5*10**3
I=(VS-VD1-VD2)/VR
print "I=%0.2f"%(I*10**3),'mA'
from __future__ import division
VS=12
R1=1.5*10**3
R2=1.8*10**3
VD1=0.7
VD2=0.7
I=(VS-VD1-VD2)/(R1+R2)
print "I=%0.2f"%(I*10**3),'mA'
from __future__ import division
V1=0
V2=0
VO=0
print "VO=",VO,"V"
V1=0
V2=5
VO=V2-0.7
print "VO=",VO,"V"
V1=5
V2=0
VO=V1-0.7
print "VO=",VO,"V"
V1=5
V2=5
VO=V2-0.7
print "VO=",VO,"V"
from __future__ import division
from numpy import arange,pi,sin
%matplotlib inline
from matplotlib.pyplot import plot,show,xlabel,ylabel,title
R=20*10**3
I=(R-0.7)/R
print "I=",I,"mA"
rj=50
rB=1
re=rB+rj
R1=(R*re)/(re+R)
print "R1=",R1
V=10*(re/(re+1000))
print "V=",V,'mV'
i=arange(0,6*pi,0.01)
y=[]
for x in i:
y.append(sin(x))
plot(i,y)
xlabel("X")
ylabel("Y")
title("sin wave")
show()