from math import sqrt,atan,pi
# A 27-Ohms R is in series with 54 Ohms of Xl and 27 Ohms of Xc. The applied voltage Vt is 50 mV. Calculate ZT, I, and Theta z.
# Given data
R = 27.# # Resistance=27 Ohms
Xl = 54.# # Inductive reactance=54 Ohms
Vt = 50.*10**-3# # Applied voltage=100 Volts
Xc = 27.# # Capacitive reactance=27 Ohms
nXl = Xl-Xc# # Net Inductive reactance
R1 = R*R#
nXl1 = nXl*nXl#
Zt = sqrt(R1+nXl1)#
print 'Total Impedence Zt = %0.2f Ohms'%Zt
I = (Vt/Zt)#
print 'Current I = %0.2f Ampers'%I
print 'i.e 1.31 mAmps'
Oz = atan(Xc/R)*180/pi
print 'Theta z = %0.2f Degree'%Oz
from math import atan,pi,sqrt
# The following branch currents are supplied from a 50-mV source: Ir=1.8 mA# Il=2.8 mA# Ic=1 mA. Calculate It, Zeq, and Theta I.
# Given data
Va = 50.*10**-3# # Applied voltage=50m Volts
Ir = 1.8*10**-3# # Ir=1.8 mAmps
Il = 2.8*10**-3# # Ir=2.8 mAmps
Ic = 1.*10**-3# # Ic=1 mAmps
nI = Il-Ic# # net current
Ir1 = Ir*Ir#
nI1 = nI*nI#
It = sqrt(Ir1+nI1)#
print 'The Total Current It = %0.2f Amps'%It
print 'i.e 2.55 mAmps'
Zeq = Va/It#
print 'The Equivqlent Impedence Zeq = %0.2f Ohms'%Zeq
print 'approx 19.61 Ohms'
Oz = atan(-(nI/Ir))*180/pi
print 'Theta z = %0.2f Degree'%Oz