In [6]:

```
from __future__ import division
import math
#initializing the variables:
R = 20;# in Ohms
L = 2.387E-3;# in Henry
V = 60;# in Volts
f = 1000;# in Hz
#calculation:
IR = V/R
XL = 2*math.pi*f*L
IL = V/XL
I = (IR**2 + IL**2)**0.5
phi = math.atan(IL/IR)
phid = phi*180/math.pi
Z = V/I
P = V*I*math.cos(phi)
#Results
print "\n\n Result \n\n"
print "\n (a)Current through resistor is ",round(IR,2)," A and current through Inductor is ",round( IL,2)," A"
print "\n (b)current, I = ",round(I,2)," A "
print "\n (c)phase angle = ",round(phid,2),"deg lagging"
print "\n (d)Impedance Z = ",round(Z,2)," Ohm "
print "\n (e)Power consumed = ",round(P,2)," Watt "
```

In [5]:

```
from __future__ import division
import math
#initializing the variables:
R = 80;# in Ohms
C = 30E-6;# in Farads
V = 240;# in Volts
f = 50;# in Hz
#calculation:
IR = V/R
Xc = 1/(2*math.pi*f*C)
Ic = V/Xc
I = (IR**2 + Ic**2)**0.5
phi = math.atan(Ic/IR)
phid = phi*180/math.pi
Z = V/I
P = V*I*math.cos(phi)
S = V*I
#Results
print "\n\n Result \n\n"
print "\n (a)Current through resistor is ",round(IR,2)," A and current through capacitor is ",round( Ic,2)," A"
print "\n (b)current, I = ",round(I,2)," A "
print "\n (c)phase angle = ",round(phid,2),"deg leading"
print "\n (d)Impedance Z = ",round(Z,2)," Ohm "
print "\n (e)Power consumed = ",round(P,2)," Watt "
print "\n (f)apparent Power = ",round(S,2)," VA "
```

In [3]:

```
from __future__ import division
import math
#initializing the variables:
pf = 0.6;# power factor
V = 120;# in Volts
f = 200;# in Hz
I = 2;# in Amperes
#calculation:
phi = math.acos(pf)
phid = phi*180/math.pi
IR = I*math.cos(phi)
Ic = I*math.sin(phi)
R = V/IR
C = Ic/(2*math.pi*f*V)
#Results
print "\n\n Result \n\n"
print "\n (a)Resistance R = ",round(R,2)," Ohm "
print "\n (b)Capacitance,C = ",round((C/1E-6),2)," uF "
```

In [7]:

```
from __future__ import division
import math
#initializing the variables:
C = 25E-6;# in Farads
L = 120E-3;# in Henry
V = 100;# in Volts
f = 50;# in Hz
#calculation:
XL = 2*math.pi*f*L
IL = V/XL
Xc = 1/(2*math.pi*f*C)
Ic = V/Xc
#IL and Ic are anti-phase. Hence supply current,
I = IL - Ic
#the current lags the supply voltage V by 90Â°
phi = math.pi/2
phid = phi*180/math.pi
Z = V/I
P = V*I*math.cos(phi)
#Results
print "\n\n Result \n\n"
print "\n (a)Current through Inductor is ",round(IL,2)," A and current through capacitor is ",round( Ic,2)," A"
print "\n (b)current, I = ",round(I,2)," A "
print "\n (c)phase angle = ",round(phid,2),"deg lagging"
print "\n (d)Impedance Z = ",round(Z,2)," Ohm "
print "\n (e)Power consumed = ",round(P,2)," Watt "
```

In [8]:

```
from __future__ import division
import math
#initializing the variables:
C = 25E-6;# in Farads
L = 120E-3;# in Henry
V = 100;# in Volts
f = 150;# in Hz
#calculation:
XL = 2*math.pi*f*L
IL = V/XL
Xc = 1/(2*math.pi*f*C)
Ic = V/Xc
#IL and Ic are anti-phase. Hence supply current,
I = Ic - IL
#the current leads the supply voltage V by 90Â°
phi = math.pi/2
phid = phi*180/math.pi
Z = V/I
P = V*I*math.cos(phi)
#Results
print "\n\n Result \n\n"
print "\n (a)Current through Inductor is ",round(IL,2)," A and current through capacitor is ",round( Ic,2)," A"
print "\n (b)current, I = ",round(I,2)," A "
print "\n (c)phase angle = ",round(phid,2),"deg leading"
print "\n (d)Impedance Z = ",round(Z,2)," Ohm "
print "\n (e)Power consumed = ",round(P,2)," Watt "
```

