from __future__ import division
import math
#given  data  :
E_max=500;#  emf  in  volts
thita=30;#  in  degree
#calculations:
e=E_max*math.sin(thita*math.pi/180);
#Results
print  "instantaneous  value,e(v)  =  ",e 
from __future__ import division
import math
#given  data  :
I_max=1.414;#  maximum  value  of  current  in  A
#calculations:
I_rms=I_max*0.707;
#Results
print  "rms  value  of  current,I_rms(A) = ",round(I_rms)
from __future__ import division
import math
#given  data  :
f=50;#  frequency  in  Hz
L=0.2;#  inductance  in  H
V=220;#  voltage  in  volts
#calculations:
XL=2*math.pi*f*L#  in  ohm
Z=XL;
I=V/Z;
#Results
print  "current  drawn,I(A)  =  ",round(I,2)
from __future__ import division
import math
#given  data  :
f=50;#  frequency  in  Hz
C=100*10**-6#  capacitor  in  Farad
V=210;#  voltage  in  volts
#calculations:
XC=(1/(2*math.pi*f*C));
Z=XC;
I=V/Z;
#Results
print  "current  flowing,I(A)  =  ",round(I,2)
from __future__ import division
import math
#given  data  :
f=50;#  frequency  in  Hz
L=0.4;#  inductance  in  H
V=220;#  voltage  in  volts
f1=25;#  frequency  is  halved
f2=100;#  frequency  is  doubled
#calculations:
XL=2*math.pi*f*L;
I=V/XL;
XL1=2*math.pi*f1*L;
I1=V/XL1;
XL2=2*math.pi*f2*L;
I2=V/XL2;
#Results
print  "current  flowing,I(A)  =  ",round(I,2) 
print  "(a)current  when  frequency  is  halved,I(A)  =  ",round(I1,2)
print  "current  when  frequency  is  doubled,I(A)  =  ",round(I2,3)
from __future__ import division
import math
#given  data  :
f=50;#  frequency  in  Hz
C=28*10**-6#  capacitor  in  Farad
V=250;#  voltage  in  volts
f1=25#  when  frequency  is  halved
f2=100#  when  frequency  is  doubled
#calculations:
XC=1/(2*math.pi*f*C);
I=V/XC;
XC1=1/(2*math.pi*f1*C);
I1=V/XC1;
XC2=1/(2*math.pi*f2*C);
I2=V/XC2;
#Results
print  "current  flowing,I(A)  =  ",round(I,1)
print  "current  flowing  when  frequency  is  halved,I(A)  =  ",round(I1,1)
print  "current  flowing  when  frequency  is  doubled  ,I(A)  =",round(I2,1)
from __future__ import division
import math
#given data:
R=40  #in  ohms
L=0.07#IN  HENRY
V=223#IN  VOLTS
F=50  #  IN  HERTS
#calculations:
Xl=2*math.pi*F*L#  inductive  reactance  in  ohms
Z=(R**2+Xl**2)**0.5#IMPEDENCE  IN  OHMS
I=V/Z;#in  amperes
csp=R/Z#pf
phi=math.acos(csp)#angle  of  phase  differnce  in  degree
def decdeg2dms(dd):
    mnt,sec = divmod(dd*3600,60)
    deg,mnt = divmod(mnt,60)
    return deg,mnt,sec
phiAct = decdeg2dms(phi*180/math.pi)
#Results
print  "inductive  reactance  in  ohms  is",round(Xl)
print  "impedence  in  ohms  is",round(Z,2) 
print  "current  in  amperes  is",round(I,1)
print  "angle  of  phase  difference  is  ",phiAct[0],"Degrees and ",phiAct[1],"minutes"
from __future__ import division
import math
#given data:
V=200#in  volts
I=2.5#  in  amperes
Vo=250#  in  volts
f=50  #  in  hertz
#calculations:
R=V/I#  in  ohms
Z=Vo/I#  in  ohms
Xl=(Z**2-R**2)**0.5#inductive  reactance  in  ohms
L=(Xl/(2*math.pi*f))#inductance  in  henry
pf=R/Z#power  factor
phi=math.acos(pf)#angle  of  phase  differnce  in  degree
def decdeg2dms(dd):
    mnt,sec = divmod(dd*3600,60)
    deg,mnt = divmod(mnt,60)
    return deg,mnt,sec
