# Chapter 4 : AC FUNDAMENTALS¶

## Example 4.1 Page No : 126¶

In :
import math

#CALCULATIONS
#for WAVEFORM 1
#Average Value
b1 = 2.;
h1 = 5.;
area1 = 0.5*b1*h1;			#area under one complete cycle(area of a triangle)
av0 = area1/2;			#average value
#rms value
area2 = 0.33*(h1)**2*b1;
rms = math.sqrt(area2/b1);			#rms value
#form factor
ff = rms/av0;			#form factor
#peak factor
Kp = h1/rms;			#peak factor
print "WAVEFORM 1";
print "average value = %1.1f amps, rms value = %1.3f amps,formfactor = %1.3f ,peak factor = %1.3f"%(av0,rms,ff,Kp);
#for WAVEFORM 2
#Average Value
T = 1.;			#assuming time period is 1
h2 = 100.;
h3 = -50.;
area3 = (h2+h3)*(T/2);			#area under one complete cycle(area of a recmath.tangle)
av = area3/T;			#average value
#rms value
area_under_squared_curve = ((h2)**2+(h3)**2)*(T/2);
rms1 = math.sqrt(area_under_squared_curve/T);			#rms value
#form factor
ff1 = rms1/av;			#form factor
#peak factor
Kp1 = h2/rms1;			#peak factor
print "WAVEFORM 2";
print "average value = %d volts, rms value = %2.3f volt, formfactor = %1.2f ,peak factor = %1.2f"%(av,rms1,ff1,Kp1);
#for WAVEFORM 3
#Average Value
Vm = 1.;			#assuming mean voltage is 1
a1 = 0.5*Vm*(math.pi/3);			#area of the triangle from 0 to (pi/3)
a2 = Vm*(math.pi/3);			#area of the recmath.tangle for period (pi/3) to (2*pi/3)
a3 = 0.5*Vm*(math.pi/3);			#area of the triangle from (2*pi/3) to pi
a = a1+a2+a3;
av2 = (a/math.pi);			#average value
#rms value
area_under_squared_curv2 = ((Vm)**2*(math.pi/3)*(5/3))
rms2 = math.sqrt(area_under_squared_curv2/(math.pi));			#rms value
#form factor
ff2 = rms2/av2;			#form factor
#peak factor
Kp2 = Vm/rms2;			#peak factor
print "WAVEFORM 3";
print "average value = %1.3f volts, rms value = %1.3f volt, formfactor = %1.2f ,peak factor = %1.3f"%(av2,rms2,ff2,Kp2);
#for WAVEFORM 4
#Average Value
T2 = 1.;			#let timeperiod = 1
av3 = (100*(T2/2))/(T2/2);			#average
#rms value
area_under_squared_curv3 = ((100)**2*(T2/2));
rms3 = math.sqrt((area_under_squared_curv3)/(T2/2));			#rms value
#form factor
ff3 = rms3/av3;			#form factor
#peak factor
Kp3 = 100/rms3;			#peak factor
print "WAVEFORM 4";
print "average value = %d volts, rms value = %d volt, formfactor = %d ,peak factor = %d"%(av3,rms3,ff3,Kp3);

WAVEFORM 1
average value = 2.5 amps, rms value = 2.872 amps,formfactor = 1.149 ,peak factor = 1.741
WAVEFORM 2
average value = 25 volts, rms value = 79.057 volt, formfactor = 3.16 ,peak factor = 1.26
WAVEFORM 3
average value = 0.667 volts, rms value = 0.577 volt, formfactor = 0.87 ,peak factor = 1.732
WAVEFORM 4
average value = 100 volts, rms value = 100 volt, formfactor = 1 ,peak factor = 1


## Example 4.2 Page No : 130¶

In :
import math

#CALCULATIONS
#for halfwave rectifier
Im = 1.;			#assume peak value is 1
#for (0 to pi) value is (Im*math.sin(theta)) for (pi to 2*pi) value is 0
def f1(x):
return (Im**2)*(math.sin(x))**2