In [3]:

```
from __future__ import division
import math
#initializing the variables:
C = 30E-6;# in Farads
R = 40;# in Ohms
L = 159.2E-3;# in Henry
V = 240;# in Volts
f = 50;# in Hz
#calculation:
XL = 2*math.pi*f*L
Z1 = (R**2 + XL**2)**0.5
ILR = V/Z1
phi1 = math.atan(XL/R)
phi1d = phi1*180/math.pi
Xc = 1/(2*math.pi*f*C)
Ic = V/Xc
phi2 = math.pi/2
phi2d = phi2*180/math.pi
Ih = ILR*math.cos(phi1) + Ic*math.cos(phi2)
Iv = -1*ILR*math.sin(phi1) + Ic*math.sin(phi2)
I = (Ih**2 + Iv**2)**0.5
phi = math.atan(abs(Iv)/Ih)
Z = V/I
P = V*I*math.cos(phi)
phid = phi*180/math.pi
S = V*I
Q = V*I*math.sin(phi)
#Results
print "\n\n Result \n\n"
print "\n (a)Current through coil is ",round(ILR,2)," A and lagged by phase angle is ",round(phi1d,2),"deg"
print "\n (b)Current through capacitor is ",round(Ic,2)," A and lead by phase angle is ",round(phi2d,2),"deg"
print "\n (c)supply Current is ",round(I,2)," A and lagged by phase angle is ",round(phid,2),"deg"
print "\n (d)Impedance Z = ",round(Z,2)," Ohm "
print "\n (e)Power consumed = ",round(P,2)," Watt "
print "\n (f)apparent Power = ",round(S,2)," VA "
print "\n (g)reactive Power = ",round(Q,2)," var "
```

In [9]:

```
from __future__ import division
import math
#initializing the variables:
C = 0.02E-6;# in Farads
R = 3000;# in Ohms
L = 120E-3;# in Henry
V = 40;# in Volts
f = 5000;# in Hz
#calculation:
XL = 2*math.pi*f*L
Z1 = (R**2 + XL**2)**0.5
ILR = V/Z1
phi1 = math.atan(XL/R)
phi1d = phi1*180/math.pi
Xc = 1/(2*math.pi*f*C)
Ic = V/Xc
phi2 = math.pi/2
phi2d = phi2*180/math.pi
Ih = ILR*math.cos(phi1) + Ic*math.cos(phi2)
Iv = -1*ILR*math.sin(phi1) + Ic*math.sin(phi2)
I = (Ih**2 + Iv**2)**0.5
phi = math.atan((Iv)/Ih)
phid = phi*180/math.pi
Z = V/I
P = V*I*math.cos(phi)
#Results
print "\n\n Result \n\n"
print "\n (a)Current through coil is ",round(ILR*1000,2),"mA and lagged by phase angle is ",round(phi1d,1),"deg"
print "\n (b)Current through capacitor is ",round(Ic*1000,2),"mA and lead by phase angle is ",round(phi2d,2),"deg"
print "\n (c)supply Current is ",round(I*1000,1),"mA and leaded by phase angle is ",round(phid,2),"deg"
print "\n (d)Impedance Z = ",round(Z/1000,3),"KOhm "
print "\n (e)Power consumed = ",round(P*1000,1),"mWatt "
```

In [5]:

```
from __future__ import division
import math
#initializing the variables:
C = 40E-6;# in Farads
R = 0;# in Ohms
L = 150E-3;# in Henry
V = 50;# in Volts
#calculation:
fr = ((1/(L*C) - R*R/(L*L))**0.5)/(2*math.pi)
Xc = 1/(2*math.pi*fr*C)
Icirc = V/Xc
#Results
print "\n\n Result \n\n"
print "\n (a)Parallel resonant frequency, fr = ",round(fr,2)," Hz "
print "\n (b)Current circulating in L and C at resonance = ",round(Icirc,2)," A "
```

In [6]:

```
from __future__ import division
import math
#initializing the variables:
C = 20E-6;# in Farads
R = 60;# in Ohms
L = 200E-3;# in Henry
V = 20;# in Volts
#calculation:
fr = ((1/(L*C) - R*R/(L*L))**0.5)/(2*math.pi)
Rd = L/(R*C)
Ir = V/Rd
Q = 2*math.pi*fr*L/R
#Results
print "\n\n Result \n\n"
print "\n (a)Parallel resonant frequency, fr = ",round(fr,2)," Hz "
print "\n (b)the dynamic resistance,RD = ",round(Rd,2)," ohm "
print "\n (c)Current at resonance = ",round(Ir,2)," A "
print "\n (d)Q-factor = ",round(Q,2)
```