phiAct = decdeg2dms(phi*180/math.pi)
#Results
print  "inductance  in  henry  is",round(L,4)
print  "angle  of  phase  difference  is  ",phiAct[0],"Degrees and ",phiAct[1],"minutes"
from __future__ import division
import math
#given data:
W=100#in  watts
V=110#in  volts
Vc=220#in  volts
f=50  #in  hertz
#calculations:
I=W/V#  in  amperes
R=V/I#in  ohms
Z=Vc/I#  in  ohms
Xc=math.sqrt(Z**2-R**2)#  IN  OHMS
C=(1/(2*math.pi*f*Xc))#  in  farads
#Results
print  "capacitance  in  micro  farads  is",round(C*10**6,2)
from __future__ import division
import math
#given data:
R=5.94#in  ohms
L=0.35#IN  HENRY
C=35  #  in  micro  farads
V=220#IN  VOLTS
F=50  #  IN  HERTS
#calculations:
Xc=(1/(2*math.pi*F*C*10**-6))#  capacitive  reactance  in  ohms
Xl=2*math.pi*F*L#  inductive  reactance  in  ohms
Z=math.sqrt(R**2+(Xl-Xc)**2)#  impedence  in  ohms
I=V/round(Z)#  in  amperes
pf=R/round(Z)#  power  factor
Zc=math.sqrt(R**2+Xl**2)#impedence  of  the  coil
Vl=I*Zc#voltage  drop  across  the  coil
Vc=I*Xc#voltage  drop  across  the  capacitor
W=I**2*R#total  power  taken  in  watts
#Results
print  "(a)impedence  in  ohms  is",round(Z)
print  "(b)current  in  amperes  is",I
print  "(c)angle  of  phase  diffence  between  voltage  and  current  is",pf
print  "(d)voltage  across  the  coil  in  volts  is",round(Vl,1)
print  "(e)voltage  across  capacitor  in  volts  is",round(Vc,1)
print  "(f)total  power  taken  in  watts  is",round(W,1)
from __future__ import division
import math
#given data:
r1=6  #in  ohms
r2=3.95#in  ohms
R=r1+r2#in  ohms
L1=0.21#IN  HENRY
L2=0.14#in  henry
C1=30#  in  micro  farads
C2=60#in  micro  farads
V=220#IN  VOLTS
F=50  #  IN  HERTS
#calculations:
Xc1=(1/(2*math.pi*F*C1*10**-6))#  capacitive  reactance  in  ohms
Xc2=(1/(2*math.pi*F*C2*10**-6))#  capacitive  reactance  in  ohms
Xc=Xc1+Xc2#IN  OHMS
Xl1=2*math.pi*F*L1#  inductive  reactance  in  ohms
Xl2=2*math.pi*F*L2#  inductive  reactance  in  ohms
Xl=Xl1+Xl2#in  ohms
Z=math.sqrt(R**2+(Xl-Xc)**2)#  impedence  in  ohms
I=V/Z#
pf=R/Z#  leading  power  factor
#Results
print  "(a)impedence  in  ohms  is",round(Z)
print  "(b)current  in  amperes  is",round(I)
print  "(c)power  factor  (leading)  is",round(pf,3)
from __future__ import division
import math
#given data:
V=200#  in  volts
L=0.04#  in  henry
C=100#in  micro  fards
f=50  #  hertz
Z1=10#ohms
R1=10#  in  ohms
X1=0  #  in  ohms
R2=5  #  in  ohms
R3=15#  in  ohms
#calculations:
Xl=2*math.pi*f*L#inductive  reactance  in  ohms
Xc=(1/(2*math.pi*f*C*10**-6))#CAPACITIVE  REACTANCE  IN  OHMS
Z2=math.sqrt(R2**2+Xl**2)#in  ohms
X2=Xl#
Z3=math.sqrt(R3**2+Xc**2)#  IN  OHMS
X3=Xc#
g1=R1/(Z1)**2#  conductance  of    branch  1  in  mho
b1=X1/(Z1)**2#susceptance  in  mho  in  branch  1
g2=R2/(Z2)**2#  conductance  of    branch  2  in  mho
b2=X2/(Z2)**2#susceptance  in  mho  in  branch  2
g3=R3/(Z3)**2#  conductance  of    branch  3  in  mho
b3=X3/(Z3)**2#susceptance  in  mho  in  branch  3
G=g1+g2+g3#  total  conductance  in  mho
B=b1+b2-b3#  total  susceptance  in  mho
Y=math.sqrt(G**2+B**2)#in  ohms
I0=V*Y#curent  in  ampere
theta=math.acos(G/Y)#
def decdeg2dms(dd):
    mnt,sec = divmod(dd*3600,60)
    deg,mnt = divmod(mnt,60)
    return deg,mnt,sec
phiAct = decdeg2dms(theta*180/math.pi)
I=V/Z3#curent  in  amperes
pf3=R3/Z3#power  factor
phi=math.acos(pf3)#angle  of  phase  differnce  in  degree
tc3=pf3#
ts3=math.sin(phi)
pf1=R1/R1#
tc1=pf1#
ts1=math.sin(math.acos(pf1))#
I1=V/Z1#
E1=I1*tc1#  energy  component  in  branch  1
EL1=I1*ts1#  idel  current  component  in  branch  1
I2=V/Z2#
pf2=R2/Z2#
tc2=pf2#
ts2=math.sin(math.acos(pf2))#
E2=I2*tc2#ENERGY  COMPONENT  IN  BRANCH2
EL2=I2*ts2#idele  current  component  in  branch  2
E3=I*tc3#energy  component  in  branch3
EL3=I*ts3#idle  component  of  current  in  branch  3
E=E1+E2+E3#sum  of  energy  component  of  current
EL=EL1+EL2-EL3#sum  of  idel  component  of  current
It=math.sqrt(E**2+EL**2)#  total  current
pft=E/It#power  factor  of  the  complete  circuit
phi=math.acos(0.95)#angle  of  phase  differnce  in  degree
Zt=V/It#in  ohms
R=Zt*pft#equivalent  series  resistance
X=Zt*(math.sin(phi))#equivalent  series  reactance
#Results
print "(a)current  in  amperes  is",round(I0)
print  "Phase angle  is  ",phiAct[0],"Degrees and ",phiAct[1],"minutes"
print  "(c)equivalent  series  resistance  in  ohms  is",round(R,2)
print  "euivalent  series  reactance  in  ohms  is",round(X,3)