##Ex1.1
#calcualte fusing current for given values
import math
print("I = K(d^1.5)") ##formula used for fusing current
d=0.0031
print"%s %.3f %s"%("d = ",d,"inches") ##initializing values of diameter
I1=10244*(d**1.5);
I2=7585*(d**1.5);
I3=5320*(d**1.5);
I4=3148*(d**1.5); I5=1642*(d**1.5) ##calculation for fusing current
print"%s %.2f %s"%("for Copper, I = 10244*(d^1.5) = ",I1,"Amp.")
print"%s %.2f %s"%("for Aluminum, I = 7585*(d^1.5) = ",I2,"Amp.")
print"%s %.2f %s"%("for Silver, I = 5320*(d^1.5) = ",I3,"Amp.")
print"%s %.2f %s"%("for Iron, I = 3148*(d^1.5) = ",I4,"Amp.")
print"%s %.2f %s"%("for Tin, I = 1642*(d^1.5) = ",I5,"Amp.")
##Ex1.2
#calculate fusing current for given values
print("fusing current, I = K(d**1.5) Amp.")##formula used for fusing current
d=0.0201
print"%s %.2f %s"%("d = ",d,"inches") ##initializing value of diameter
I1=10244*(d**1.5);I2=7585*(d**1.5); I3=5320*(d**1.5); I4=3148*(d**1.5); I5=1642*(d**1.5) ##calculation for fusing current
print"%s %.2f %s"%("for Copper, I = 10244*(d**1.5) = ",I1,"Amp.")
print"%s %.2f %s"%("for Aluminum, I = 7585*(d**1.5) = ",I2,"Amp.")
print"%s %.2f %s"%("for Silver, I = 5320*(d**1.5) = ",I3,"Amp.")
print"%s %.2f %s"%("for Iron, I = 3148*(d**1.5) = ",I4,"Amp.")
print"%s %.2f %s"%("for Tin, I = 1642*(d**1.5) = ",I5,"Amp.")
## note : calculation for fusing current of Iron is wrong.
##Ex1.3
#calculate for fusing current in all four cases
import math
print("fusing current, I = K(d**1.5) Amp.") ##formula used for fusing current
print("(a)")
d=0.0159
print"%s %.2f %s"%("d = ",d,"inches") ##initializing value of diameter
I1=10244*(d**1.5);I2=7585*(d**1.5); I3=5320*(d**1.5); I4=3148*(d**1.5); I5=1642*(d**1.5) ##calculation for fusing current
print"%s %.2f %s"%("for Copper, I = 10244*(d**1.5) = ",I1,"Amp.")
print"%s %.2f %s"%("for Aluminum, I = 7585*(d**1.5) = ",I2,"Amp.")
print"%s %.2f %s"%("for Silver, I = 5320*(d**1.5) = ",I3,"Amp.")
print"%s %.2f %s"%("for Iron, I = 3148*(d**1.5) = ",I4,"Amp.")
print"%s %.2f %s"%("for Tin, I = 1642*(d**1.5) = ",I5,"Amp.")
print("(b)")
d=0.0063
print"%s %.2f %s"%("d = ",d,"inches") ##initializing value of diameter
I1=10244*(d**1.5);I2=7585*(d**1.5); I3=5320*(d**1.5); I4=3148*(d**1.5); I5=1642*(d**1.5) ##calculation for fusing current
print"%s %.2f %s"%("for Copper, I = 10244*(d**1.5) = ",I1,"Amp.")
print"%s %.2f %s"%("for Aluminum, I = 7585*(d**1.5) = ",I2,"Amp.")
print"%s %.2f %s"%("for Silver, I = 5320*(d**1.5) = ",I3,"Amp.")
print"%s %.2f %s"%("for Iron, I = 3148*(d**1.5) = ",I4,"Amp.")
print"%s %.2f %s"%("for Tin, I = 1642*(d**1.5) = ",I5,"Amp.")
print("(c)")
d=0.0403
print"%s %.2f %s"%("d = ",d,"inches") ##initializing value of diameter
I1=10244*(d**1.5);I2=7585*(d**1.5); I3=5320*(d**1.5); I4=3148*(d**1.5); I5=1642*(d**1.5) ##calculation for fusing current
print"%s %.2f %s"%("for Copper, I = 10244*(d**1.5) = ",I1,"Amp.")
print"%s %.2f %s"%("for Aluminum, I = 7585*(d**1.5) = ",I2,"Amp.")
print"%s %.2f %s"%("for Silver, I = 5320*(d**1.5) = ",I3,"Amp.")
print"%s %.2f %s"%("for Iron, I = 3148*(d**1.5) = ",I4,"Amp.")
print"%s %.2f %s"%("for Tin, I = 1642*(d**1.5) = ",I5,"Amp.")
print("(d)")
d=0.0452
print"%s %.2f %s"%("d = ",d,"inches") ##initializing value of diameter
I1=10244*(d**1.5);I2=7585*(d**1.5); I3=5320*(d**1.5); I4=3148*(d**1.5); I5=1642*(d**1.5) ##calculation for fusing current
print"%s %.2f %s"%("for Copper, I = 10244*(d**1.5) = ",I1,"Amp.")
print"%s %.2f %s"%("for Aluminum, I = 7585*(d**1.5) = ",I2,"Amp.")
print"%s %.2f %s"%("for Silver, I = 5320*(d**1.5) = ",I3,"Amp.")
print"%s %.2f %s"%("for Iron, I = 3148*(d**1.5) = ",I4,"Amp.")
print"%s %.2f %s"%("for Tin, I = 1642*(d**1.5) = ",I5,"Amp.")
print("(e)")
d=0.0508
print"%s %.2f %s"%("d = ",d,"inches") ##initializing value of diameter
I1=10244*(d**1.5);I2=7585*(d**1.5); I3=5320*(d**1.5); I4=3148*(d**1.5); I5=1642*(d**1.5) ##calculation for fusing current
print"%s %.2f %s"%("for Copper, I = 10244*(d**1.5) = ",I1,"Amp.")
print"%s %.2f %s"%("for Aluminum, I = 7585*(d**1.5) = ",I2,"Amp.")
print"%s %.2f %s"%("for Silver, I = 5320*(d**1.5) = ",I3,"Amp.")
print"%s %.2f %s"%("for Iron, I = 3148*(d**1.5) = ",I4,"Amp.")
print"%s %.2f %s"%("for Tin, I = 1642*(d**1.5) = ",I5,"Amp.")
print("(f)")
d=0.162
print"%s %.2f %s"%("d = ",d,"inches") ##initializing value of diameter
I1=10244*(d**1.5);I2=7585*(d**1.5); I3=5320*(d**1.5); I4=3148*(d**1.5); I5=1642*(d**1.5) ##calculation for fusing current
print"%s %.2f %s"%("for Copper, I = 10244*(d**1.5) = ",I1,"Amp.")
print"%s %.2f %s"%("for Aluminum, I = 7585*(d**1.5) = ",I2,"Amp.")
print"%s %.2f %s"%("for Silver, I = 5320*(d**1.5) = ",I3,"Amp.")
print"%s %.2f %s"%("for Iron, I = 3148*(d**1.5) = ",I4,"Amp.")
print"%s %.2f %s"%("for Tin, I = 1642*(d**1.5) = ",I5,"Amp.")
## note : in part (e) ... calculation for fusing current of silver is wrong.
## note : in part (f) ... calculation for fusing current of Iron is wrong.
##Ex1.4
#calculate resistance for given resistivity
import math
A=0.5189*10**-6##wire cross sectional area
rho=1.725*10**-8##resistivity
l=100 ##wire length
print"%s %.3e %s"%("A =",A,"merer square")
print"%s %.2e %s"%("rho =",rho,"ohm-m")
print"%s %.2f %s"%("l =",l,"m")
print"%s %.2f %s"%("R = rho*l/A = ",rho*l/A,"ohm") ##resistance
##Ex1.5
#calculate resistance wire
import math
A=0.2588*10**-6##wire cross-sectional area
rho=1.725*10**-8##resistivity
l=100 ##wire length
print"%s %.2e %s"%("A =",A,"merer square")
print"%s %.2e %s"%("rho =",rho,"ohm-m")
print"%s %.2f %s"%("l =",l,"m")
print"%s %.2f %s"%("R = rho*l/A = ",rho*l/A,"ohm") ##resistance of wire
##Ex1.6
#calculate resistance at temperature at T2
R1 = 14##resistance at temperature T1
alpha=0.005
T1=20;##initial temperature
T2=120 ##final temperature
print"%s %.2f %s %.2f %s %.2f %s%.2f %s "%("R1 = ",R1, "ohm"and" alpha = ",alpha,""and " T1 = ",T1,"degreeC"and "T2 = ",T2,"degreeC")
print"%s %.2f %s"%("R2 = R1(1+(alpha*(T1-T2))) = ",R1*(1+(alpha*(T2-T1))),"ohm") ##resistance at temperature T2
##EX1.7
#calculate force of electron charge
import math
Ex=3;Ey=4;Ez=2##electric field
e=1.6*10**-19 ##electorn charge
print("E = 3ax + 4ay + 2az k V/m")
print("e = 1.6*10**-19 C")
print"%s %.2e %s %.2e %s %.2e %s "%(" F=eE = ",Ex*e*1000,"ax + ",Ey*e*1000,"ay + ",Ez*e*1000,"az N") ##force
#or
f=10**-16* math.sqrt(74.24)
print"%s %.2e %s "%("f=",f,"N")
##Ex1.8
#calculate elctric field
import math
F=0.1*10**-12##force applied
e = 1.6*10**-19##electron charge
print"%s %.2e %s %.2e %s "%("F= ",F,"N "and " e = ",e,"C")
print"%s %.2e %s"%("E = F/e =",F/e,"V/m")##electric field
##Ex1.9
#calculate charge of electron
import math
F = 3*(10**-12) ##force applied
E = 5*(10**-6) ##electric field
print"%s %.2e %s"%("F = ",F,"N")
print"%s %.2e %s"%("E = ",E,"V/m")
print"%s %.2e %s"%("Q= F/E = ",F/E,"C") ##chage
#converted in units
##Ex1.10
#calculate force
import math
B = 2*10**-6 ##magnetic flux density
V = 4*10**6 ##electron velocity
e= 1.6*10**-19##elcetron charge
print"%s %.2e %s"%("B =",B,"ax wb/m.sq")
print"%s %.2f %s"%("V =",V,"az m/s")
print"%s %.3e %s"%("e = ",e, "C")
print"%s %.2e %s"%("F = e[VxB] =",e*V*B,"ay N")##force
##Ex1.11
#calculate force on electron due to field
import math
Hx = 1*10**-3 ##magnetic field in x-axis
Hy = 2*10**-3 ##magnetic field in y-axis
V = (4*10**6) ##electron velocity
micro_not=(4*math.pi*(10**-7)) ##permitivity in vaccum
e=1.6*10**-19 ##charge of electorn
print"%s %.2e %s %.2e %s "%(" H = ",Hx,"ax + ",Hy,"ay A/m")
print"%s %.2f %s"%("V = ",V,"ay m/s")
Bx = micro_not*Hx; By = micro_not*Hy ##magnetic flux density
print"%s %.2e %s %.2e %s "%("B = micro_not*H = ",Bx,"ax + ",By,"ay wb/m.sq")
print"%s %.2e %s "%("F = e[VxB] = ",e*V*Bx,"az N") ##force on electron due to field
## note : there is a misprint in the textbook for the above problem
##Ex1.12
import math
n = 5.*10**22##number of atoms in silicon/cm_cube
donors = 10**-7 ##donor atoms
print'%s %.2e %s'%("n = ",(n)," /cm.cube")
print'%s %.2e %s'%("donors = ",(donors),"")
print'%s %.2e %s'%("ND = ",(n*donors)," /cm.cube") ##donor atom concentration
##Ex1.13
import math
ND =5.*10**16##donor atom concentration
print'%s %.2e %s'%("n = ",(ND),"/cm.cube") ##free electrons
#approx
##Ex1.14
import math
ni = 1.5*10**10 ##intrinsic concentration
ND = 5.*10**16 ##donor atom concentration
print'%s %.2e %s'%("ni =",(ni),"/cm.cube")
print'%s %.2e %s'%("ND = ",(ND)," /cm.cube")
print'%s %.2e %s'%("p = (ni^2)/ND = ",((ni**2)/ND),"atom/cm.cube") ##hole concentration
##Ex1.15
import math
ni = 1.52*10**10 ##intrinsic concentration
e=1.6*10**-19 ##charge of electron
micro_n = 1350.; micro_p = 480. ## charge mobility
print'%s %.2e %s'%("e = ",(e),"C")
print'%s %.2e %s'%("ni = pi =",(ni),"/cm.cube")
print'%s %.2f %s'%("micro_n = ",(micro_n),"cm.sq/V-s")
print'%s %.2f %s'%("micro_p = ",(micro_p),"cm.sq/V-s")
print'%s %.2e %s'%("sigma = e(micro_n*ni + micro_p*pi ) =",(e*(micro_n*ni + micro_p*ni)),"mho/cm") ##conductivity
print'%s %.2e %s'%("rho = 1/sigma =",(1/(e*(micro_n*ni + micro_p*ni))),"ohm-cm") ##resistivity
##Ex1.16
import math
ni = 2.5*(10**13) ##intrinsic concentration
donor = 10**-7 ##donor atoms
ND = 4.41*(10**22)*(10**-7) ##donor atom concentration
e = 1.6*(10**-19) ##electron charge
micro_n = 3800.; micro_p = 1800. ##charge mobility
print'%s %.2e %s'%("ni =",(ni)," /cm.cube")
print'%s %.2e %s'%("donor = ",(donor),"")
print'%s %.2e %s'%("n = ND =",(ND)," /cm.cube")
print'%s %.2e %s'%("p = (ni^2)/ND = ",((ni**2)/ND)," /cm.cube") ##hole concentration
print("micro_n = 3800 cm.sq/V-s; micro_p = 1800 cm.sq/V-s")
sigma = ni*e*(micro_n+micro_p) ##conductivity
print'%s %.2f %s'%("sigma = ni*e(micro_n + micro_p) = ",(sigma),"mho/cm")
#conveted into units
##Ex1.17
import math
ni = 2.5*10**19 ##intrinsic concentration
NA = 10**21 ##acceptor atom concentration
print'%s %.2e %s'%("ni = ",(ni)," /m.cube")
print'%s %.2e %s'%("NA = ",(NA)," /m.cube ")
print'%s %.2e %s'%("np = (ni^2)/ NA =",((ni**2)/NA),"e/m.cube") ##electron concentration
##textbook has not calcutated for hole concentration
##Ex1.18
import math
micro_p = 1800. ##hole mobility
rho_p = 1. ##resistivity
e = 1.6*10**-19 ##electorn charge
print'%s %.2f %s'%("micro_p =",(micro_p)," cm.sq/V-s")
print'%s %.2f %s'%("rho_p = ",(rho_p),"ohm-cm")
print'%s %.2e %s'%("e = ",(e),"C")
print'%s %.2e %s'%("pp = 1/(e*micro_p*rho_p) = ",(1/(e*micro_p*rho_p))," holes/cm.cube") ##number of trivalent impurity
#due to round off error
##Ex1.19
import math
micro_n = 1300. ##eletron mobility
rho_n = 2. ##resistivity
e = 1.6*10**-19 ##electron charge
print'%s %.2f %s'%("micro_n =",(micro_n)," cm.sq/V-s")
print'%s %.2f %s'%("rho_n = ",(rho_n),"ohm-cm")
print'%s %.2e %s'%("e",(e),"C")
print'%s %.2e %s'%("nn = 1/(e*micro_n*rho_n) = ",(1/(e*micro_n*rho_n))," e/cm.cube") ##number of pentavalent impurity
##Ex1.20
import math
EGo = 1.1 ##energy band gap
micro_n = 0.13 ##electron mobility
micro_p = 0.05 ##hole mobility
N = 3.*10**25 ##atom concentration
K = 1.38*10**-23 ##Boltzmann constant
T = 300. ##room temperature
e=1.6*10**-19##electron charge
print'%s %.2f %s %.2e %s '%("EGo = ",(EGo),"eV = ",(EGo*e),"J")
print'%s %.2f %s'%("micro_n = ",(micro_n)," m.sq/V-s")
print'%s %.2f %s'%("micro_p = ",(micro_p),"m.sq/V-s")
print'%s %.2e %s'%("N = ",(N)," /m.cube")
print'%s %.2f %s'%("T = ",(T),"degree_K")
print'%s %.2e %s'%("K = ",(K),"J/K")
print'%s %.2e %s'%("ni = N*exp(-(EGo/(2*T*K))) = ",(N*math.exp(-(EGo*e/(2*T*K))))," /m.cube") ##intrinsic concentration
ni = N*math.exp(-(EGo*e/(2*T*K)))
print'%s %.2e %s'%("sigma = ni*e(micro_n+micro_p) = ",(ni*e*(micro_n+micro_p)),"mho/m") ##conductivity
##Ex1.21
import math
K = 1.38*10**-23 ##Boltzmann constant
e = 1.6*10**-19 ##electron charge
T = 300. ##room temperature
print'%s %.2e %s'%("K = ",(K)," J/K")
print'%s %.2e %s'%("e = ",(e),"C")
print'%s %.2f %s'%("T = ",(T),"degree_K")
print'%s %.2f %s'%("VT = K*T/e = ",(K*T/e),"V") ##volt-equivalent temperature