Chapter 36: Complex Waveforms

Example 1, page no. 643

In [1]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
V = 240; # in Volts
f = 50; # in Hz
x = 0.2;
phi3 = 3*math.pi/4; # in Rad

 #calculation:
Vamp = V*2**0.5
w = 2*math.pi*f
T = 1/f
V3 = Vamp*x
f3 = 3*f
w3 = 3*w



#Results
print  "\n\n  Result  \n\n"
print  "\n  voltage, V =",round(Vamp,1),"sin(",round(w,1),"t) + ",round(V3,1),"sin(", round(w3,1),"t - ", round(phi3,1),") volts"

  Result  



  voltage, V = 339.4 sin( 314.2 t) +  67.9 sin( 942.5 t -  2.4 ) volts

Example 3, page no. 648

In [2]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
A1  =  0.100;#  in  amperes
A3  =  0.020;#  in  amperes
A5  =  0.010;#  in  amperes

 #calculation:
 #the  rms  value  of  current  is  given  by
Irms  =  ((A1**2  +  A3**2  +  A5**2)/2)**0.5


#Results
print  "\n\n  Result  \n\n"
print  "\n  the  rms  value  of  current  is  ",round(Irms*1000,2)," mA"

  Result  



  the  rms  value  of  current  is   72.46  mA

Example 4, page no. 649

In [3]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
A1  =  10;#  in  volts
A3  =  3;#  in  volts
A5  =  2;#  in  volts

#calculation:
 #the  rms  value  of  voltage  is  given  by
Vrms  =  ((A1**2  +  A3**2  +  A5**2)/2)**0.5
 #the  mean  value  of  voltage  is  given  by
 #x  =  wt
Vav  =  (1/math.pi)*((10 + 1 + 2/5)-(-10 - 1 - 2/5))
 #form  factor  is  given  by
ff  =  Vrms/Vav


#Results
print  "\n\n  Result  \n\n"
print  "\n  (a)the  rms  value  of  voltage  is  ",round(Vrms,2),"  V"
print  "\n  (b)the  mean  value  of  voltage  is  ",round(Vav,2),"  V"
print  "\n  (c)form  factor  is  ",round(ff,3),"  "

  Result  



  (a)the  rms  value  of  voltage  is   7.52   V

  (b)the  mean  value  of  voltage  is   7.26   V

  (c)form  factor  is   1.036   

Example 5, page no. 649

In [1]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
V  =  240;#  in  volts
x  =  0.3;#  for  third  harmonic
y  =  0.1;#  for  fifth  harmonic
f  =  31.83;#  in  Hz

 #calculation:
 #V3  =  x*V1
 #V5  =  y*V1
 #the  rms  value  of  the  fundamental,
V1  =  ((V**2)/(1  +  x**2  +  y**2))**0.5
 #Rms  value  of  the  third  harmonic
V3  =  x*V1
 #the  rms  value  of  the  fifth  harmonic,
V5  =  y*V1
 #Maximum  value  of  the  fundamental,
V1m  =  V1*2**0.5
 #Maximum  value  of  the  third  harmonic,
V3m  =  V3*2**0.5
 #Maximum  value  of  the  fifth  harmonic,
V5m  =  V5*2**0.5
w  =  2*math.pi*f


#Results
print  "\n\n  Result  \n\n"
print  "v  =  ",round(V1m,2),"sin",round(w,2),"t  +  ",round(V3m,2),"sin",round((3*w),2),"t  +  ",round(V5m,2),"sin",round((5*w),2),"t  Volts"

  Result  


v  =   323.62 sin 199.99 t  +   97.08 sin 599.98 t  +   32.36 sin 999.97 t  Volts

Example 6, page no. 652

In [5]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
A1  =  12;#  in  amperes
A3  =  5;#  in  amperes
A5  =  2;#  in  amperes
R  =  20;#  in  ohms

#calculation:
 #rms  current
Irms  =  ((A1**2  +  A3**2  +  A5**2)/2)**0.5
 #average  power
P  =  R*Irms**2


#Results
print  "\n\n  Result  \n\n"
print  "\n  average  power  ",P,"  W"

  Result  



  average  power   1730.0   W

Example 7, page no. 652

