Chapter1-Basic Circuit Concepts

Ex1-pg1.9

In [1]:
##Basic Circuit Concepts
##page no-1.9
##example1.1
print("Current through 15Ohm resistor is given by:");
print("I1=30/15");
I1=30/15
print"%s %.2f %s "%("current through 15Ohm resistor = ",I1," Ampere")
print("Current through 5Ohm resistor is given by:")
print("I2=5+2");
I2=5+2
print"%s %.2f %s "%("current through 5ohm resistor = ",I2," Ampere")
print("R=100-30-5*I2/I1");
R=(100-30-5*I2)/I1
print"%s %.2f %s "%("R = ",R," Ohm");
Current through 15Ohm resistor is given by:
I1=30/15
current through 15Ohm resistor =  2.00  Ampere 
Current through 5Ohm resistor is given by:
I2=5+2
current through 5ohm resistor =  7.00  Ampere 
R=100-30-5*I2/I1
R =  17.00  Ohm 

Ex2-pg1.10

In [2]:
##Basic Circuit Concepts
##page no-1.10
##example1.2
import math
import numpy
print("from the given fig:")
print("I2-I3=13");
print("-20*I1+8*I2=0");
print("-12*I1-16*I3=0");
##solving these equations in the matrix form
A=numpy.matrix([[0, 1 ,-1],[-20, 8, 0],[-12 ,0 ,-16]])
B=numpy.matrix([[13], [0] ,[0]])
print("A=")
print[A]
print("B=")
print[B]
X=numpy.dot(numpy.linalg.inv(A),B)
print("X=")
print[X]
print("I1 = 4Ampere")
print("I2 = 10Ampere")
print("I3 = -3Ampere")
from the given fig:
I2-I3=13
-20*I1+8*I2=0
-12*I1-16*I3=0
A=
[matrix([[  0,   1,  -1],
        [-20,   8,   0],
        [-12,   0, -16]])]
B=
[matrix([[13],
        [ 0],
        [ 0]])]
X=
[matrix([[  4.],
        [ 10.],
        [ -3.]])]
I1 = 4Ampere
I2 = 10Ampere
I3 = -3Ampere

Ex3-pg1.11

In [3]:
##Basic Circuit Concepts
##pg no-1.11
##example 1.3
print("Iaf=x")
print("Ife=x-30")
print("Ied=x+40")
print("Idc=x-80")
print("Icb=x-20")
print("Iba=x-80")
print("Applying KVL to the closed path AFEDCBA:")##Applying KVL to the path AFEDCBA
print("x=4.1/0.1")
x=4.1/0.1;
Iaf=x;
print"%s %.2f %s "%("\nIaf = ",Iaf," Ampere");
Ife=x-30.
print"%s %.2f %s "%("\nIfe = ",Ife," Ampere");
Ied=x+40.;
print"%s %.2f %s "%("\nIed = ",Ied," Ampere");
Idc=x-80;
print"%s %.2f %s "%("\nIdc = ",Idc," Ampere");
Icb=x-20.;
print"%s %.2f %s "%("\nIcb = ",Icb," Ampere");
Iba=x-80.;
print"%s %.2f %s "%("\nIba = ",Iba," Ampere");
Iaf=x
Ife=x-30
Ied=x+40
Idc=x-80
Icb=x-20
Iba=x-80
Applying KVL to the closed path AFEDCBA:
x=4.1/0.1

Iaf =  41.00  Ampere 

Ife =  11.00  Ampere 

Ied =  81.00  Ampere 

Idc =  -39.00  Ampere 

Icb =  21.00  Ampere 

Iba =  -39.00  Ampere 

Ex4-pg1.12

In [2]:
##Basic Circuit Concepts
##pg no- 1.12
##example 1.4
import math
import numpy
print("Applying KVL to the closed path OBAO");##Applying KVL to the closed path OBAO
print("3*x-3*y=2");
print("Applying KVL to the closed path ABCA");##Applying KVL to the closed path ABCA
print("9*x+12*y=4");
a=numpy.matrix([[3, -3],[9, 12]]);
b=([[2] ,[4]])
print("a=")
print[a]
print("b=")
print[b]
X=numpy.dot(numpy.linalg.inv(a),b)

print(X)
print("x=0.5714286 Ampere");
print("y=-0.095238 Ampere");
print("Ioa=0.57A")
print("Iob=1-0.57")
Iob=1-0.57;
print"%s %.2f %s "%("\nIob = ",Iob," A");
print("Iab = 0.095");
Iac=0.57-0.095;
print"%s %.2f %s "%("\nIac =",Iac," A");
print("Iab=1-0.57 + 0.095")
Iab=1-0.57 + 0.095;
print"%s %.2f %s "%("\nIob = ",Iab," A") 
Applying KVL to the closed path OBAO
3*x-3*y=2
Applying KVL to the closed path ABCA
9*x+12*y=4
a=
[matrix([[ 3, -3],
        [ 9, 12]])]
b=
[[[2], [4]]]
[[ 0.57142857]
 [-0.0952381 ]]
x=0.5714286 Ampere
y=-0.095238 Ampere
Ioa=0.57A
Iob=1-0.57

Iob =  0.43  A 
Iab = 0.095

Iac = 0.47  A 
Iab=1-0.57 + 0.095

Iob =  0.53  A 

Ex5-pg1.12

In [5]:
##Basic Circuit Concepts
##pg no-1.12
##example 1.5
I1=2./5.;
print"%s %.2f %s "%("I1=2/5= ",I1," Ampere")
I2=4./8.;
print"%s %.2f %s "%("\nI2=4/8= ",I2," Ampere")
print("\nPotential difference between points x and y = Vxy = Vx-Vy")
print("\nWriting KVL equations for the path x to y")##Writing KVL equation from x to y
print("\nVs+3*I1+4-3*I2-Vy=0")
print("\nVs+3*(0.4) + 4- 3*(0.5) -Vy = 0")
print("\nVs+3*I1+4-3*I2-Vy = 0")
print("\nVx-Vy = -3.7")
print("\nVxy = -3.7V")
I1=2/5=  0.40  Ampere 

I2=4/8=  0.50  Ampere 

Potential difference between points x and y = Vxy = Vx-Vy

Writing KVL equations for the path x to y

Vs+3*I1+4-3*I2-Vy=0

Vs+3*(0.4) + 4- 3*(0.5) -Vy = 0

Vs+3*I1+4-3*I2-Vy = 0

Vx-Vy = -3.7

Vxy = -3.7V

Ex6-pg1.13

In [6]:
##Basic Circuit Concepts
##pg no-1.13
##example 1.6
import math
#calculate the 
I1=20/15.;
print'%s %.2f %s'%("I1=2/5= ",I1," Ampere")
I2=15./10.;
print'%s %.2f %s'%("\nI2=4/8= ",I2," Ampere")
print("Voltage between points A and B = VAB = VA-VB");
print("Writing KVL equations for the path A to B:");##Writing KVL equations for the path A to B
print("VA - 5*I1 - 5 - 15 + 6*I2 - VB = 0");
print("VA - VB = 5*1.33 + 5 + 15 + 6*1.5");
VAB=(5*1.33)+5.+15.-(6*1.5);
print'%s %.2f %s'%("VAB = ",VAB," Volt")
I1=2/5=  1.33  Ampere

I2=4/8=  1.50  Ampere
Voltage between points A and B = VAB = VA-VB
Writing KVL equations for the path A to B:
VA - 5*I1 - 5 - 15 + 6*I2 - VB = 0
VA - VB = 5*1.33 + 5 + 15 + 6*1.5
VAB =  17.65  Volt

Ex7-pg1.13

In [7]:
##Basic Circuit Concepts
##page no-1.13
##example1.7
import math
#calculate the 
I1=5./2.;
print'%s %.2f %s'%("I1=2/5= ",I1," Ampere")
I2=2.;
print'%s %.2f %s'%("\nI2=4/8= ",I2," Ampere")
print("Potential difference VAB = VA - VB");
print("Writing KVL equations for path A to B")  ##Writing KVL equations for path A to B
print("VA - 2*I1 + 8 - 5*I2 - VB = 0");
print("VA - VB = (2*2.5) - 8 5 + (5*2)");
VAB=(2.*2.5)-8.+(5.*2.)
print'%s %.2f %s'%("VAB = ",VAB," Volt");
I1=2/5=  2.50  Ampere

I2=4/8=  2.00  Ampere
Potential difference VAB = VA - VB
Writing KVL equations for path A to B
VA - 2*I1 + 8 - 5*I2 - VB = 0
VA - VB = (2*2.5) - 8 5 + (5*2)
VAB =  7.00  Volt

Ex8-pg1.14

In [8]:
##Basic Circuit Concepts
##page no-1.14
##example1.8
import math
#calculate the 
I1=10./8.;
print'%s %.2f %s'%("I1=2/5= ",I1," Ampere")
I2=5.;
print'%s %.2f %s'%("\nI2=4/8= ",I2," Ampere")
print("Applying KVL to the path from A to B")  ##Applying KVL to the path from A to B
print("VA - 3*I1 - 8 + 3*I2 - VB = 0");
print("VA - VB = 3*1.25 + 8 - 3*5")
VAB= (3*1.25)+8.-(3.*5.);
print'%s %.2f %s'%("VAB = ",VAB," Volt");
I1=2/5=  1.25  Ampere

I2=4/8=  5.00  Ampere
Applying KVL to the path from A to B
VA - 3*I1 - 8 + 3*I2 - VB = 0
VA - VB = 3*1.25 + 8 - 3*5
VAB =  -3.25  Volt

Ex1.12-pg1.17

In [9]:
##Basic Circuit Concepts
##page no-1.17
##example1.12
print("Applying KVL to the circuit :");
print("50 - 5*I - 1.2*I - 16 = 0")
I=(50.-16.)/6.2;
print'%s %.2f %s'%("I= ",I," Amp");
P=50.*I;
print'%s %.2f %s'%("\nPower delivered 50 V source = 50 * 5.48= ",P," W");
Applying KVL to the circuit :
50 - 5*I - 1.2*I - 16 = 0
I=  5.48  Amp

Power delivered 50 V source = 50 * 5.48=  274.19  W

Ex1.13-pg1.18

In [10]:
##Basic Circuit Concepts
##page no-1.18
##example1.13
print("By Current Division formula ;");
I4=4.*(2./(2.+4.));
print'%s %.2f %s'%("I4 = 4 * (2/(2+4)) = ",I4," Amp");
By Current Division formula ;
I4 = 4 * (2/(2+4)) =  1.33  Amp

Ex1.14-pg1.19

In [11]:
##Basic Circuit Concepts
##page no-1.19
##example1.14
print("Applying KVL to the mesh");
print("15 - 50*I - 50*I - 5*I");
I=15./105.;
print'%s %.2f %s'%("I=15/105 = ",I," Amp");
V=15-(50*0.143);
print'%s %.2f %s'%("\nVoltage at node 2 = 15 - 50*I = ",V," Volt");
Applying KVL to the mesh
15 - 50*I - 50*I - 5*I
I=15/105 =  0.14  Amp

Voltage at node 2 = 15 - 50*I =  7.85  Volt

Ex1.15-pg1.20

In [12]:
##Basic Circuit Concepts
##pg no.-1.20
##example 1.15
r1=3.;
r2=2.33;
r3=6.;
v1=18.;
v2=5.985;
print("\nApplying KCL at the node, \n(Va-18)/3+(Va-5.985)/2.33+Va/6 = 0");
Va=((v1*r2*r3)+(v2*r1*r3))/((r2*r3)+(r1*r3)+(r1*r2));
print'%s %.2f %s'%("\nSolving the equation,we get, \nVa = ",Va," V");
Applying KCL at the node, 
(Va-18)/3+(Va-5.985)/2.33+Va/6 = 0

Solving the equation,we get, 
Va =  9.22  V