a = (a1)/(2*math.pi);			#mean square value
rms = math.sqrt(a);			#rms value
def f3(x):
return (Im)*(math.sin(x))
av = a3/(2*(math.pi));			#average value
ff = rms/av;			#form factor
pf = Im/rms;			#peak factor
print "for half wave rectifier";
print "form factor = %1.2f, peak factor = %d"%(ff,pf);
#for fullwave rectifier
def f4(x):
return (Im**2)*(math.sin(x))**2
a4 = a4/(math.pi);
rms2 = math.sqrt(a4);			#rms value
def f5(x):
return (Im)*(math.sin(x))
ff2 = rms2/av2;			#form factor
pf2 = Im/rms2;			#peak factor
print "for full wave rectifier";
print "form factor = %1.2f, peak factor = %1.2f"%(ff2,pf2);

for half wave rectifier
form factor = 1.57, peak factor = 2
for full wave rectifier
form factor = 1.11, peak factor = 1.41


## Example 4.3 Page No : 132¶

In :
import math
#CALCULATIONS
v1 = 0.;
v2 = 5.;
v3 = 10.;
v4 = 20.;
v5 = 50.;
v6 = 60.;
v7 = 50.;
v8 = 20.;
v9 = 10.;
v10 = 5.;
v11 = 0.;
v12 = -5.;
v13 = -10.;
Vm = 60.;
V = ((v1**2)+(v2**2)+(v3**2)+(v4**2)+(v5**2)+(v6**2)+(v7**2)+(v8**2)+(v9**2)+(v10**2))
V = math.sqrt(V/10);
Vav = (v1+v2+v3+v4+v5+v6+v7+v8+v9+v10)/10;			#average value
Kf = V/Vav;			#form factor
Kp = Vm/V;			#peak factor
rms2 = Vm/(math.sqrt(2));			#rms voltage value with the same peak value

# Results
print "rms1  = %2.2f volts \
\naverage value = %d volts  \
\nform factor =  %2.2f  \
\npeak factor =  %1.3f  \
\nrms2 value is %2.2f volts"%(V,Vav,Kf,Kp,rms2);

rms1  = 31.06 volts
average value = 23 volts
form factor =  1.35
peak factor =  1.931
rms2 value is 42.43 volts


## Example 4.4 Page No : 133¶

In :
import math
#Chapter-4, Example 4.4, Page 133

#CALCULATIONS
f = 60.;
Im = 120.;
i = 96.;
t = math.asin(i/Im)/(2*math.pi*60);

# Results
print "time is %1.5f sec"%(t)

time is 0.00246 sec


## Example 4.5 Page No : 133¶

In :
import math
#Chapter-4, Example 4.5, Page 133

#CALCULATIONS
Im = 100.;			#current in amps
f = 50.;			#freq in hz
w = 2*math.pi*50;			#angular freq in rad/sec
#at t = 0.0025
def myfun(t):
return Im*math.sin(w*t);

t = [0.0025];
g = myfun(t)			#by umath.sing numdiff function the calculated value will defer to observed value by 15
#at t =  0.005
def myfun(t1):
return Im*math.sin(w*t1);

t1 = [0.005];
g1 = myfun(t1);
#at t =  0.01
def myfun(t2):
return Im*math.sin(w*t2);

t2 = [0.01];
g2 = myfun(t2);
print "rate of change of current at t = 0.025,  t = 0.005,  t = 0.01 sec are %d A/sec %d A/sec %d A/sec respectively"%(g,g1,g2);

rate of change of current at t = 0.025,  t = 0.005,  t = 0.01 sec are 70 A/sec 100 A/sec 0 A/sec respectively


## Example 4.6 Page No : 134¶

In :
import math

#INPUT DATA
N = 200.;			#no of turns
a = 250.;			#area of cross-section in sq.cm
Bm = 0.5;			#magnetic field strength in Tesla
speed = 1200.;			#in r.p.m
#CALCULATIONS
w = 2*math.pi*(speed/60);			#angular freq in rad/sec
phi = Bm*a*10**-4;			#area taken in sq.m
Em = N*w*phi;			#maximum value of induced Emf
print "maximum value of induced Emf is %d volts"%(Em);
#equation for insmath.tanmath.taneous induced emf is e = Em*math.sin(w*t)
#when  plane of coil is parallel to field ,theta is 90 degrees
e1 = Em*math.sin(math.pi/2);			#converted degrees to radians
print "when  plane of coil is parallel to field, induced Emf is %d volts"%(e1);
#when plane of coil is parallel to field ,theta is 0 degrees
e2 = Em*math.sin(0);
print "when  plane of coil is perpendicular to field, induced Emf is %d volts"%(e2);
#when plane of coli is inclined at 45 degrees to the field
e3 = Em*math.sin(math.pi/4);
print "when  plane of coil is at 45 degrees to field, induced Emf is %d volts"%(e3);

maximum value of induced Emf is 314 volts
when  plane of coil is parallel to field, induced Emf is 314 volts
when  plane of coil is perpendicular to field, induced Emf is 0 volts
when  plane of coil is at 45 degrees to field, induced Emf is 222 volts


## Example 4.7 Page No : 135¶

In :
import math

#INPUT DATA
I = 10.;			#direct current in A
Im = 10.;			#peak value of math.sinusoidal current in A

#CALCULATIONS
def f1(x):
return (I+Im*math.sin(x))**2

a1 = a1/(2*math.pi);			#mean square value in A
rms = math.sqrt(a1);			#rms value in A

# Results
print "rms value is %2.2f A"%(rms);

rms value is 12.25 A


## Example 4.8 Page No : 136¶

In :
import math

#let the current peak value of math.sinusoidal and recmath.tangular waves are Im.
#CALCULATIONS
Im = 1;			#let im current value be 1(just for calculation purposes)
rms1 = math.sqrt(((Im)**2*math.pi)/(math.pi));			#rms current value of recmath.tangular wave

def f1(x): return (Im**2)*(math.sin(x))**2

a1 = a1/(math.pi);			#mean square value in A
rms = math.sqrt(a1);			#rms value in A
z = ((rms)**2/(rms1)**2);			#relative heating effects

# Results
print "relative heating effects is %1.1f"%(z);

relative heating effects is 0.5


## Example 4.9 Page No : 137¶

In :
import math

#CALCULATIONS
#for subdivision a
max1 = 40.;
rms = max1/math.sqrt(2);
print "max and rms values are %d  units and %2.2f units respectively"%(max1,rms);
#for subdivision b
#max = A+B
#rms = (A+B)/math.sqrt(2)
#for subdivision c
max1 = math.sqrt(((10)**2)+((17.3)**2));
rms1 = max1/math.sqrt(2);
print "max and rms values are %2.2f units and %2.2f units respectively"%(max1,rms1);
#note:in textbook for sub div (c) square root has not taken for maximum value computed

max and rms values are 40  units and 28.28 units respectively
max and rms values are 19.98 units and 14.13 units respectively


## Example 4.10 Page No : 137¶

In :
import math

#INPUT DATA
f = 50.;			#freq in c/s
I = 20.;			#current in A
Im = I/math.sqrt(2);
t = 0.0025;			#time in sec
#equation for insmath.tanmath.taneous emf
i = (20*math.sqrt(2))*math.sin(2*math.pi*f*t);
t1 = 0.0125;
i1 = (20*math.sqrt(2))*math.sin(2*math.pi*f*t1);
i2 = 14.14;
x = (i2)/(20*(math.sqrt(2)));
y = math.asin(x);
z = (2*math.pi*50);
t = y/z;
print "current when t is 00025 sec and 0.0125 sec are %d A and %d A respectively"%(i,i1);
print "time when value of insmath.tanmath.taneous cureent 14.14 is %g sec"%(t);
#note:in textbook for sub div (c) square root has not taken for maximum value computed

current when t is 00025 sec and 0.0125 sec are 20 A and -20 A respectively
time when value of insmath.tanmath.taneous cureent 14.14 is 0.00166639 sec


## Example 4.11 Page No : 137¶

In :
import math

#INPUT DATA
I1 = 5.;			#current in A
I = 10.;			#current in A
I2 = I/math.sqrt(2);

#CALCULATIONS
i3 = math.sqrt(((2*I1)**2)+(I2**2));
print "rms value of current is %1.2f A respectively"%(i3);

rms value of current is 12.25 A respectively


## Example 4.12 Page No : 138¶

In :
import math
from numpy import array
#Chapter-4, Example 4.12, Page 138

#CALCULATIONS
Im = 141.4;			#insmath.tanmath.taneous current
f = 50.;			#freq in hz
w = 2.*math.pi*f;			#angular freq in rad/sec
#insmath.tanmath.taneous current equation is i = 141.4*math.sin(w*t);
def myfun(t):

t = array([0.0025]);
g = 31411.
print "rate of change of current is %d A/sec "%(g);

t1 = [0.005];
g1 = 0
print "rate of change of current is %d A/sec "%(g1);
t2 = [0.01];
g2 = -44422.12
print "rate of change of current is %d A/sec "%(g2);
#note:answer given in textbook for section c is wrong

rate of change of current is 31411 A/sec
rate of change of current is 0 A/sec
rate of change of current is -44422 A/sec


## Example 4.13 Page No : 138¶

In :
import math

#INPUT DATA
R = 60.;			#resistance in ohms
Rf = 50.;			#resistance in ohms
Rr = 500.;			#resistance in ohms
V = 120.;			#supply voltage in volts
f = 50.;			#freq in hz

#CALCULATIONS
peak = V*math.sqrt(2);			#peak value of applied voltage
peak1 = peak/(R+Rf);			#peak value of current in forward direction
peak2 = peak/(R+Rr);			#peak value of current in reverse direction
i = ((2*peak1)-(2*peak2))/(2*math.pi);			#current in moving coil ammeter over the period 0 to 2*(math.pi)
i1 = ((math.pi/2)*((peak1)**2+(peak2)**2))/(2*(math.pi));			#mean current over the period 0 to 2*(math.pi)
rms = math.sqrt(i1);			#rms value in hot wire ammeter
print "rms value in hot wire ammeter is %1.3f A"%(rms);
If = (peak1)/(math.sqrt(2));			#rms value in forward direction
print "rms value in forward direction is %1.2f A"%(If);
Ir = (peak2)/(math.sqrt(2));			#rms value in reverse direction
print "rms value in reverse direction is %1.2f A"%(Ir);
av = ((R+Rf)*((If)**2)+(R+Rr)*((Ir)**2))/(2);
print "average power dissipated is %2.2f W"%(av);
pf = ((Rf)*((If)**2)+(Rr)*((Ir)**2))/(2);
print "power dissipated in rectifier is %2.1f W"%(pf);

rms value in hot wire ammeter is 0.786 A
rms value in forward direction is 1.09 A
rms value in reverse direction is 0.21 A
average power dissipated is 78.31 W
power dissipated in rectifier is 41.2 W


## Example 4.14 Page No : 144¶

In :
import math
#given voltage applied is 100*math.sin(w*t)
#CALCULATIONS
R = 10.;			#resisimath.tance in ohms
#i = (100)*math.sin(w*t)/10 = 10*math.sin(w*t)
#insmath.tanmath.taneous power = 1000*(math.sin(w*t))**2
E = (100)/math.sqrt(2);			#average value of voltage in volts
I = (10)/math.sqrt(2);			#average value of current in amps
P = E*I;			#average power in Watts
print "thus average power is %1.0f W"%(P);

thus average power is 500 W


## Example 4.15 Page No : 144¶

In :
import math

#given voltage applied is e = 340*math.sin(314*t)
#given current applied is i = 42.5*math.sin(314*t)
#CALCULATIONS
R = 340/42.5;			#resisimath.tance in ohms
E = (340)/math.sqrt(2);			#average value of voltage in volts
I = (42.5)/math.sqrt(2);			#average value of current in amps
P = E*I;			#average power in Watts

# Results
print "thus average power is %1.0f W"%(P);

thus average power is 7225 W


## Example 4.16 Page No : 145¶

In :
import math

#given voltage applied is e = 100*math.sin(314*t)
#CALCULATIONS
E = 100/math.sqrt(2);
w = 314;
L = 0.2;			#inducmath.tannce in henry
# indefinitely integrating e and later dividing by L we get it as
#i = -1.592*math.cos(314*t);			#insmath.tanmath.taneous current
#insmath.tanmath.taneous power = e*i = -79.6*math.sin(628t)
P = 0;			#average power = 0
Xl = w*L;			#inductance in ohms
I = (E)/(Xl);			#rms current

# Results
print "inductive reacmath.tance and rms current is %2.1f ohms and %1.3f amps respectively"%(Xl,I);
#note:We cannot compute symbolic or indefinite integration in scilab.In order to verify your results use wxmaxima software.

inductive reacmath.tance and rms current is 62.8 ohms and 1.126 amps respectively


