from __future__ import division
import math
#initializing the variables:
Rs = 1.5;# in ohms
Cs = 400E-12;# in Farads
f = 8E6;# in Hz
#calculation:
#for a series equivalent circuit,
#tan(del) = Rs*w*Cs
#loss angle,
de = math.atan(Rs*Cs*(2*math.pi*f))
#power factor
pf = math.cos(de)
#the Q-factor
Q = 1/math.tan(de)
#dissipation factor,
D = 1/Q
#Results
print "\n\n Result \n\n"
print "\n (a)loss angle ",round(de,2)," rad."
print "\n (b)power factor ",round(de,2)," rad."
print "\n (c)Q-factor is ",round(Q,2)
print "\n (d)dissipation factor ",round(D,2)," rad."
from __future__ import division
import math
#initializing the variables:
de = 0.025;# in rad.
V = 5000;# in Volts
PL = 20;# power loss
f = 50;# in Hz
#calculation:
#power loss = w*C*V**2*tan(del)
Cp = PL/(2*math.pi*f*V*V*math.tan(de))
#for a parallel equivalent circuit,
#tan(del) = 1/(Rp*w*Cp)
Rp = 1/(2*math.pi*f*Cp*math.tan(de))
#Results
print "\n\n Result \n\n"
print "\n capacitance C ",round(Cp*1E6,2),"uF and parallel resistance ",round(Rp,2),"ohm."
from __future__ import division
import math
#initializing the variables:
P = 500E-6;# in Watt
C = 2000E-12;# in Farads
V = 20;# in Volts
f = 10000;# in Hz
#calculation:
#power loss = w*C*V**2*tan(del)
#loss angle
de = math.atan(P/(2*math.pi*f*V*V*C))
#for an equivalent series circuit,
#tan(del) = (Rs*w*Cs)
Cs = C
Rs = (math.tan(de))/(2*math.pi*f*Cs)
#for an equivalent parallel circuit
#tan(del) = 1/(Rp*w*Cp)
Cp = C
Rp = 1/(2*math.pi*f*Cp*math.tan(de))
#Results
print "\n\n Result \n\n"
print "\n (a)loss angle ",round(de*180/math.pi,2),"deg"
print "\n (b)series resistance ",round(Rs,2)," ohm."
print "\n (c)parallel resistance ",round(Rp/1000,2),"Kohm."