In [6]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
Ia1  =  2;#  in  amperes
Ia3  =  0.3;#  in  amperes
Ia5  =  0.1;#  in  amperes
Va1  =  60;#  in  volts
Va3  =  15;#  in  volts
Va5  =  10;#  in  volts
Phii1  =  -1*math.pi/6;#  in  radians
Phii3  =  -1*math.pi/12;#  in  radians
Phii5  =  -8*math.pi/9;#  in  radians
Phiv1  =  0;#  in  radians
Phiv3  =  math.pi/4;#  in  radians
Phiv5  =  -1*math.pi/2;#  in  radians


 #calculation:
 #rms  values;
I1  =  Ia1/(2**0.5);#  in  amperes
I3  =  Ia3/(2**0.5);#  in  amperes
I5  =  Ia5/(2**0.5);#  in  amperes
V1  =  Va1/(2**0.5);#  in  volts
V3  =  Va3/(2**0.5);#  in  volts
V5  =  Va5/(2**0.5);#  in  volts
 #total  power  supplied,
P  =  V1*I1*math.cos(Phiv1  -  Phii1)  +  V3*I3*math.cos(Phiv3  -  Phii3)  +  V5*I5*math.cos(Phiv5  -  Phii5)
 #rms  current
Irms  =  ((I1**2  +  I3**2  +  I5**2))**0.5
 #rms  voltage
Vrms  =  ((V1**2  +  V3**2  +  V5**2))**0.5
 #overall  power  factor
pf  =  P/(Vrms*Irms)


#Results
print  "\n\n  Result  \n\n"
print  "\n(a)the  total  active  power  supplied  to  the  circuit  ",round(P,2),"  W"
print  "\n(b)overall  power  factor  ",round(pf,2)

  Result  



(a)the  total  active  power  supplied  to  the  circuit   53.26   W

(b)overall  power  factor   0.84

Example 8, page no. 655

In [2]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
R1  =  40;#  in  ohm
L  =  7.96E-3;#  in  Henry
C = 25E-6; # in Farad
f = 1000; # in Hx

#calculation:
wL = 2*math.pi*1000*L
wC = 2*math.pi*1000*C

#Results
print  "\n\n  Result  \n\n"
print  "(a)i  =  ",round(100/R1,2),"sin(wt)  +",round(30/R1,2),"sin(3wt - pi/3)  +",round(10/R1,2),"sin(5wt - pi/6) A"
print  "(b)i  =  ",round(100/wL,2),"sin(wt - pi/2)  +",round(30/(3*wL),2),"sin(3wt - pi/6)  +",round(10/(5*wL),2),"sin(5wt - 2pi/3) A"
print  "(c)i  =  ",round(100*wC,2),"sin(wt + pi/2)  +",round(30*3*wC,2),"sin(3wt + 5pi/6)  +",round(10*5*wC,2),"sin(5wt + pi/3) A"

  Result  


(a)i  =   2.5 sin(wt)  + 0.75 sin(3wt - pi/3)  + 0.25 sin(5wt - pi/6) A
(b)i  =   2.0 sin(wt - pi/2)  + 0.2 sin(3wt - pi/6)  + 0.04 sin(5wt - 2pi/3) A
(c)i  =   15.71 sin(wt + pi/2)  + 14.14 sin(3wt + 5pi/6)  + 7.85 sin(5wt + pi/3) A

Example 9, page no. 656

In [7]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
V1m  =  240;#  in  volts
V3m  =  40;#  in  volts
V5m  =  30;#  in  volts
w1  =  314;#  fundamental
R  =  12;#  in  ohm
L  =  0.00955;#  in  Henry

 #calculation:
 #fundamental  or  first  harmonic
 #inductive  reactance,
XL1  =  w1*L
 #impedance  at  the  fundamental  frequency,
Z1  =  R  +  1j*XL1
 #Maximum  current  at  fundamental  frequency
I1m  =  V1m/Z1
I1mag  =  abs(I1m)
phii1  =  cmath.phase(complex(I1m.real,I1m.imag))
 #Third  harmonic
XL3  =  3*XL1
 #impedance  at  the  third  harmonic  frequency,
Z3  =  R  +  1j*XL3
 #Maximum  current  at  third  harmonic  frequency
I3m  =  V3m/Z3
I3mag  =  abs(I3m)
phii3  =  cmath.phase(complex(I3m.real,I3m.imag))
 #fifth  harmonic
XL5  =  5*XL1
 #impedance  at  the  third  harmonic  frequency,
