#Chapter 4,Example 4.1 Page 144
#Determine the voltge when S=2 cm
import math
S = 0.2 # cm
Vb = 24.22*S+6.08*math.sqrt(S)
print'%s %.2f %s' % (" Vb when S = 2 cm is",Vb," kV \n ")
#Determine the voltge when S=1.5 cm
S = 1.5 # cm
Vb = 24.22*S+6.08*math.sqrt(S)
print'%s %.3f %s' % (" Vb when S = 1.5 is ",Vb," kV \n ")
b = 75.
t = 35.
D = (3.92*b)/(273+t)
print'%s %.4f' % (" Air density correction factor = ",D)
#Answer may vary due to round off error
#Chapter 4,Example 4.2 Page 145
import math
# Determine the potential difference
AP = 8.**2./4. # Area of plate
d = 4. # mm
FA = 0.2*9.8*10.**-3. # Force of attraction
V = math.sqrt(FA*2.*36.*16.*10.**-6./(10.**-9.*16.*10.**-4.))
print'%s %d %s' % ("area of plate =",AP,"pi sq.cm")
print'%s %d %s' % ("V = ",round(V),"V \n ")
#Answers may vary due to round off error
#Chapter 4,Example 4.3 Page 145
import math
d = 1. #mm
V = 10.**3. # V
F = 5.*10.**-3. # pull between the plates in N
E = 1./(36.) # epselon
A = 10**2./4. # Area of the plate
d1 = math.sqrt((1./(2.*F))*E*10.**-9.*V**2.*A*10.**-4.) # calculation done in the text is wrong
d21 = 1./(d1*10.**4.)
d22 = 1./(d1*10.**4.+d)
C = (V*E*10.**-9.*A*10.**-4.)*(d21-d22)
print'%s %.2f %s' % ("d = ",d1*10.**4.,"mm \n ")
print'%s %.4f %s' % ("charge in capacitance =",C*10**12," pF \n ")
#Answers may vary due to round off error
#Chapter 4,Example 4.4 Page 145
import math
Imin = 2.*10.**-6. # A
Imax = 35.*10.**-6. # A
V = 15.*10.**4. # V
w = 2.*math.pi*1500./60.
Cm = math.sqrt(2.)*Imin/(V*w)
Ipeak = 2.*250./15.
print'%s %.1f %s' % (" Cm = ",Cm*10**13+0.3," pF \n ")
print'%s %.1f %s' % (" At 250 kV, the current indicated will be =",Ipeak,"microA \n ")
#Answers vary due to round off error
#Chapter 4,Example 4.5 Page 146
V1 = 150*10**3 # V
PD = 1200 # potential divider ratio
I = 10**-6 # A
t = 8 # sec
V = V1/PD
R = V/I
C = t*10**6/R
print'%s %d %s' % ("V =",V," V \n ")
print'%s %.1f %s' % ("R =",R*10**-7,"M ohm\n ")
print'%s %.2f %s' % ("C = ",C*10," micro F \n ")
# Answers provided in the textbook are wrong
#Chapter 4,Example 4.6 Page 146
i = 8.*10.**3. # i(t)
V0 = 8. # V0(t)
I = 8.*10.**3. # A
rcI = 10.**10. # rate of change of current in A/sec
R = 8.*10.**3. # ohm
RCbyM = i/V0 # R*C/M
t = I/rcI # 1/4 of cycle
T = t*4.
f = 1./T
CR = 5./f
M = CR/RCbyM
C = CR/R
print'%s %d %s' % ("Time for 1/4 cycle =",t*10000000,"*10^-7 sec \n ")
print'%s %d %s' % ("Full time =",T*10000000,"*10^-7 sec \n ")
print'%s %.2f %s' % ("f =",f/1000000,"*10^7 Hz \n ")
print'%s %d %s' % ("M = ",round(M*1000000000),"nH \n ")
print'%s %d %s' % ("C = ",round(C*1000000000),"nF \n ")
print'%s %d %s' % ("R =",R/1000,"*10^3 ohm \n")
# Answers may vary due to round off error