##Ex6_1
import math
IB = 40.*10**-6
IC = 3.*10**-3
beta = IC/IB
alpha = beta/(1.+beta)
print'%s %.2e %s'%("IB = ",(IB),"A")##base current
print'%s %.2e %s'%("IC = ",(IC),"A")##collector current
print'%s %.2f %s'%("beta = IC/IB = ",(beta),"")##current gain in CE configuration
print'%s %.2f %s'%("alpha = beta/(1+beta) = ",(alpha),"")##current gain in CB configuration
##Ex6_2
import math
IE = 1.2*10**-3
beta = 60.
alpha = beta/(1.+beta)
print'%s %.2f %s'%("beta = ",(beta),"")##current gain in CE configuration
print'%s %.2f %s'%("alpha = beta/(1+beta) = ",(alpha),"")##current gain in CB configuraion
print'%s %.2f %s'%("IE = ",(IE),"A")##emitter current
IB = IE/(beta+1.)
IC = beta*IB
print'%s %.2e %s'%("IB = IE/(beta+1) = ",(IB),"A")##base current
print'%s %.2e %s'%("IC = beta*IB = ",(IC),"A")##collector current
##Ex6_3
import math
alpha = 0.98
VBE = 0.7
IE = -2.*10**-3
Re = 100.
RL = 3.3*10**3
print'%s %.2f %s'%("alpha = ",(alpha),"")##current gain
print'%s %.2f %s'%("VBE = ",(VBE),"V")##voltage across base-emitter
print'%s %.2e %s'%("IE = ",(IE),"A")##emitter current
print'%s %.2f %s'%("Re = ",(Re),"ohm")##emitter resistance
print'%s %.2f %s'%("RL = ",(RL),"ohm")##load resistance
##now according to circuit given for the question in the textbook
IC = -alpha * IE
print'%s %.2e %s'%("IC = -alpha*IE = ",(IC),"A")##collector current
IB = -IC - IE
print'%s %.2e%s'%("IB = -IC - IE = ",(IB),"A")##base current
VBN = VBE+(abs(IE)*Re)
print'%s %.2f %s'%("VBN = VBE+(IE*Re) = ",(VBN),"V")##voltage across base and ground(N)
##ASSUMING... value for R1 = 30*10^3 ohm
R1 = 30*10**3
print'%s %.2f %s'%("R1 = ",(R1),"ohm")##resistancfe R1 as given in circuit
I = VBN/R1
print'%s %.2e %s'%("I = VBN/R1 = ",(I),"A")##current across resistance R1
##ASSUMING... VCC = 9V
VCC = 9##collector voltage
print'%s %.2f %s'%("VCC = ",(VCC),"V")
VCN = VCC - (RL*(IC+I+IB))
print'%s %.2f %s'%("VCN = VCC - RL*(IC+I+IB)) = ",(VCN),"V")##voltage across collector and ground(N)
## according to the given diagram for the question in the textbook, unknown resistance is,
R = (VCN - VBN)/(I+IB)
print'%s %.2f %s'%("R = (VCN - VBN)/(I+IB) = ",(R),"ohm")##unknown resistance
##Ex6_4
import math
RC = 2.3*10**3
Re = 1*10**3
VCC = 12.
VCE = 5.
VBE = 0.7
beta = 50.
print'%s %.2f %s'%("RC = ",(RC),"ohm")##collector resistance
print'%s %.2f %s'%("Re = ",(Re),"ohm")##emitter resistance
print'%s %.2f %s'%("VCC = ",(VCC),"V")##supply voltage
print'%s %.2f %s'%("VCE = ",(VCE),"V")##voltage across collector and emitter
print'%s %.2f %s'%("VBE = ",(VBE),"V")##voltage across base and emitter
print'%s %.2f %s'%("beta = ",(beta),"")##current gain
## according to the given circuit, we have
IB = (VCC - VCE)/((beta+1.)*(RC+Re))
print'%s %.2e %s'%("IB = ",(IB),"A")##base current
IC = beta*IB
print'%s %.2e %s'%("IC = ",(IC),"A")##collector current
##from the circuit we have,
Rt = (VCE-VBE)/IB
print'%s %.2e %s'%("Rt = (VCE - VBE)/IB = ",(Rt),"ohm")##resistance Rt as given in circuit
##Ex6_5
import math
VBB = 1.
VCC = 12.
IC = 12.*10**-3
VCE = 4.
beta = 80.
VBE = 0.7
print'%s %.2f %s'%("VBB = ",(VBB),"V")##base supply voltage
print'%s %.2f %s'%("VCC = ",(VCC),"V")##collector supply voltage
print'%s %.2f %s'%("IC = ",(IC),"A")##collector current
print'%s %.2f %s'%("VCE = ",(VCE),"V")##voltage across collector and emitter
print'%s %.2f %s'%("beta = ",(beta),"")##current gain
print'%s %.2f %s'%("VBE = ",(VBE),"V")##voltage across base and emitter
IB = IC/beta
print'%s %.4f %s'%("IB = IC/beta = ",(IB),"A")##base current
RC = (VCC - VCE)/IC
print'%s %.2f %s'%("RC = (VCC - VCE)/IC = ",(int(RC)),"ohm")##collector resistance
##Ex6_6
import math
VCC = 9.
VBB = 3.
IC = 2.*10**-3
beta = 50.
VBE = 0.7
VCE = 4.
print'%s %.2f %s'%("VCC = ",(VCC),"V")##collector supply voltage
print'%s %.2f %s'%("VBB = ",(VBB),"V")##base supply voltage
print'%s %.2e %s'%("IC = ",(IC),"A")##collector current
print'%s %.2f %s'%("beta = ",(beta),"")##current gain
print'%s %.2f %s'%("VBE = ",(VBE),"V")##voltage across base and emitter
print'%s %.4f %s'%("VCE = ",(VCE),"V")##voltage across collector and emitter
IB = IC/beta
print'%s %.2e %s'%("IB = IC/beta = ",(IB),"A")##base current
RB = (VBB - VBE)/IB
print'%s %.2f %s'%("RB = (VBB - VBE)/IB = ",(RB),"ohm")##base resistance according to the given in circuit
## note: misprint in the question, author is asking for IB instead of beta, as beta is already provided.
## note: calculation done in the textbook for the problem is wrong.
##Ex6_7
import math
VCC = 12.
VBB = 3.
IC = 12.*10**-3
VCE = 5.5
beta = 100.
VBE = 0.7
Re = 50.
print'%s %.2f %s'%("VCC = ",(VCC),"V")##collector supply voltage
print'%s %.2f %s'%("VBB = ",(VBB),"V")##base supply voltage
print'%s %.2e %s'%("IC = ",(IC),"A")##collector current
print'%s %.2f %s'%("VCE = ",(VCE),"V")##voltage across collector and emitter
print'%s %.2f %s'%("beta = ",(beta),"")##current gain
print'%s %.2f %s'%("VBE = ",(VBE),"V")##voltage across base and emitter
print'%s %.2f %s'%("Re = ",(Re),"ohm")##emittter resistance
IB = IC/beta
print'%s %.2e %s'%("IB = IC/beta = ",(IB),"A")##base current
##from base-emitter circuit;
IE = IC+IB
Rb = (VBB - VBE - (IE*Re))/IB
print'%s %.2f %s'%("Rb = (VBB - VBE - IE*Re)/IB = ",(Rb),"ohm")##base resistance
##from collector-emitter circuit, we have
Rc = (VCC - VCE - (IE*Re))/(IC)
print'%s %.2f %s'%("Rc = (VCC - VCE - (IE*Re))/IC = ",(Rc),"ohm")##collector resistance
##NOTE : in textbook the notation used for base and emitter resistance in fig. and in calculation are different
## note : calculation perform in the textbook is wrong for the above problem
##Ex6_8
import math
VBB = 10.
RB = 500.*10**3
VCC = 15.
RC = 1.2*10**3
beta =100.
print'%s %.2f %s'%("beta = ",(beta),"")##current gain
print'%s %.2f %s'%("VBB = ",(VBB),"V")##base supply voltage
print'%s %.2f %s'%("RB = ",(RB),"ohm")##resistance across base terminal
print'%s %.2f %s'%("VCC = ",(VCC),"V")##collector supply voltage
print'%s %.2f %s'%("RC = ",(RC),"ohm")##resistance across collector terminal
IB = VBB/RB
print'%s %.2e %s'%("IB = VBB/RB = ",(IB),"A")##base current
IC = beta*IB
print'%s %.4f %s'%("IC = beta*IB = ",(IC),"A")##collector current
VCE = VCC - (IC*RC)
print'%s %.2f %s'%("VCE = VCC - IC*RC = ",(VCE),"V")##voltage across collector and emitter
## the answer printed in the textbook for VCE is wrong.
##Ex6_9
import math
ic = 2.*10**-3
ie = ic## as base current is negligble
VT = 25.*10**-3
re = VT/ie
gm = ie/VT
print'%s %.2e %s'%("ic = ",(ic),"A")##collector current
print'%s %.2e %s'%("ie = ",(ie),"A")##emitter current with negligble base current
print'%s %.2f %s'%("VT = ",(VT),"V")##voltage at room temperature
print'%s %.2f %s'%("re = VT/ie = ",(re),"ohm")##emitter resistance
print'%s %.2f %s'%("gm = ie/VT = ",(gm),"mho")##conductance
rc = 100*10^3##slope of output characteristics
print'%s %.2f %s'%("rc = ",(rc),"ohm")
hoe = 1./rc
print'%s %.2e %s'%("hoe = 1/rc = ",(hoe),"Mho")##output conductance
##Ex6_10
import math
ic = 2.5*10**-3
ib = 50.*10**-6
print'%s %.2e %s'%("ib = ",(ib),"A")##base current
print'%s %.2e %s'%("ic = ",(ic),"A")##collector current
beta = ic/ib
print'%s %.2f %s'%("beta = ic/ib = ",(beta),"")##current gain
##Ex6_11
import math
ic = 3.*10**-3
ib = 3.08*10**-3
print'%s %.4f %s'%("ib = ",(ib),"A")##base current
print'%s %.4f %s'%("ic = ",(ic),"A")##collector current
alpha = ic/ib
print'%s %.2f %s'%("alpha = ie/ib = ic/ib = ",(alpha),"")##current gain, assuming ie = ic
##Ex6_12
import math
##given, collector voltage swings between 11V to 4V
##thus,
vc = 11.-4.
print'%s %.2f %s'%("vc = 11 - 4 = ",(vc),"V")##PEAK-to-PEAK collector voltage
##given, collector current swings between 5mA to 1.4mA
##thus,
ic = (5. - 1.4)*10**-3
print'%s %.3f %s'%("ic = 5m - 1.4m = ",(ic),"A")##PEAK-to-PEAK collector current
##Ex6_13
import math
ic = 4.*10**-3
ib = 80.*10**-6
print'%s %.4f %s'%("ib = ",(ib),"A")##base current
print'%s %.4f %s'%("ic = ",(ic),"A")##collector current
Ai = ic/ib
print'%s %.2f %s'%("Ai = ic/ib = ",(Ai),"")##current gain in CE amplifier