Z5  =  R  +  1j*XL5
 #Maximum  current  at  third  harmonic  frequency
I5m  =  V5m/Z5
I5mag  =  abs(I5m)
phii5  =  cmath.phase(complex(I5m.real,I5m.imag))
 #rms  voltage
Vrms  =  ((V1m**2  +  V3m**2  +  V5m**2)/2)**0.5
 #rms  current
Irms  =  ((I1mag**2  +  I3mag**2  +  I5mag**2)/2)**0.5
 #power  dissipated
P  =  R*Irms**2
 #overall  power  factor
pf  =  P/(Vrms*Irms)


#Results
print  "\n\n  Result  \n\n"
print  "\n(a)i  =  ",round(I1mag,2),"sin(",round(w1,2),"t  +  (",round(phii1,2),"))  +  ",round(I3mag,2),"sin(",round((w1*3),2),"t  +  (",round(phii3,2),"))  +  ",round(I5mag,2),"sin(",round((w1*5),2),"t  +  (",round(phii5,2),"))  A"
print  "\n(b)the  rms  value  of  current  is  ",round(Irms,2),"  A"
print  "\n(c)the  rms  value  of  voltage  is  ",round(Vrms,2),"  V"
print  "\n(d)the  total  power  dissipated  ",round(P,2),"  W"
print  "\n(e)overall  power  factor  ",round(pf,2)

  Result  



(a)i  =   19.4 sin( 314.0 t  +  ( -0.24 ))  +   2.67 sin( 942.0 t  +  ( -0.64 ))  +   1.56 sin( 1570.0 t  +  ( -0.9 ))  A

(b)the  rms  value  of  current  is   13.89   A

(c)the  rms  value  of  voltage  is   173.35   V

(d)the  total  power  dissipated   2316.26   W

(e)overall  power  factor   0.96

Example 10, page no. 658

In [3]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
Vom  =  50;#  in  volts
V1m  =  200;#  in  volts
V2m  =  40;#  in  volts
V4m  =  5;#  in  volts
f  =  50;#  in  Hz
R  =  50;#  in  ohm
C  =  100E-6;#  in  farad
phiv1  =  0;#  in  rad
phiv2  =  -1*math.pi/2;#  in  rad
phiv4  =  math.pi/4;#  in  rad

 #calculation:
 #voltage
V1  =  V1m*math.cos(phiv1)  +  1j*V1m*math.sin(phiv1)
V2  =  V2m*math.cos(phiv2)  +  1j*V2m*math.sin(phiv2)
V4  =  V4m*math.cos(phiv4)  +  1j*V4m*math.sin(phiv4)
 #Inductance  has  no  effect  on  a  steady  current.  Hence  the  d.c.  component  of  the  current,  i0,  is  given  by
Iom  =  0
 #fundamental  or  first  harmonic
w1  =  2*math.pi*f
 #inductive  reactance,
Xc1  =  1/(w1*C)
 #impedance  at  the  fundamental  frequency,
Z1  =  R  +  1j*Xc1
 #Maximum  current  at  fundamental  frequency
I1m  =  V1/Z1
I1mag  =  abs(I1m)
phii1  =  cmath.phase(complex(I1m.real,I1m.imag))
 #second  harmonic
Xc2  =  Xc1/2
 #impedance  at  the  third  harmonic  frequency,
Z2  =  R  +  1j*Xc2
 #Maximum  current  at  third  harmonic  frequency
I2m  =  V2/Z2
I2mag  =  abs(I2m)
phii2  =  cmath.phase(complex(I2m.real,I2m.imag))
 #fourth  harmonic
Xc4  =  Xc1/4
 #impedance  at  the  third  harmonic  frequency,
Z4  =  R  +  1j*Xc4
 #Maximum  current  at  third  harmonic  frequency
I4m  =  V4/Z4
I4mag  =  abs(I4m)
phii4  =  cmath.phase(complex(I4m.real,I4m.imag))
 #rms  current
Irms  =  (Iom**2  +  (I1mag**2  +  I2mag**2  +  I4mag**2)/2)**0.5


#Results
print  "\n\n  Result  \n\n"
print  "(a)i = ",round(Iom,2)," + ",round(I1mag,2),"sin(",round(w1,2),"t  +  (",round(phii1,2),"))  +  ",round(I2mag,2),"sin(",round((w1*2),2),"t  +  (",round(phii2,2),"))  +  ",round(I4mag,2),"sin(",round((w1*4),2),"t  +  (",round(phii4,2),"))  A"
print  "(b)the  rms  value  of  current  is  ",round(Irms,2),"  A"

  Result  


(a)i =  0.0  +  3.37 sin( 314.16 t  +  ( -0.57 ))  +   0.76 sin( 628.32 t  +  ( -1.88 ))  +   0.1 sin( 1256.64 t  +  ( 0.63 ))  A
(b)the  rms  value  of  current  is   2.45   A

Example 11, page no. 659

In [4]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
Vom  =  25;#  in  volts
V1m  =  100;#  in  volts
V3m  =  40;#  in  volts
V5m  =  20;#  in  volts
w1  =  10000;#  fundamental
R  =  5;#  in  ohm
L  =  500E-6;#  in  Henry
phiv1  =  0;#  in  rad
phiv3  =  math.pi/6;#  in  rad
phiv5  =  math.pi/12;#  in  rad

 #calculation:
 #voltage
V1  =  V1m*math.cos(phiv1)  +  1j*V1m*math.sin(phiv1)
V3  =  V3m*math.cos(phiv3)  +  1j*V3m*math.sin(phiv3)
V5  =  V5m*math.cos(phiv5)  +  1j*V5m*math.sin(phiv5)
 #Inductance  has  no  effect  on  a  steady  current.  Hence  the  d.c.  component  of  the  current,  i0,  is  given  by
Iom  =  Vom/R
 #fundamental  or  first  harmonic
 #inductive  reactance,
XL1  =  w1*L
 #impedance  at  the  fundamental  frequency,
Z1  =  R  +  1j*XL1
 #Maximum  current  at  fundamental  frequency
I1m  =  V1/Z1
I1mag  =  abs(I1m)
phii1  =  cmath.phase(complex(I1m.real,I1m.imag))
#Third  harmonic
XL3  =  3*XL1
 #impedance  at  the  third  harmonic  frequency,
Z3  =  R  +  1j*XL3
 #Maximum  current  at  third  harmonic  frequency
I3m  =  V3/Z3
I3mag  =  abs(I3m)
phii3  =  cmath.phase(complex(I3m.real,I3m.imag))
 #fifth  harmonic
XL5  =  5*XL1
 #impedance  at  the  third  harmonic  frequency,
Z5  =  R  +  1j*XL5
 #Maximum  current  at  third  harmonic  frequency
I5m  =  V5/Z5
I5mag  =  abs(I5m)
phii5  =  cmath.phase(complex(I5m.real,I5m.imag))
 #rms  current
Irms  =  (Iom**2  +  (I1mag**2  +  I3mag**2  +  I5mag**2)/2)**0.5
 #power  dissipated
P  =  R*Irms**2


#Results
print  "\n\n  Result  \n\n"
print  "\n(a)i  =  ",round(Iom,2),"  +  ",round(I1mag,2),"sin(",round(w1,2),"t  +  (",round(phii1,2),"))  +  ",round(I3mag,2),"sin(",round((w1*3),2),"t  +  (",round(phii3,2),"))  +  ",round(I5mag,2),"sin(",round((w1*5),2),"t  +  (",round(phii5,2),"))  A"
print  "\n(b)the  rms  value  of  current  is  ",round(Irms,2),"  A"
print  "\n(c)the  total  power  dissipated  ",round(P,3),"  W"

  Result  



(a)i  =   5.0   +   14.14 sin( 10000.0 t  +  ( -0.79 ))  +   2.53 sin( 30000.0 t  +  ( -0.73 ))  +   0.78 sin( 50000.0 t  +  ( -1.11 ))  A

(b)the  rms  value  of  current  is   11.34   A

(c)the  total  power  dissipated   642.538   W

Example 12, page no. 661

In [7]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
Vom  =  30;#  in  volts
V1m  =  40;#  in  volts
V2m  =  25;#  in  volts
V4m  =  15;#  in  volts
Iom  =  0;#  in  amperes
I1m  =  0.743;#  in  Amperes
I2m  =  0.781;#  in  Amperes
I4m  =  0.636;#  in  Amperes
phii1  =  1.190;#  in  rad
phii2  =  0.896;#  in  rad
phii4  =  0.559;#  in  rad
w  =  1000;#  in  rad

 #calculation:
 #the  average  power  P  is  given  by
P  =  Vom*Iom+(0.707*V1m)*(0.707*I1m)*math.cos(phii1)+(0.707*V2m)*(0.707*I2m)*math.cos(phii2) + (0.707*V4m)*(0.707*I4m)*math.cos(phii4)
 #rms  current
Irms  =  (Iom**2  +  (I1m**2  +  I2m**2  +  I4m**2)/2)**0.5
 #resistance  R
R  =  P/(Irms**2)
 #impedance
Z1  =  V1m/I1m
 #Xc1
Xc1  =  (Z1**2  -  R**2)**0.5
 #capacitance
C  =  1/(w*Xc1)


#Results
print  "\n\n  Result  \n\n"
print  "\n(a)the  average  power  P  is  ",round(P,2),"  W"
print  "\n(c)the  resistance  R  ",round(R,2),"  ohm  and  capacitance  ",round(C*1E6,2),"uF"

  Result  



(a)the  average  power  P  is   15.66   W

(c)the  resistance  R   19.99   ohm  and  capacitance   20.01 uF

Example 13, page no. 662

In [2]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
V1m  =  300;#  in  volts
V3m  =  120;#  in  volts
phiv1  =  0;#  in  rad
phiv2  =  0.698;#  in  rad
w1  =  314;#  in  rad
C  =  2.123E-6;#  in  farads
R1  =  560;#  in  ohms
R2  =  2000;#  in  Ohm

#calculation:
 #voltage
V1  =  V1m*math.cos(phiv1)  +  1j*V1m*math.sin(phiv1)
V3  =  V3m*math.cos(phiv2)  +  1j*V3m*math.sin(phiv2)
 #capacitive  reactance,
Xc1  =  1/(w1*C)
 #impedance  at  the  fundamental  frequency,
Z1  =  R1  -  1j*Xc1*R2/(R2  -  1j*Xc1)
 #Maximum  current  at  fundamental  frequency
I1m  =  V1/Z1
I1mag  =  abs(I1m)
phii1  =  cmath.phase(complex(I1m.real,I1m.imag))
 #Third  harmonic
Xc3  =  Xc1/3
 #impedance  at  the  third  harmonic  frequency,
Z3  =  R1  -  1j*Xc3*R2/(R2  -  1j*Xc3)
I1m = V1m/Z1
I1mag  =  abs(I1m)
phii1  =  cmath.phase(complex(I1m.real,I1m.imag))
 #Maximum  current  at  third  harmonic  frequency
I3m  =  V3/Z3
I3mag  =  abs(I3m)
phii3  =  cmath.phase(complex(I3m.real,I3m.imag))
 #Percentage  harmonic  content  of  the  supply  current  is  given  by
percent  =  I3mag*100/I1mag
 #total  active  power
P  =  (0.707*V1m)*(0.707*I1mag)*math.cos(phiv1  -  phii1)  +  (0.707*V3m)*(0.707*I3m)*math.cos(phiv2  -  phii3)

I1 = I1m*R2/(R2 - 1j*Xc1)
I3 = I3m*R2/(R2 - 1j*Xc3)

I1nmag  =  abs(I1)
phini1  =  cmath.phase(complex(I1.real,I1.imag))
I3nmag  =  abs(I3)
phini3  =  cmath.phase(complex(I3.real,I3.imag))

#Results
print  "\n\n  Result  \n\n"
print  "\n(a)supply current, i=", round(I1mag,3),"sin(", w1,"t +",round(phii1,3),") + ",round(I3mag,3),"sin(", 3*w1,"t +",round(phii3,3),") A"
print  "\n(b)Percentage  harmonic  content  of  the  supply  current  is  ",round(percent,2),"  percent"
print  "\n(c)total  active  power  is  ",round(abs(P),2),"  W"
print  "\n(d)Voltage, v1 =", round(I1mag*R1,3),"sin(", w1,"t +",round(phii1,3),") + ",round(I3mag*R1,3),"sin(", 3*w1,"t +",round(phii3,3),") A"
print  "\n(e)current, ic =", round(I1nmag,3),"sin(", w1,"t +",round(phini1,3),") + ",round(I3nmag,3),"sin(", 3*w1,"t +",round(phini3,3),") A"

  Result  



(a)supply current, i= 0.187 sin( 314 t + 0.643 ) +  0.145 sin( 942 t + 1.305 ) A