In [7]:

```
from __future__ import division
import math
#initializing the variables:
fr = 5000;# in ohm
R = 800;# in Ohms
L = 100E-3;# in Henry
V = 12;# in Volts
#calculation:
C = 1/(L*((2*math.pi*fr)**2 + R*R/(L*L)))
Rd = L/(R*C)
Ir = V/Rd
Q = 2*math.pi*fr*L/R
#Results
print "\n\n Result \n\n"
print "\n (a)capacitance, C = ",round((C/1E-9),2)," nF "
print "\n (b)the dynamic resistance,RD = ",round(Rd,2)," ohm "
print "\n (c)Current at resonance = ",round((Ir/1E-3),2)," mA "
print "\n (d)Q-factor = ",round(Q,2)
```

In [1]:

```
from __future__ import division
import math
#initializing the variables:
f = 50;# in ohm
V = 240;# in Volts
pf = 0.6;# power factor
Im = 50;# in amperes
#calculation:
phi = math.acos(pf)
phid = phi*180/math.pi
Ic = Im*math.sin(phi)
I = Im*math.cos(phi)
#Results
print "\n\n Result \n\n"
print "\n (a)the capacitor current Ic must be ",round(Ic,2)," A for the power factor to be unity. "
print "\n (b)Supply current I = ",round(I,2)," A "
```

In [4]:

```
from __future__ import division
import math
#initializing the variables:
Pout = 4800;# in Watt
eff = 0.8# effficiency
f = 50;# in ohm
V = 240;# in Volts
pf1 = 0.625;# power factor
pf2 = 0.95;# power factor
#calculation:
Pin = Pout/eff
Im = Pin/(V*pf1)
phi1 = math.acos(pf1)
phi1d = phi1*180/math.pi
phi2 = math.acos(pf2)
phi2d = phi2*180/math.pi
Imh = Im*math.cos(phi1)
#Ih = I*cos(phi2)
Ih = Imh
I = Ih/math.cos(phi2)
Imv = Im*math.sin(phi1)
Iv = I*math.sin(phi2)
Ic = Imv - Iv
C = Ic/(2*math.pi*f*V)
kvar = V*Ic/1000
#Results
print "\n\n Result \n\n"
print "\n (a)current taken by the motor, Im = ",round(Im,2)," A"
print "\n (b)supply current after p.f. correction, I = ",round(I,2)," A "
print "\n (c)magnitude of the capacitor current Ic = ",round(Ic,0)," A"
print "\n (d)capacitance, C = ",round((C/1E-6),0)," uF "
print "\n (d)kvar rating of the capacitor = ",round(kvar,2)," kvar "
```

In [10]:

```
from __future__ import division
import math
#initializing the variables:
S = 3000;# in VA
f = 50;# in ohm
V = 250;# in Volts
Iil = 10;# in Amperes
Ifl = 8;# in Amperes
pfil = 1; # power factor
pffl = 0.7;# power factor
pfm = 0.8;# power factor
pf0 = 0.975;# power factor
#calculation:
phiil = math.acos(pfil)
phiild = phiil*180/math.pi
phifl = math.acos(pffl)
phifld = phifl*180/math.pi
phim = math.acos(pfm)
phimd = phim*180/math.pi
phi0 = math.acos(pf0)
phi0d = phi0*180/math.pi
Im = S/V
Ih = Iil*math.cos(phiil) + Ifl*math.cos(phifl) + Im*math.cos(phim)
Iv = Iil*math.sin(phiil) - Ifl*math.sin(phifl) - Im*math.sin(phim)
Il = (Ih**2 + Iv**2)**0.5
phi = math.atan(abs(Iv)/Ih)
phid = phi*180/math.pi
pf = math.cos(phi)
P = V*Il*pf
I = Il*math.cos(phi)/math.cos(phi0)
Ic = Il*math.sin(phi) - I*math.sin(phi0)
C = Ic/(2*math.pi*f*V)
#Results
print "\n\n Result \n\n"
print "\n (a)total current, Il = ",round(Il,2)," A"
print "\n (b)Power factor = ",round(pf,2),"lagging"
print "\n (c)Total power, P = ",round(P/1000,2),"KWatt"
print "\n (d)capacitance, C = ",round((C/1E-6),2),"uF "
```