from __future__ import division
import math
import cmath
#initializing the variables:
Z1 = 0 - 5j;# in ohms
Z2 = 25 + 40j;# in ohms
Z3 = 3 - 2j;# in ohms
r4 = 50;# in ohms
theta4 = 40;# in degrees
#calculation:
#admittance Y
Y1 = 1/Z1
#conductance, G
G1 = Y1.real
#Suspectance, Bc
Bc1 = abs(Y1.imag)
#admittance Y
Y2 = 1/Z2
#conductance, G
G2 = Y2.real
#Suspectance, Bc
Bc2 = abs(Y2.imag)
#admittance Y
Y3 = 1/Z3
#conductance, G
G3 = Y3.real
#Suspectance, Bc
Bc3 = abs(Y3.imag)
Z4 = r4*math.cos(theta4*math.pi/180) + 1j*r4*math.sin(theta4*math.pi/180)
#admittance Y
Y4 = 1/Z4
#conductance, G
G4 = Y4.real
#Suspectance, Bc
Bc4 = abs(Y4.imag)
#Results
print "\n\n Result \n\n"
print "\n (a)admittance Y is (",round(Y1.real,2)," + (",round(Y1.imag,2),")i) S, "
print " conductance, G is ",round(G1,2)," S, susceptance,Bc is ",round(Bc1,2)," S\n"
print "\n (b)admittance Y is (",round(Y2.real,2)," + (",round(Y2.imag,2),")i) S, "
print " conductance, G is ",round(G2,2)," S, susceptance,Bc is ",round(Bc2,2)," S\n"
print "\n (c)admittance Y is (",round(Y3.real,2)," + (",round(Y3.imag,2),")i) S, "
print " conductance, G is ",round(G3,2)," S, susceptance,Bc is ",round(Bc3,2)," S\n"
print "\n (d)admittance Y is (",round(Y4.real,2)," + (",round(Y4.imag,2),")i) S, "
print " conductance, G is ",round(G4,2)," S, susceptance,Bc is ",round(Bc4,2)," S\n"
from __future__ import division
import math
import cmath
#initializing the variables:
Y2 = 0.001 - 0.002j;# in S
Y3 = 0.05 + 0.08j;# in S
r1 = 0.004;# in S
theta1 = 30;# in degrees
#calculation:
#impedance, Z
Z2 = 1/Y2
Z3 = 1/Y3
Y1 = r1*math.cos(theta1*math.pi/180) + 1j*r1*math.sin(theta1*math.pi/180)
Z1 = 1/Y1
#Results
print "\n\n Result \n\n"
print "\n (a)Impedance,Z is (",round(Z1.real,2)," + (",round( Z1.imag,2),")i) ohm\n"
print "\n (b)Impedance,Z is (",round(Z2.real,2)," + (",round( Z2.imag,2),")i) ohm\n"
print "\n (c)Impedance,Z is (",round(Z3.real,2)," + (",round( Z3.imag,2),")i) ohm\n"
from __future__ import division
import math
import cmath
#initializing the variables:
Y = 0.040 - 1j*0.025;# in S
#calculation:
#impedance, Z
Z = 1/Y
#conductance, G
G = Y.real
#Suspectance, Bc
Bc = abs(Y.imag)
#parallrl
#resistance, R
Rp = 1/G
#capacitive reactance
Xcp = 1/Bc
#series
#resistance, R
Rs = Z.real
#capacitive reactance
Xcs = abs(Z.imag)
#Results
print "\n\n Result \n\n"
print "\n (a)for parallel, resistance,R is ",round(Rp,2)," ohm and capacitive reactance, Xc is ",round(Xcp,2)," ohm\n"
print "\n (b)forseries, resistance,R is ",round(Rs,2)," ohm and capacitive reactance, Xc is ",round(Xcs,2)," ohm\n"
from __future__ import division
import math
import cmath
#initializing the variables:
R1 = 8;# in ohm
R = 5;# in ohm
R2 = 6;# ohm
rv = 50;# in volts
thetav = 0;# in degrees
#calculation:
#voltage,V
V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)
#circuit impedance, ZT
ZT = R + (R1*1j*R2/(R1 + 1j*R2))
#Current I
I = V/ZT
#current,I1
I1 = I*(1j*R2/(R1 + 1j*R2))
#current, I2
I2 = I*(R1/(R1 + 1j*R2))
#Results
print "\n\n Result \n\n"
print "\n current, I = ",round(abs(I),2),"/_",round(cmath.phase(complex(I.real, I.imag))*180/math.pi,2),"deg A,"
print "current,I1 = ",round(abs(I1),2),"/_",round(cmath.phase(complex(I1.real, I1.imag))*180/math.pi,2),"deg A, "
print "current, I2 = ",round(abs(I2),2),"/_",round(cmath.phase(complex(I2.real, I2.imag))*180/math.pi,2),"deg A\n"
from __future__ import division
import math
import cmath
#initializing the variables:
R1 = 5;# in ohm
R2 = 3;# in ohm
R3 = 8;# ohm
Xc = 4;# in ohms
XL = 12;# in Ohms
V = 40;# in volts
f = 50;# in Hz
#calculation:
Z1 = R1 + 1j*XL
Z2 = R2 - 1j*Xc
Z3 = R3
#circuit admittance, YT = 1/ZT
YT = (1/Z1) + (1/Z2) + (1/Z3)
#Current I
I = V*YT
I1 = V/Z1
I2 = V/Z2
I3 = V/Z2
thetav = 0
thetai = cmath.phase(complex(I.real, I.imag))*180/math.pi
phi = thetav - thetai
if (phi>0):
a = "lagging"
else:
a = "leading"
#Results
print "\n\n Result \n\n"
print "\n current, I is (",round(I.real,2)," + (",round(I.imag,2),")i) A,"
print "and its phase relative to the 40 V supply is ",a,"s by ",round(abs(phi),2),"deg\n"
from __future__ import division
import math
import cmath
#initializing the variables:
L = 0.07958;# in Henry
R = 18;# in ohm
C = 64.96E-6;# in Farad
rv = 250;# in volts
thetav = 0;# in degrees
f = 50;# in Hz
#calculation:
#Inductive reactance
XL = 2*math.pi*f*L
#capacitive reactance
Xc = 1/(2*math.pi*f*C)
#impedance of the coil,
Zcoil = R + 1j*XL
#impedance presented by the capacitor,
Zc = -1j*Xc
#Total equivalent circuit impedance,
ZT = Zcoil*Zc/(Zcoil + Zc)
#voltage
V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)
#current, I
I = V/ZT
thetai = cmath.phase(complex(I.real,I.imag))*180/math.pi
phi = thetav - thetai
if (phi>0):
a = "lagging"
else:
a = "leading"
#Current in the coil, ICOIL
Icoil = V/Zcoil
#Current in the capacitor, IC
Ic = V/Zc
#Results
print "\n\n Result \n\n"
print "\n (a)the circuit impedance is ",round(ZT.real,2)," + (",round( ZT.imag,2),")i ohm\n"
print "\n (b)supply current, I = ",round(abs(I),2),"/_",round(cmath.phase(complex(I.real, I.imag))*180/math.pi,2),"deg A\n"
print "\n (c)circuit phase relative is ",a,"s by ",round(abs(phi),2),"deg\n"
print "\n (d)current in coil, Icoil = ",round(abs(Icoil),2),"/_",round(cmath.phase(complex(Icoil.real, Icoil.imag))*180/math.pi,2),"deg A\n"
print "\n (e)current in capacitor, Ic = ",round(abs(Ic),2),"/_",round(cmath.phase(complex(Ic.real, Ic.imag))*180/math.pi,2),"deg A\n"
from __future__ import division
import math
import cmath
#initializing the variables:
RL = 6j;# in ohm
R2 = 8;# in ohm
Z3 = 10;# in ohm
rv = 50;# in volts
thetav = 30;# in degrees
ri = 31.4;# in amperes
thetai = 52.48;# in degrees
f = 5000;# in Hz
#calculation:
#impedance, Z2
Z2 = R2 + RL
#voltage
V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)
#current, I
I = ri*math.cos(thetai*math.pi/180) + 1j*ri*math.sin(thetai*math.pi/180)
#Total circuit admittance,
YT = I/V
#admittance, Y3
Y3 = 1/Z3
#admittance, Y2
Y2 = 1/Z2
#admittance, Y1
Y1 = YT - Y2 - Y3
#impedance, Z1
Z1 = 1/Y1
#Results
print "\n\n Result \n\n"
print "\n (a)the impedance Z1 is ",round(Z1.real,2)," + (",round( Z1.imag,2),")i ohm\n"
#resistance, R1
R1 = Z1.real
X1 = Z1.imag
if ((R1>0)&(X1<0)):
C1 = -1/(2*math.pi*f*X1)
print "\n (b)The series circuit thus consists of a resistor of resistance ",round(R1,2)," ohm"
print " and a capacitor of capacitance ",round(C1*1E6,2),"uFarad\n"
elif ((R1>0)&(X1>0)):
L1 = 2*math.pi*f*X1
print "\n (b)The series circuit thus consists of a resistor of resistance ",round(R1,2)," ohm "
print " and a inductor of insuctance ",round(L1*1000,2),"mHenry\n"
from __future__ import division
import math
import cmath
#initializing the variables:
RL1 = 1.02j;# in ohm
R1 = 1.65;# in ohm
RLa = 7j;# in ohm
Ra = 5;# in ohm
Rcb = -1j*15;# in ohm
Rb = 4;# in ohm
rv = 91;# in volts
thetav = 0;# in degree
#calculation:
#voltage
V = rv*math.cos(thetav*math.pi/180) + 1j*rv*math.sin(thetav*math.pi/180)
#impedance, Z1
Z1 = R1 + RL1
#impedance, Za
Za = Ra + RLa
#impedance, Zb
Zb = Rb + Rcb
#impedance, Z, of the two branches connected in parallel
Z = Za*Zb/(Za + Zb)
#Total circuit impedance
ZT = Z1 + Z
#Supply current, I
I = V/ZT
thetai = cmath.phase(complex(I.real, I.imag))*180/math.pi
phi = thetav - thetai
if (phi>0):
a = "lagging"
else:
a = "leading"
#Voltage V1
V1 = I*Z1
#Voltage V2
V2 = I*Z
#current Ia
Ia = V2/Za
#Current Ib
Ib = V2/Zb
#Results
print "\n\n Result \n\n"
print "\n (a)equivalent series circuit impedance is ",round(ZT.real,2)," + (",round( ZT.imag,2),")i ohm\n"
print "\n (b)supply current, I is ",round(I.real,2)," + (",round( I.imag,2),")i A\n"
print "\n (c)circuit phase relative is ",a," by ",round(abs(phi),2),"deg\n"
print "\n (d)voltage, V1 is (",round(V1.real,2)," + (",round(V1.imag,2),")i) V and V2 is(",round(V2.real,2)," + (",round( V2.imag,2),")i) V\n"
print "\n (e)current, Ia is (",round(Ia.real,2)," + (",round( Ia.imag,2),")i) A and Ib is(",round(Ib.real,2)," + (",round( Ib.imag,2),")i) A\n"