Chapter 15: Alternating Voltages and Currents

Example 15.1, Page 305

In [3]:
#Initialisation
w=1000                 #Angular Frequency       
L=10**-3               #Inductance

#Calculation
Xl=w*L                 #Reactance

#Result
print'Reactance, Xl = %d Ohm'%Xl
Reactance, Xl = 1 Ohm

Example 15.2, Page 305

In [6]:
import math

#Initialisation
f=50                   #frequency
C=2*10**-6             #Capacitance

#Calculation
w=2*math.pi*f                 #Angular Frequency  
Xc=1/(w*C)                 #Reactance

#Result
print'Reactance, Xl = %.2f KOhm'%(Xc/1000)
Reactance, Xl = 1.59 KOhm

Example 15.3, Page 306

In [15]:
import math

#Initialisation
f=100                  #frequency
l=25*10**-3               #Inductance
Vl=5                    #AC Voltage (Sine)

#Calculation
w=2*math.pi*f                 #Angular Frequency  
Xl=w*l                 #Reactance
Il=Vl*Xl**-1

#Result
print'Peak Current, IL = %d mA'%(Il*10**3)
Peak Current, IL = 318 mA

Example 15.4, Page 306

In [18]:
import math

#Initialisation
Ic=2                 #sinusoidal Current
C=10*10**-3          #Capacitance
w=25                 #Angular Frequency  



#Calculation 
Xc=1/(w*C)                 #Reactance
Vc= Ic*Xc                   #Voltage

#Result
print'Voltage appear across the capacitor, V = %d V r.m.s'%(Vc)
Voltage appear across the capacitor, V = 8 V r.m.s

Example 15.5, Page 309

In [3]:
import math

#Initialisation
I=5                   #sinusoidal Current
R=10                  #Resistance in Ohm
f=50                  #Frequency in Hertz
L=0.025               #Inductancec in Henry
 

#Calculation 
Vr=I*R                         #Voltage across resistor
Xl=2*math.pi*f*L               #Reactance
VL= I*Xl                       #Voltage across inductor
V=math.sqrt((Vr**2)+(VL**2))   #total voltage
phi=math.atan(VL*Vr**-1)       #Phase Angle in radians

#Result
print'(a) V = %.1f V'%(V)
print'(b) V = %.2f V'%(phi*180/math.pi)         #phase angle in degree
(a) V = 63.6 V
(b) V = 38.15 V

Example 15.6, Page 311

In [45]:
import math

#Initialisation
R=10**4                  #Resistance in Ohm
f=10**3                  #Frequency in Hertz
C=3*10**-8               #Capacitance in Farad
V=10                     #Voltage

#Calculation 
Xc=1/(2*math.pi*f*C)                #Reactance
a=((10**4)**2)+(5.3*10**3)**2
I=math.sqrt((V**2)/a)               #Current in Amp
Vr=I*R                            #Voltage
Vc=Xc*I                            #Voltage
phi=math.atan(Vc/Vr)       #Phase Angle in radians

#Result
print'(a) Current, I = %d uA'%round(I*10**6)
print'(b) V = %.2f V'%(-phi*180/math.pi)         #phase angle in degree
(a) Current, I = 884 uA
(b) V = -27.95 V

Example 15.7, Page 317

In [49]:
import math

#Initialisation
I=5                   #sinusoidal Current
R=200                  #Resistance in Ohm
f=50                  #Frequency in Hertz
L=400*10**-3               #Inductancec in Henry
C=50*10**-6               #Capacitance in Henry 

#Calculation 
Vr=I*R                         #Voltage across resistor
Xl=2*math.pi*f*L               #Reactance
Xc=1/(2*math.pi*f*C)                #Reactance
i=Xl-Xc

#Result
print'Z = %d + j %d Ohms'%(R,i)
Z = 200 + j 62 Ohms

Example 15.8, Page 320

In [32]:
import math
from numpy import ones

#Initialisation
R1=5                  #Resistance in Ohm
R2=50                  #Resistance in Ohm
w=500                  #rad/s
L=50*10**-3               #Inductancec in Henry
C=200*10**-6               #Capacitance in Henry 
v=10

#Calculation
Xc=1/(w*C)                              #Reactance
Z1=complex(R1,-Xc)                      #taking in complex form
a=(R2*w**2*L**2)/(R2**2+(w**2*L**2))
b=(R2**2*w*L)/(R2**2+(w**2*L**2))
Z2=complex(a,b)                         #taking in complex form
Z3=(Z1+Z2)
Z=Z2/Z3
r=math.sqrt((Z.real)**2 + (Z.imag)**2)   #converting in polar (absolute)
r1=v*r 
phi=math.atan(Z.imag/Z.real)             #converting in polar (phase)

#Result
print'vo = %.1f < %.1f'%(r1,(phi*180/math.pi))
print'Therefore'
print'vo = %.1f sin(%d t + %.1f)'%(r1,w,(phi*180/math.pi))
vo = 12.4 < 29.7
Therefore
vo = 12.4 sin(500 t + 29.7)
In [ ]:
 
In [ ]:
 
In [ ]: