#Percentage error
import math
r=10 #in ohm
f=1 #in MHz
c=65 #capacitance in pF
rsh=0.02 #in ohm
qact=((1/(2*math.pi*f*10**6*c*10**-12*r))) #actual q factor
qm=(1/(2*math.pi*c*10**-12*f*10**6*(r+rsh))) #measured q factor
per=((qact-qm)/qact)*100 #percentage error
print "Percentage error is",round(per,1)," %"
import math
#Self capacitance and inductance
f1=2 #in MHz
c1=460 #in pF
f2=4 #in MHz
c2=100 #in pF
cd1=((c1-(4*c2))/3) #self capacitance in pF
x=((1/(2*math.pi*f1*10**6)))**2
l=x/((c1+cd1)*10**-12) # in H
l*=10**6 # in micro H
print "Self capacitance is ",cd1," pF"
print "Inductance is ",round(l,2)," micro H"
# Lx and Rx
#given data :
R1=560 # in kohm
R2=6.3 # in kohm
R3=120 # in kohm
Ci=0.01 # in micro F
Sensitivity=10 # in mm/micro A
del_r=1 # in ohm
Rx=(R2*R3)/R1
print "Unknown resistance, Rx = ",Rx," kohm"
Lx=R2*10**3*R3*10**3*Ci*10**-6
print "Unknown inductance, Lx = ",Lx," H"
import math
#Cx,Rx and D
#given data :
f=1000 #in Hz
R1=1.1 # in kohm
R2=2.2 # in kohm
C1=0.47 # in micro F
C3=0.5 # in micro F
Rx=(R2*C1)/C3
print "Unknown resistance, Rx = ", Rx," kohm"
Cx=(R1*C3)/R2
print "Unknown capacitance, Cx = ", Cx, " micro F"
w=2*f*math.pi
D=w*Cx*10**-6*Rx*10**3
print "Dissipation factor, D = ", round(D,2)
#answer is wrong in the textbook
#Unknown resistance and capacitance
r1=10 #in kohms
r2=50 #in kohms
r3=100 #in kohms
c3=100 #in micro F
rx=((r2*10**3*r3*10**3)/(r1*10**3))*10**-3 #unknown resistance in kohms
cx=((r1*10**3*c3*10**-6)/(r2*10**3))*10**6 # unknown capacitance in micro F
print "unknown resistance is ",rx," kohm"
print "Unknown capacitance is ",cx," micro F"
#Lx and Rx
#given data :
R1=600 # in ohm
R2=1000 # in ohm
R3=100 # in ohm
C1=1 # in micro F
Rx=(R2*R3)/R1
print "resistance, Rx = ",Rx," ohm"
Lx=C1*10**-6*R2*R3
print "Inductance, Lx = ",Lx, " H"
#L3 and R3
#given data :
R1=10 # in kohm
R2=2 # in kohm
R4=1 # in kohm
C2=1*10**-6 # in micro F
w=3000 # in rad/sec
L3=(R1*10**3*R4*10**3*C2)/(1+((R2*10**3)**2*(C2**2)*w**2))
R3=R2*10**3*L3*C2*w**2
print "Unknown resistance is ",round(R3,0)," ohm"
print "Inductance is ",round(L3,2)," H"
#resistance is calculated wrong in the textbook
import math
#Cx,Rx and D
#given data :
f=1000 #in Hz
R2=20000 # in ohm
R3=1.2*10**3 # in ohm
C3=300*10**-12 # in F
C4=0.05*10**-6 # in F
Rx=(R2*C3)/C4 # in ohm
print "Unknown resistance, Rx = ",Rx, " ohm"
Cx=((R3*C4)/R2)*10**6
print "Unknown capacitance, Cx = ",Cx," micro F"
w=2*f*math.pi
D=w*Cx*10**-6*Rx
print "Dissipation factor, D = %.2E" %D
import math
#Resistance and capacitance
#given data :
C2=106*10**-12 # in F
C4=0.6*10**-6 # in F
R4=1000/math.pi # in ohm
R3=250 # in ohm
R1=(C4/C2)*R3
print " Resistance, R1 = %.2E" %R1," ohm"
C1=(R4/R3)*C2*10**6
print "Capacitance, C1 = ",round(C1*10**6)," micro F"
import math
#Resistance and capacitance
#given data :
R1=3.1 # in kohm
C1=5.2 #in micro F
R2=25 #in kohm
R4=100 #in kohm
f=2.5*10**3 #in Hz
w=2*math.pi*f*10**-3
R3=(R4/R2)*(R1+(1/(w**2*R1*C1**2)))
print "Resistance, R3 = ",round(R3,1)," kohm"
C3=((R4/R2)-(R1/R3))*C1
print "Capacitance, C3 = ",round(C3,1), "pF"
# answer is wrong in book
import math
#Inductance and capacitance
#given data :
F1=1.5 #in MHz
C1=650 #in pF
F2=3 #in MHz
C2=150 #in pF
Cd=(C1-(4*C2))/3
print "Capacitance, Cd = ",Cd, "pF"
L=(1/(4*math.pi**2*F1**2*((C1*10**-12)+(C2*10**-12))))*10**-6
print "Inductance, L = ",round(L,2)," micro H"
# Answer wrong in the textbook
import math
# Q
#given data
rsh=0.02
r=10 # in ohm
f=1 #in MHz
c=65 #in pF
L=(1/((2*math.pi*f*10**6)**2*c*10**-12))*10**3
qact=((1/(2*math.pi*f*10**6*c*10**-12*r))) #actual q factor
qm=(1/(2*math.pi*c*10**-12*f*10**6*(r+rsh))) #measured q factor
per=((qact-qm)/qact)*100 #percentage error
print "Percentage error is ",round(per,3), " %"
# capacitance
#given data :
F1=3 #in MHz
C1=400 #in pico-farad
F2=6 #in MHz
C2=120 #in pico-farad
Cd=(4*C2-C1)/3
print "Self capacitance, Cd = ",Cd, " pF"
# Answer wrong in the textbook.
# capacitance
#given data :
F1=2.0 #in MHz
C1=450 #in pF
F2=5 #in MHz
C2=60 #in pF
ratio=F2/F1
#1/sqrt(C2+Cd)=ratio/sqrt(C1+Cd)
Cd=(C1-(ratio**2*C2))/5.25
print "Self capacitance, Cd = ",round(Cd,2), " pF"
# capacitance
#given data :
F1=8 #in MHz
C1=120 #in pF
F2=12 #in MHz
C2=40 #in pF
ratio=F1/F2
#1/sqrt(C2+Cd)=ratio/sqrt(C1+Cd)
Cd=((4*C1-9*C2)/5)
print "Self capacitance, Cd = ", Cd," pF"
#Lx and Rx
#given data :
r1=28.5 #in ohm
L1=52.6 #in mH
R2=1.68 #in ohm
R3=80 #in ohm
R4=R3 # in ohm
Lx=(R3/R4)*L1 #inductance in mH
Rx=r1*(R3/R4)-R2 #in ohm
print "Unknown resistance, Rx = ",Rx," ohm"
print "Unknown inductance, Lx = ", Lx," mH"