(b)Percentage  harmonic  content  of  the  supply  current  is   77.57   percent

(c)total  active  power  is   25.34   W

(d)Voltage, v1 = 104.996 sin( 314 t + 0.643 ) +  81.45 sin( 942 t + 1.305 ) A

(e)current, ic = 0.15 sin( 314 t + 1.287 ) +  0.141 sin( 942 t + 1.55 ) A

Example 14, page no. 664

In [8]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
V1m  =  400;#  in  volts
V3m  =  10;#  in  volts
C  =  0.2E-6;#  in  farads
R  =  2;#  in  ohms
L  =  0.5;#  in  Henry

 #calculation:
 #Resonance  with  the  third  harmonic  means  that
w  =  (1/(9*L*C))**0.5
 #fundamental  frequency,  f
f  =  w/(2*math.pi)
 #At  the  fundamental  frequency,
 #impedance  Z1
Z1  =  R  +  1j*(w*L  -  1/(w*C))
Z1mag  =  abs(Z1)
phiZ1  =  cmath.phase(complex(Z1.real,Z1.imag))
 #Maximum  value  of  current  at  the  fundamental  frequency,
I1m  =  V1m/Z1mag
 #At  the  third  harmonic  frequency,
Z3  =  R  +  1j*(3*w*L  -  1/(3*w*C))
Z3mag  =  abs(Z3)
phiZ3  =  cmath.phase(complex(Z3.real,Z3.imag))
 #Maximum  value  of  current  at  the  third  harmonic  frequency,
I3m  =  V3m/Z3


#Results
print  "\n\n  Result  \n\n"
print  "(a)fundamental  frequency  for  resonance  with  the  third  harmonic  is  ",round(f,2),"  Hz"
print  "(b)Maximum value of current at fundamental freq. is",round(abs(I1m),3),"A "
print   "and  at  the  third  harmonic  frequency  ",  abs(I3m),"  A"

  Result  


(a)fundamental  frequency  for  resonance  with  the  third  harmonic  is   167.76   Hz
(b)Maximum value of current at fundamental freq. is 0.095 A 
and  at  the  third  harmonic  frequency   5.0   A

Example 15, page no. 665

In [14]:
from __future__ import division
import math
import cmath
#initializing  the  variables:
V1m  =  800;#  in  volts
f  =  50;#  in  Hz
x  =  0.015;
C  =  0.122E-6;#  in  farads
R  =  5;#  in  ohms
L  =  0.369;#  in  Henry

 #calculation:
 #voltage  at  nth  harmonic
Vnm  =  x*V1m
w  =  2*math.pi*f
 #For  resonance  at  the  nth  harmonic  nwL  =  1/nwC
n  =  1/(w*(L*C)**0.5)
 #At  resonance,  impedance
Zn  =  R
 #the  maximum  value  of  current  at  the  nth  harmonic
Inm  =  Vnm/Zn
 #capacitive  reactance,  at  nth  harmonic
Xcn  =  1/(n*w*C)
 #the  p.d.  across  the  capacitor  at  the  nth  harmonic
Vcn  =  Inm*Xcn
 #At  the  fundamental  frequency,  inductive  reactance,
XL1  =  w*L
 #capacitive  reactance
Xc1  =  1/(w*C)
 #Impedance  at  the  fundamental  frequency,
Z1  =  R  +  1j*(XL1  -  Xc1)
Z1mag  =  abs(Z1)
phiZ1  =  cmath.phase(complex(Z1.real,Z1.imag))
 #Maximum  value  of  current  at  the  fundamental  frequency,
I1m  =  V1m/Z1mag


#Results
print  "\n\n  Result  \n\n"
print  "\n(a)n  =  ",round(n,2),""
print  "\n(b)the  maximum  value  of  current  at  the  nth  harmonic  ",round(Inm,2),"  A"
print  "\n(c)the  p.d.  across  the  capacitor  at  the  nth  harmonic  is  ",round(Vcn,2),""
print  "\n(d)the  maximum  value  of  the  fundamental  current.  ",round(I1m,2),"  A"

  Result  



(a)n  =   15.0 

(b)the  maximum  value  of  current  at  the  nth  harmonic   2.4   A

(c)the  p.d.  across  the  capacitor  at  the  nth  harmonic  is   4173.92 

(d)the  maximum  value  of  the  fundamental  current.   0.03   A