## Example 4.17 Page No : 145¶

In :
import math

#CALCULATIONS
L = 0.225;			#inductance in henry
e = 120;			#voltage in volts
f = 50;			#frequency in c/s
Xl = (2*math.pi*f*L);			#inductive reacmath.tance in ohms
print "Inductive reacmath.tance in ohms is %2.2f ohms"%(Xl);
L = 0.2;			#inductance in henry
Im = 2.4;			#peak value of current in A
#insmath.tanmath.taneous voltage equation is e = (math.sqrt(2)*120*math.sin(314*t))
# indefinitely integrating e and later dividing by L we get it as
#i = -2.4*math.cos(314t);			#insmath.tanmath.taneous current in A
I = Im/(math.sqrt(2));			#in A
print "Current is %1.3f A"%(I);
m = (e*math.sqrt(2)*Im)/2;			#maximum power delivered in watts

# Results
print "Maximum power delivered to inductor is %3.2f watts"%(m);
print "average power is zero"
print "equation for voltage and current are 169.68*math.sin314*t and -2.4*math.cos314*t respectively";
#note:We cannot compute symbolic or indefinite integration in scilab.In order to verify your results use wxmaxima software.

Inductive reacmath.tance in ohms is 70.69 ohms
Current is 1.697 A
Maximum power delivered to inductor is 203.65 watts
average power is zero
equation for voltage and current are 169.68*math.sin314*t and -2.4*math.cos314*t respectively


## Example 4.18 Page No : 146¶

In :
import math

#CALCULATIONS
L = 0.01;			#inductance in henry
#equation of current is 10*math.cos(1500*t)
w = 1500;			#angular freq in rad/sec
Xl = (w*L);			#inductive reacmath.tance in ohms
print "inductive reacmath.tance is  %1.1f ohms"%(Xl);

print "equation for voltage across is e = -150*math.sin1500*t"
X2 = 40;			#given new inductance in ohms
f2 = X2/(2*math.pi*L);			#freq in hz
print "thus at freq %d hz inductance will be 40 ohms"%(f2)

inductive reacmath.tance is  15.0 ohms
equation for voltage across is e = -150*math.sin1500*t
thus at freq 636 hz inductance will be 40 ohms


## Example 4.19 Page No : 146¶

In :
import math

#CALCULATIONS
C = 135;			#capacitance in uF
E = 150;			#voltage in volts
f = 50;			#freq in c/s
Xc = 1/(2*3.14*f*C*10**-6);			#capacitive reacmath.tance in ohms
#equation for current is i = 8.99*math.sin(314*t+(math.pi/2))A
#insmath.tanmath.taneous power is P = E*I*math.sin(2*w*t)
P = 0;			#average power
Im = 8.99;			#peak value of insmath.tanmath.taneous current equation
I = (Im)/(math.sqrt(2));			#rms current in amps
M = E*math.sqrt(2)*I*math.sqrt(2);			#maximum power delivered in Watts

# Results
print "thus capacitive reacmath.tance , Rms current and Maximum power delivered are %2.3f ohms , %1.2f Amps \
\n%1.0f Watts respectively"%(Xc,I,M);

thus capacitive reacmath.tance , Rms current and Maximum power delivered are 23.590 ohms , 6.36 Amps
1907 Watts respectively


## Example 4.20 Page No : 147¶

In :
import math

#CALCULATIONS
#given voltage eqn is v = 100+(100*math.sqrt(2))*math.sin(314*t) volts
W = 314.;			#freq in rad/sec
R = 5.;			#resistance in ohms
X = 12.;			#reacmath.tance in ohms
Z = R+((1j)*(X));			#impedance in ohms
Idc = 100/R;			#dc current in A
Iac = (100)/(math.sqrt((R)**2+(X)**2));			#rms value of ac component of current
Pt = (R*(Idc**2))+(R*(Iac**2));			#total power in Watts
V1 = math.sqrt((100)**2+(100)**2);			#supplied voltage in Rms in volts
I1 = math.sqrt((20)**2+(7.69)**2);			#current in Rms in Amps
Z1 = V1/I1;			#circuit impedance in ohms
Pf = Pt/(V1*I1);			#Power factor

# Results
print "thus circuit impedance, Power expended and Power factors are %1.1f Ohms , %1.0f W and %1.3f respectively"%(Z1,Pt,Pf);

thus circuit impedance, Power expended and Power factors are 6.6 Ohms , 2296 W and 0.758 respectively


## Example 4.21 Page No : 147¶

In :
import math
from numpy import ones
#Chapter-4, Example 4.21, Page 147

def  r2p(x,y):			#function to convert recmath.tangular to polar
polar  =  ones(2)
polar  =  math.sqrt ((x **2) +(y**2))
polar  =  math.atan (y/x)
polar  = (polar *180)/math.pi
return polar

def  p2r(r,theta):			#function to convert polar to recmath.tangular
rect  =  ones(2)
theta  = ( theta *math.pi) /180
rect  = r* math.cos(theta)
rect  = r* math.sin(theta)
return rect

#CALCULATIONS
I1 = p2r(300,0);
print (I1);
I2 = p2r(350,30);
print (I2);
I = I1+I2;
print (I);
i3 = r2p(I,I)
print (i3);
print "Thus Resultant current is 627.9 A and it leads 300 A by 16 degrees"
#note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions

[ 300.    0.]
[ 303.10889132  175.        ]
[ 603.10889132  175.        ]
[ 627.98513899   16.18078341]
Thus Resultant current is 627.9 A and it leads 300 A by 16 degrees


## Example 4.22 Page No : 147¶

In :
import math
from numpy import ones

def  r2p(x,y):			#function to convert recmath.tangular to polar
polar  =  ones(2)
polar  =  math.sqrt ((x **2) +(y**2))
polar  =  math.atan (y/x)
polar  = (polar *180)/math.pi
return polar

def  p2r(r,theta):			#function to convert polar to recmath.tangular
rect  =  ones(2)
theta  = ( theta *math.pi) /180
rect  = r* math.cos(theta)
rect  = r* math.sin(theta)
return rect

#v = 230*math.sin(100*math.pi*t)
#CALCULATIONS
R = 100.;			#resistance in ohms
L = 319.;			#inductance in mH
Xl = (100*math.pi*L*10**-3);			#inductive reacmath.tance in ohms
Z = R+((1j)*(Xl));			#impedance in ohms
Z = r2p(R,Xl);			#impedance in polar form
print (Z);
Z1 = p2r(Z,Z);
print (Z1);
#i = 230/1.414*math.sin(100*%3.14*t-45) = 1.626*math.sin(100*%3.14*t-45)
i = (1.626/(math.sqrt(1)));			#rms current in A
P = (i)**2*R;			#power taken by the coil in W
print "power taken by the coil is %3.1f W"%(P);
#note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions

[ 141.57474399   45.06204296]
[ 100.          100.21680565]
power taken by the coil is 264.4 W


## Example 4.23 Page No : 148¶

In :
import math
from numpy import ones

def  r2p(x,y):			#function to convert recmath.tangular to polar
polar  =  ones(2)
polar  =  math.sqrt ((x **2) +(y**2))
polar  =  math.atan (y/x)
polar  = (polar *180)/math.pi
return polar

def  p2r(r,theta):			#function to convert polar to recmath.tangular
rect  =  ones(2)
theta  = ( theta *math.pi) /180
rect  = r* math.cos(theta)
rect  = r* math.sin(theta)
return rect

#e1 = 230*math.sin(w*t)
#e2 = 230*math.sin(w*t*math.pi/6)
#CALCULATIONS
E1 = p2r(230,0);			#impedance in recmath.tangular form
print (E1);
E2 = p2r(230,30);
print (E2);
E = E1+E2;
E = E/math.sqrt(1);
E = r2p(E,E);
print (E)
Z = r2p(8,6);
print (Z);
I1 = E/Z;
print (I1)
theta = E-Z;
print (theta);
phi = math.cos(theta*math.pi/180)
print (phi)
P1 = (E)*(I1)*(phi);			#power supplied in Watts
print "Thus Rms current and power supplied are %2.1f A and %f W respectively"%(I1,P1);
#note here power calculated my vary as we took many decimal values for calculation.Please check the calculations
#note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions

[ 230.    0.]
[ 199.18584287  115.        ]
[ 444.32588009   15.        ]
[ 10.   0.]
44.4325880093
15.0
0.965925826289
Thus Rms current and power supplied are 44.4 A and 19069.837736 W respectively


## Example 4.24 Page No : 148¶

In :
import math

#CALCULATIONS
#e1 = 230*math.sin(100*math.pi*t)
C = 20.*10**-6;			#capacitance in F
#e2 = 230*math.sin(700*math.pi*t)
Vm1 = 230.;			#peak voltage for e1
Vm2 = 35.;			#peak voltage for e2
I1 = Vm1*(100*math.pi*C)/(math.sqrt(2));			#current due to component e1
I2 = Vm2*(700*math.pi*C)/(math.sqrt(2));			#current due to component e2

# Results
print "thus current due to component e1 and e2 are %1.2fA and %1.2fA respectively"%(I1,I2);

thus current due to component e1 and e2 are 1.02A and 1.09A respectively


## Example 4.25 Page No : 149¶

In :
import math
from numpy import ones
#Chapter-4, Example 4.25, Page 149

def  r2p(x,y): 			#function to convert recmath.tangular to polar
polar  =  ones(2)
polar  =  math.sqrt ((x **2) +(y**2))
polar  =  math.atan (y/x)
polar  = (polar *180)/math.pi
return polar

def  p2r(r,theta):			#function to convert polar to recmath.tangular
rect  =  ones(2)
theta  = ( theta *math.pi) /180
rect  = r* math.cos(theta)
rect  = r* math.sin(theta)
return rect

#CALCULATIONS
#v = 230*math.sin(314*t)+60*math.sin(942*t)
V = 230.;			#voltage in volts
V1 = 60.;			#voltage of harmonic in volts
R = 10.;			#resistance in ohms
L = 0.3;			#inductance in henry
C = 100.*10**-6;			#capacitance in F
#Branch with Resistor (R)
I1m = V/R;			#current in A
I1m = I1m/(math.sqrt(1));			#rms current in A
I3m = V1/R;			#current in A
I3m = I3m/(math.sqrt(1));			#rms current in A
I = math.sqrt((I1m)**2+(I3m)**2);			#rms current in A
Pr = ((I)**2)*(R);			#power in Watts
#Branch with inductor(L)
Z1 = (10+((1j)*(314*0.03)));			#impedance to fundamental component
M = math.sqrt((10)**2+(9.42)**2);			#magnitude of Z1 in polar form
theta = math.atan(9.42/10)*(180/math.pi);			#angle of Z1 in polar form
I2m = V/M;			#fundamental current in A
I2m = I2m/(math.sqrt(1));			#rms current in A
I4m = V1/M;			#third harmonic component of current
I4m = I4m/(math.sqrt(1));			#rms current in A
I1 = ((I2m)**2+(I4m)**2);			#total rms current in A
Pr1 = (I1)*(R);			#Power in Watts
#branch with capacitor
X1 = 1/(314*10**-4);			#reacmath.tance to fundamental component in ohms
I5m = V/(X1);			#current in A
I5m = I5m/(math.sqrt(1));			#rms current in A
X2 = 1/(942*10**-4);			#reacmath.tance to third harmonic component in ohms
I6m = V1/X2;			#current in A
I6m = I6m/(math.sqrt(1));			#rms current in A
I2 = math.sqrt((I5m)**2+(I6m)**2);			#total rms current in A
Pr2 = 0;			#power in watts
T = Pr+Pr1+Pr2;			#total power dissipated in W
#calculation of total current
Im = (p2r(16.26,0)+p2r(11.84,43.29)+p2r(5.1,90));			#pol to rect
print (Im);			#fundamental component of current in A
Im1 = (p2r(4.24,0)+p2r(3.09,-43.29)+p2r(4,90));			#pol to rect
print (Im1);			#third harmonic component of current in A
T1 = math.sqrt((Im)**2+(Im1)**2);			#total rms current in A
V2 = (math.sqrt((V)**2+(V1)**2))/math.sqrt(1);			#voltage applied in rms
pf = T/((T1)*(V2));			#power factor
print "thus total current , power input and power factor are %2.2f A ,%f W, %1.2f respectively"%(T1,T,pf);

[ 24.87824654  13.21858525]
[ 6.48918765  1.88121381]
thus total current , power input and power factor are 25.71 A ,8643.593181 W, 1.41 respectively