# Chapter1:DC CIRCUITS¶

## Ex1.1:pg-06¶

In [1]:
alpha0=0.0043;              #Assigning values to the parameters
t=50;
R0=40;
R50=R0*(1+0.0043*50);       # Calculating the risistance at 50 deg
print"Resistance at 50 deg C is R50=",round(R50,2),"ohms"

Resistance at 50 deg C is R50= 48.6 ohms


## Ex1.2:pg-06¶

In [16]:
R18=12.7;                            #Assigning values to the parameters
R50=14.3;
t1=18;
t2=50;
alpha0=(R50-R18)/(t2*R18-t1*R50);
alpha18=alpha0/(1+t1*alpha0);
R0=R18/(1+t1*alpha0);               # Calculating resistance at 0 deg C
print"Temperature coefficient at 0 deg C is alpha0=","{:.2e}".format(alpha0),"/deg C"
print"temperature coefficient at 18 deg C is alpha18=","{:.2e}".format(alpha18),"/deg C"
print"Resistance at 0 deg C is R0=",round(R0,2),"ohms"

Temperature coefficient at 0 deg C is alpha0= 4.24e-03 /deg C
temperature coefficient at 18 deg C is alpha18= 3.94e-03 /deg C
Resistance at 0 deg C is R0= 11.8 ohms


## Ex1.3:pg-07¶

In [9]:
alpha20=0.00403;                   #Assigning values to the parameters
t1=20;
t2=60;
R20=28.3;
R60=R20*(1+alpha20*(t2-t1));       # Calculating value of resistance at 60 deg C
print"Resistance at 60 deg C is R60=",round(R60,2),"ohms"

Resistance at 60 deg C is R60= 32.86 ohms


## Ex1.4:pg-07¶

In [12]:
R15=80;                   #Assigning values to the parameters
alpha0=0.004;
t1=15;
t2=50;
R0=R15/(1+alpha0*t1);     # Calculating resistance at 0 deg C
R50=R0*(1+alpha0*t2);     # Calculating resistance at 50 deg C
print"Resistance value at 0 deg C",round(R0,2),"ohms"
print"Resistance value at 50 deg C",round(R50,2),"ohms"

Resistance value at 0 deg C 75.47 ohms
Resistance value at 50 deg C 90.57 ohms


## Ex1.5:pg-08¶

In [15]:
R10=80;                #Assigning values to the parameters
R60=96.6;
t1=10;
t2=60;
alpha0=(R60-R10)/(t2*R10-t1*R60);
print"temperature coefficient at 0 deg C is alpha0=","{:.2e}".format(alpha0),"/deg C"

temperature coefficient at 0 deg C is alpha0= 4.33e-03 /deg C


## Ex1.6:pg-08¶

In [17]:
t1=20;               #Assigning values to the parameters
R1=45;
R2=48.5;
alpha0=0.004;
t2=((R2*(1+alpha0*t1))-45)/(alpha0*R1);      #calculating average temperature
print"Average temperature of winding at the end of the run when the resistance increases is t2=",round(t2,2),"deg C"

Average temperature of winding at the end of the run when the resistance increases is t2= 41.0 deg C


## Ex1.7:pg-08¶

In [22]:
t1=20.0;                                #Assigning values to the parameters
R1=18.0;
t2=50.0;
R2=20.0;
R3=21.0;
ts=15.0;
alpha0=(R2-R1)/(t2*R1-t1*R2);
t=((R3*(1+alpha0*20))-(R1))/(alpha0*R1);
print" Temperature Coefficient at 0 deg C is t=",round(t,2),"deg C"
trise=t-ts;
print"mean temperature rise is trise=",round(trise,2),"deg C"

 Temperature Coefficient at 0 deg C is t= 65.0 deg C
mean temperature rise is trise= 50.0 deg C


## Ex1.8:pg-15¶

In [23]:
R1=5;                      #Assigning values to the parameters
R2=7;
R3=8;
Req=R1+R2+R3;             # Calculating equivalent resistance
V=100;
I=V/Req;
V1=I*R1;
V2=I*R2;
V3=I*R3;
print"Voltage across 5 Ohm resistor is V1",round(V1,2),"Volts"
print"Voltage across 7 Ohm resistor is V2",round(V2,2),"Volts"
print"Voltage across 8 Ohm resistor is V3",round(V3,2),"Volts"

Voltage across 5 Ohm resistor is V1 25.0 Volts
Voltage across 7 Ohm resistor is V2 35.0 Volts
Voltage across 8 Ohm resistor is V3 40.0 Volts


## Ex1.9:pg-16¶

In [24]:
V=100;                 #Assigning values to the parameters
R1=5;
R2=10;
R3=20;
I1=V/R1;
I2=V/R2;
I3=V/R3;
Itot=I1+I2+I3;       #Calculating total current
print"Current through 5 Ohm resistor is I1=",round(I1,2),"Amperes"
print"Current through 10 Ohm resistor is I2=",round(I2,2),"Amperes"
print"Current through 20 Ohm resistor is I3=",round(I3,2),"Amperes"
print"Total current is Itot=",round(Itot,2),"Amperes"
P=Itot*V;
print"Power drawn from the source is P=",round(P,2),"Watts"

Current through 5 Ohm resistor is I1= 20.0 Amperes
Current through 10 Ohm resistor is I2= 10.0 Amperes
Current through 20 Ohm resistor is I3= 5.0 Amperes
Total current is Itot= 35.0 Amperes
Power drawn from the source is P= 3500.0 Watts


## Ex1.10:pg-16¶

In [27]:
V=100;         # Assigning values to the parameters
R1=5;
R2=10;
R3=15;
R4=20;
Req=R1+R2+R3+R4;  #Equivalent resistance
V1=R1*V/Req;
V2=R2*V/Req;
V3=R3*V/Req;
V4=R4*V/Req;
print"Voltage across 5 Ohms resistor is V1=",round(V1,2),"Volts"
print"Voltage across 10 Ohms resistor is V2",round(V2,2),"Volts"
print"Voltage across 15 Ohms resistor is V3=",round(V3,2),"Volts"
print"Voltage across 20 Ohms resistor is V4",round(V4,2),"Volts"

Voltage across 5 Ohms resistor is V1= 10.0 Volts
Voltage across 10 Ohms resistor is V2 20.0 Volts
Voltage across 15 Ohms resistor is V3= 30.0 Volts
Voltage across 20 Ohms resistor is V4 40.0 Volts


## Ex1.11:pg-17¶

In [37]:
Itot=12.0;             #Assigning values to parameters
R1=4.0;
R2=12.0;
R3=6.0;
Req=1.0/((1/R1)+(1/R2)+(1/R3));        #Equivalent resistance
V=Itot*Req;
I1=V/R1;
I2=V/R2;
I3=V/R3;
print"Potential Difference across the parallel circuit is V=",round(V,2),"Volts"
print"Current through 4 Ohm resistor is I1=",round(I1),"A"
print"Current through 12 Ohm resistor is I2=",round(I2),"A"
print"Current through 6 Ohm resistor is I3=",round(I3),"A"

Potential Difference across the parallel circuit is V= 24.0 Volts
Current through 4 Ohm resistor is I1= 6.0 A
Current through 12 Ohm resistor is I2= 2.0 A
Current through 6 Ohm resistor is I3= 4.0 A


## Ex1.12:pg-17¶

In [38]:
I=5;             #Assigning values to the parameters
I1=2;
R2=6;
I2=I-I1;
V=R2*I2;
R1=V/I1;
P=I1*I1*R1+I2*I2*R2;
print"Value of R1=",round(R1,2),"ohms"
print"Power absorbed by the circuit is P=",round(P,2),"Watts"

Value of R1= 9.0 ohms
Power absorbed by the circuit is P= 90.0 Watts


## Ex1.13:pg-18¶

In [31]:
R1=8.0;                        # Assigning values to resistors
R2=6.0;
R3=3.0;
R4=18.0;
R5=5.0;
R=1/((1/R2)+(1/R3));        #simplifying the network
Rs1=R+R4;
Rs2=1/((1/Rs1)+(1/R5));
Rs3=R1+Rs2;
V=60;
I=V/Rs3;                   # Current through the simplified network
print"Current through 8 Ohm resistor is I=",round(I,2),"A"

Current through 8 Ohm resistor is I= 5.0 A


## Ex1.14:pg-19¶

In [30]:
R1=1.0;                     # Assigning values to resistors
R2=2.0;
R3=1.0;
R4=1.0;
R=R3+R4;                 # Simplifying the network
Req=1+(1/((1/R2)+(1/R)));
V=100;
I=V/Req;
I2=I*(R/(R+R2));

Ammeter reading is= 25.0 A


## Ex1.15:pg-20¶

In [42]:
R1=1.0;               # Assigning values to the parameters
R2=5.0;
R3=4.0;
R4=8.0;
R5=6.0;
R6=2.0;
R=R1+R2;           #series connection
Ra=R5+R6;
Rb=1/((1/R4)+(1/Ra)) ;
Rc=R3+Rb;
Req=1/((1/R)+(1/Rc));
print"Effective resistance is Req=",round(Req,2),"ohms"

Effective resistance is Req= 3.43 ohms


## Ex1.16:pg-21¶

In [39]:
V=24.0;                        #Assigning values to parameters
R1=4.0;
R2=8.0;
R3=6.0;
R4=12.0;
Ra=1/((1/R1)+(1/R4));       # Simplifying the network
Rb=1/((1/R2)+(1/R3));
Rc=1/((1/Ra)+(1/Rb));
I=V/Rc;
print"Battery current is I=",round(I,2),"A"

Battery current is I= 15.0 A


## Ex1.17:pg-22¶

In [41]:
R1=15.0;                      #Assigning values to parameters
R2=6.0;
R3=30.0;
R4=3.0;
R5=4.0;
V=10.0;
Ra=R1+R2;                  # Simplifying the circuit
Rb=R3+R4;
Rc=1/((1/Ra)+(1/Rb));
Req=Rc+R5;
I=V/Req;
print"Battery current is I=",round(I,2),"A"

Battery current is I= 0.59 A


## Ex1.18:pg-23¶

In [44]:
R1=15.0;                          #Assigning parameters
R2=6.0;
R3=4.0;
R4=30.0;
R5=3.0;
Ra=1/((1/R2)+(1/R5));          # Simplifying the circuit
Rb=R3+Ra;
Rc=1/((1/R1)+(1/R4));
Req=Rb+Rc;
print"Effective resistance is Req=",round(Req,2),"ohms"

Effective resistance is Req= 16.0 ohms


## Ex1.19:pg-24¶

In [49]:
V=30.0;                       #Assignign values to parameters
Rcf=2.0;
Ref=2.0;
Rec=2.4;
Rbc=2.0;
Rac=4.0;
Rae=2.0;
Rab=2.0;
Red=1.0;
Rc=Rab+Rbc;               # Simplifying the network
Re=Rcf+Ref;
Ra=1.0/((1.0/Rac)+(1.0/Rc));
Re1=1.0/((1.0/Re)+(1.0/Rec));
Ra1=Ra+Re1;
Re2=1.0/((1.0/Rae)+(1.0/Ra1));
Rd=Red+Re2;
I=V/Req;                   # Calculation of battery current
print"Effective resistance is Req=",round(Req,2),"ohms"
print"Battery current is I=",round(I,2),"A"

Effective resistance is Req= 1.06 ohms
Battery current is I= 28.2 A


## Ex1.20:pg-25¶

In [46]:
R1=4.0;                       #Assigning values to parameters
R2=6.0;
R3=8.0;
R4=2.0;
Ra=1/((1/R1)+(1/R2));      # Simplifying the network
Rb=1/((1/R3)+(1/R4));
Req=Ra+Rb;
print"Effective resistance is Req=",round(Req,2),"ohms"

Effective resistance is Req= 4.0 ohms


## Ex1.21:pg-26¶

In [14]:
R1=5.0;                       #Assigning values to resistors
R2=15.0;
R3=10.0;
R4=10.0;
R5=40.0;
R6=30.0;
R7=20.0;
R8=8.0;
Rc=R2+R3;                  #Simplifying the network
Re=R4+R5;
Rf=R6+R7;
R=1/((1/Re)+(1/Rf));
Rd=1/((1/R)+(1/Rc));
Req=Rd+R1+R8;
print"Effective resistance=",round(Req,2),"ohms"

Effective resistance= 25.5 ohms


## Ex1.22:pg-27¶

In [12]:
V=20;                   #Assigning values to different parameters
I=1.5;
R1=10;
R2=15;
R3=15;
V10=R1*I;
Vab=V-V10;
I1=Vab/R2;
I2=Vab/R3;
I3=I-I1-I2;
R=Vab/I3;
print"Value of unknown resistance=",round(R,2),"ohms"

Value of unknown resistance= 6.0 ohms


## Ex1.23:pg-28¶

In [11]:
P=36;                      #Assigning values to different parameters
V=60;
R1=12;
R2=18;
R3=36;
I1=sqrt(P/R1);
V12=I1*R1;
Vr=V-V12;
I2=V12/R2;
I3=V12/R3;
I=I1+I2+I3;
R=Vr/I;
print"Value of unknown resistance=",round(R,3),"ohms"

Value of unknown resistance= 11.321 ohms


## Ex1.24:pg-28¶

In [9]:
R1=4.0;                    #Assigning values to parameters
R2=9.0;
R3=18.0;
R4=2.0;
R5=7.0;
R6=15.0;
V=125.0;
R7=(R2*R3)/(R2+R3);
Ra=R7+R1;
Rb=R5+R4;
R=(1/((1/Ra)+(1/Rb)))+R6;
I=V/R;
I1=(Rb/(Ra+Rb))*I;
IR3=I1*Rb/(Rb+R3);
VR3=IR3*R3;
I2=I-I1;
P4=I2*I2*R5;
print"current I=",round(I,2),"A"
print"Current in 15 Ohm resistor=",round(I1,2),"A"
print"Current in 18 Ohm resistor=",round(IR3,2),"A"
print"current in 7 ohm resistor=",round(I2,2),"A"
print"Voltage across 18 Ohm resistor=",round(VR3,2),"Volts"
print"Power dissipated in 7 Ohm resistor=",round(P4,2),"Watts"

current I= 6.33 A
Current in 15 Ohm resistor= 3.0 A
Current in 18 Ohm resistor= 1.0 A
current in 7 ohm resistor= 3.33 A
Voltage across 18 Ohm resistor= 18.0 Volts
Power dissipated in 7 Ohm resistor= 77.78 Watts


## Ex1.26:pg-32¶

In [2]:
I1=5.0;                          #Assigning values to parameters
R1=2.0;
V1=6.0;
I2=2.0;
R2=4.0;
V2=I1*R1;                     #Performing source transformation
V=V2-V1;
I3=V/R1;
I=I3+I2;
IR2=I*R1/(R1+R2);
print"Current in 4 ohm resistor using source transformation",round(IR2,2),"A"

Current in 4 ohm resistor using source transformation 1.33 A


## Ex1.27:pg-33¶

In [17]:
V1=6.0;                             #Assigning values to parameters
R1=2.0;
R2=6.0;
R3=2.0;
I1=3.0;
R4=1.0;
R5=3.0;
I2=V1/R1;                        #Performing source transformation
R6=(R2*R3)/(R2+R3);
V2=I2*R6;
R7=R6+R1;
I3=V2/R7;
I4=I1+I3;
IR5=I4*R7/(R7+R4+R5);
print"Current in 3 Ohm resistor using source transformation=",round(IR5,2),"A"

Current in 3 Ohm resistor using source transformation= 2.0 A


## Ex1.28:pg-35¶

In [21]:
R1=4.0;                          #Assigning values to parameters
V1=7.0;
R2=2.0;
R3=4.0;
I1=8.0;
R4=6.0;
R5=9.0;
V2=12.0;
R6=10.0;
I2=V1/R1;                    #Performing source transformation
V3=I1*R2;
I3=V2/R5;
R7=R2+R3;
I4=V3/R7;
R=1/((1/R1)+(1/R7)+(1/R4)+(1/R5));
I=I2+I3-I4;
V=I*R;
IR6=V/(R+R6)
print"Current in 10 Ohm resistor using source transformation",round(IR6,3),"A"

Current in 10 Ohm resistor using source transformation 0.052 A


## Ex1.29:pg-39¶

In [89]:
import numpy as np
from numpy.linalg import inv
R1=3;  #Assigning values to parameters
R2=2;
R3=4;
V1=35;
V2=40;
A=[5,2],[3,-4]  #Matrix of I1,I2 by KVL equations
B=[35],[-5]
a=inv(A)
I=np.dot(a,B)# I matrix has I1 and I2 values
I1=I[0][0]
I2=I[1][0]
print"Current in 3 ohm resistor=",round(I1,2),"A"
print"Current in 4 ohm resistor",round(I2,2),"A"
I3=I1+I2
print"Current in 2 ohm resistor",round(I3,2),"A"

Current in 3 ohm resistor= 5.0 A
Current in 4 ohm resistor 5.0 A
Current in 2 ohm resistor 10.0 A


## Ex1.30:pg-40¶

In [92]:
import numpy as np
from numpy.linalg import inv
R1=2.0;                     #Assigning values to parameters
R2=3.0;
R3=4.0;
R4=5.0;
R5=1.0;
A=[3,-3],[9,12]           #Matrix of I1,I2 by KVL equations
B=[2],[4]
I=np.dot(inv(A),B)# I matrix has I1 and I2 values
I1=I[0][0]
I2=I[1][0]
print"Current in 1 Ohm resistor is I1",round(I1,2),"A"
print"Current in 3 Ohm resistor is I2",round(I2,3),"A"
IR2=1-I1
IR4=1-I1-I2
IR5=I1+I2
print"Current in 2 Ohm resistor is IR2",round(IR2,3),"A"
print"Current in 4 Ohm resistor is IR4",round(IR4,3),"A"
print"Current in 5 Ohm resistor is IR5 ",round(IR5,3),"A"

Current in 1 Ohm resistor is I1 0.57 A
Current in 3 Ohm resistor is I2 -0.095 A
Current in 2 Ohm resistor is IR2 0.429 A
Current in 4 Ohm resistor is IR4 0.524 A
Current in 5 Ohm resistor is IR5  0.476 A


## Ex1.31:pg-40¶

In [88]:
from numpy.linalg import inv
A=[1,-5,3],[5,-1,-9],[7,1,-5]           #Matrix of I1,I2,I3 Coeffecients by KVL equations
B=[0],[0],[1];
a=inv(A)
I=np.dot(a,B)
I1=I[0][0]+I[1][0]
print"Current supplied by the battery is I1=",round(I1,2),"A"

Current supplied by the battery is I1= 0.3 A


## Ex1.32:pg-42¶

In [87]:
import numpy as np
from numpy.linalg import inv
A=[0,6,-2],[3,4,1],[1,2,-4]           #Matrix of I1,I2,I3 Coeffecients by KVL equations
B=[9],[24],[-4]
a=inv(A)
I=np.dot(a,B)
I1=I[1][0]
print"Current in 20 Ohm resistor=",round(I1,3),"A"

Current in 20 Ohm resistor= 2.554 A


## Ex1.38:pg-49¶

In [22]:
R1=2.0;                         #Assigning values to parameters
R2=2.0;
R3=4.0;
R4=6.0;
R5=6.0;
R6=2.0;
R7=7.0;
Ra=R6*R3/(R3+R5+R6);         #Converting Delta to Star
Rb=R5*R6/(R3+R5+R6);
Rc=R3*R5/(R3+R5+R6);
R8=Rc+R4;
R9=Rb+R7;
R10=(R8*R9)/(R8+R9);
R=R1+R2+Ra+R10;
print"Equivalent resistor of the network using Star-Delta transformation=",round(R,2),"ohms"

Equivalent resistor of the network using Star-Delta transformation= 8.67 ohms


## Ex1.40:pg-53¶

In [23]:
R1=6.0;              #Assigning values to parameters
R2=8.0;
R3=5.0;
R4=10.0;
R5=5.0;
R6=10.0;
R7=15.0;
V=100.0;
Rx=R3+R6+(R3*R6)/R4;      #Converting Star to Delta
Ry=R4+R6+(R4*R6)/R3;
Rz=R3+R4+(R3*R4)/R6;
Ra=(R5*Rx)/(Rx+R5);
Rb=(Ry*R7)/(Ry+R7);
Rl=(R1*R2)/(R1+R2+Rz);    #Converting Delta to Star
Rm=(R1*Rz)/(R1+R2+Rz);
Rn=(R2*Rz)/(R1+R2+Rz);
R8=Ra+Rm;
R9=Rb+Rn;
R10=(R8*R9)/(R8+R9);
R=R10+Rl;
I=V/R;
print"Current in the circuit=",round(I,2),"A"

Current in the circuit= 15.4 A


## Ex1.41:pg-55¶

In [24]:
R1=8.0;                          #Assigning values to parameters
R2=4.0;
R3=12.0;
R4=12.0;
R5=34.0;
R6=30.0;
R7=30.0;
R8=17.0;
R9=13.0;
R10=R1+R2;
R11=R8+R9;
Ra=(R10*R3)/(R3+R4+R10);       #Converting Delta to Star
Rb=(R3*R4)/(R3+R4+R10);
Rc=(R10*R4)/(R3+R4+R10);
Rx=(R6*R7)/(R6+R7+R11);       #Converting Delta to Star
Ry=(R7*R11)/(R6+R7+R11);
Rz=(R6*R11)/(R6+R7+R11);
Rl=R5+Ra+Rx;
Rm=Rc+Ry;
Rn=(Rl*Rm)/(Rl+Rm);
Req=Rb+Rz+Rn;
print"Equivalent resistance of the network=",round(Req,2),"ohms"

Equivalent resistance of the network= 24.84 ohms


## Ex1.42:pg-57¶

In [80]:
R1=6.0;                        #Assigning values to parameters
R2=6.0;
R3=3.0;
R4=12.0;
R5=12.0;
R6=12.0;
R7=3.0;
Ra=(R4*R5)/(R4+R5+R6);      #Converting Delta to Star
Rb=(R4*R6)/(R4+R5+R6);
Rc=(R5*R6)/(R4+R5+R6);
Rd=R3+Rb;
Re=R7+Rc;
Rf=(R1*R2)/(R1+R2);
Rh=(Rd*Re)/(Rd+Re);
Req=Ra+Rf+Rh;
print"Equivalent resistance of the network is Req=",round(Req,2),"ohms"

Equivalent resistance of the network is Req= 10.5 ohms


## Ex1.43:pg-58¶

In [26]:
R1=6.0;                              #Assigning values to parameters
R2=4.0;
R3=3.0;
R4=5.0;
R5=5.0;
R6=2.0;
R7=4.0;
Rx=R3+R4+(R3*R4)/R6;             #Converting Star to Delta
Ry=R4+R6+(R4*R6)/R3;
Rz=R3+R6+(R3*R6)/R4;
Ra=(R5*Rz)/(R5+Rz);
Rb=(R7*Ry)/(R7+Ry);
Rl=(R1*R2)/(R1+R2+Rx);          #Converting Delta to Star
Rm=(R2*Rx)/(R1+R2+Rx);
Rn=(R1*Rx)/(R1+R2+Rx);
Rp=Ra+Rn;
Rq=Rb+Rm;
Rr=(Rp*Rq)/(Rp+Rq);
Req=Rl+Rr;
print"Eqivalent resistance of the network=",round(Req,2),"ohms"

Eqivalent resistance of the network= 3.85 ohms


## Ex1.44:pg-61¶

In [77]:
import numpy as np
from numpy.linalg import inv
A=np.matrix([[-6,3],[3,-10.5]])  #Matrix of I1,I2 Coeffecients by Mesh analysis
B=np.matrix([[-12.5],[0]])
a=inv(A)
I=np.dot(a,B)
I1=I[0][0]
print"current in 1 ohm resistor I1=",round(I1,2),"A"

 current in 1 ohm resistor I1= 2.43 A


## Ex1.45:pg-62¶

In [79]:
import numpy as np
from numpy.linalg import inv
A=np.matrix([[7,-1,0],[1,-6,3],[0,3,-4]]) #Matrix of I1,I2,I3 Coeffecients by Mesh analysis
B=np.matrix([[17],[-25],[19]])
a=inv(A)
I=np.dot(a,B)
I1=I[0][0]
I2=I[1][0]
I3=I[2][0]
print"I1=",round(I1,2),"A"
print"I2=",round(I2,2),"A"
print"I3=",round(I3,2),"A"

I1= 2.95 A
I2= 3.65 A
I3= -2.01 A


## Ex1.47:pg-64¶

In [27]:
I1=6.0;
R1=1.0;
R2=2.0;
R3=5.0;
V=10.0;
I2=(2*I1-10)/7;
IR2=(I1-I2);
print"Current in 2 Ohm resistor=",round(IR2,2),"A"

Current in 2 Ohm resistor= 5.71 A


## Ex1.48:pg-65¶

In [96]:
import numpy as np
from numpy.linalg import inv
V1=60;
R1=20;
I=1.0;
R2=30;
R3=50;
V2=40;
R4=100;
A=[-1,1,0],[-20,-80,50],[0,50,-150]           #Matrix of I1,I2,I3 Coeffecients by Mesh analysis
B=[1],[-20],[-40]
I1=np.dot(inv(A),B);
IR100=I1[1][0]
print"Current in 100 Ohm resistor is IR100=",round(IR100,2),"A"

Current in 100 Ohm resistor is IR100= 0.64 A


## Ex1.49:pg-67¶

In [104]:
import numpy as np
from numpy.linalg import inv
V=50.0;
R1=10.0;
R2=5.0;
R3=3.0;
R4=2.0;
R5=1.0;
I=2.0;
A=[0,1,-1],[15,-12,-6],[-15,10,5]           #Matrix of I1,I2,I3 Coeffecients by Mesh analysis
B=[2],[0],[-50]
I1=np.dot(inv(A),B)
I2=I1[0][0]
I3=I1[2][0]
IR5=I2-I3
print"Current in 5 Ohm resistor is IR5=",round(IR5,2),"A"
#the answer in the book is 14.67,which is wrong

Current in 5 Ohm resistor is IR5= 4.67 A


## Ex1.50:pg-69¶

In [109]:
import numpy as np
from numpy.linalg import inv
R1=20;
R2=10;
R3=15;
R4=10;
R5=10;
V1=100;
V2=80;
A=[13,-4],[1,-4]           #Applying KCL at the two nodes
B=[300],[120]
V=np.dot(inv(A),B)
IR3=(V[0][0]-V[1][0])/R3;
print"Current in 15 Ohm resistor is IR3",round(IR3,2),"A"

Current in 15 Ohm resistor is IR3 2.75 A


## Ex1.51:pg-70¶

In [110]:
import numpy as np
from numpy.linalg import inv
R1=0.2;
R2=0.3;
R3=0.1;
V1=120;
V2=110;
A=[5,-2],[1,-4]                 #Applying KCL at the two nodes
B=[358.2],[-324]
V=np.dot(inv(A),B)
I1=(120-V[0][0])/R1;
I2=(V[0][0]-V[1][0])/R2;
I3=(110-V[1][0])/R3;
print"Current I1",round(I1,2),"A"
print"Current I1",round(I2,2),"A"
print"Current I1",round(I3,2),"A"

Current I1 22.0 A
Current I1 19.0 A
Current I1 1.0 A


## Ex1.52:pg-71¶

In [111]:
import numpy as np
from numpy.linalg import inv
R1=2;
R2=4;
R3=4;
R4=2;
I1=2;
I2=4;
A=[2,-1],[1,-3];                #Applying KCL at the two nodes
B=[8],[-16];
V=np.dot(inv(A),B)
print"Voltage at node A is V[0][0]=",round(V[0][0],2),"Volts"
print"Voltage at node B is V[1][0]=",round(V[1][0],2),"Volts"

Voltage at node A is V[0][0]= 8.0 Volts
Voltage at node B is V[1][0]= 8.0 Volts


## Ex1.53:pg-72¶

In [114]:
import numpy as np
from numpy.linalg import inv
R1=2;
R2=10;
R3=5;
R4=15;
I1=1/3;
R5=3;
V1=10;
V2=18;
A=[8,-2],[3,-9];                #Applying KCL at the two nodes
B=[50],[-85];
V=np.dot(inv(A),B)
I1=(V1-V[0][0])/R1;
I5=(V[1][0]-V2)/R5;
print"Current in 2 Ohm resistor is I1=",round(I1,3),"A"
print"Current in 3 Ohm resistor is I1=",round(I5,2),"A"

Current in 2 Ohm resistor is I1= 0.303 A
Current in 3 Ohm resistor is I1= -1.81 A


## Ex1.54:pg-73¶

In [118]:
import numpy as np
from numpy.linalg import inv
R1=2;                                           #Assigning values to parameters
R2=10;
R3=2;
R4=5;
R5=1;
R6=4;
I1=28;
I2=2;
A=[11,-5,-1],[5,-17,10],[1,10,-13.5];               #Applying KCL at the two nodes
B=[280],[0],[20];
V=np.dot(inv(A),B)
I1=V[0][0]/R1;
I2=(V[0][0]-V[1][0])/R3;
I3=(V[0][0]-V[2][0])/R2;
I4=(V[1][0]-V[2][0])/R5;
I5=V[1][0]/R4;
I6=V[2][0]/R6;
print"Current I1",round(I1,2),"A"
print"Current I2",round(I2,2),"A"
print"Current I3",round(I3,2),"A"
print"Current I4",round(I4,2),"A"
print"Current I5",round(I5,2),"A"
print"Current I6",round(I6,2),"A"

Current I1 18.0 A
Current I2 8.0 A
Current I3 2.0 A
Current I4 4.0 A
Current I5 4.0 A
Current I6 4.0 A


## Ex1.55:pg-76¶

In [120]:
V1=35.0;                          #Assigning values to parameters
R1=3.0;
R2=2.0;
R3=4.0;
V2=40.0;
Ra=((R2*R3)/(R2+R3))+R1;       # Considering only 35V source
I=V1/Ra;
IR1=I;
IR3=I*(R2)/(R2+R3);
IR2=I-IR3;
Rb=((R1*R2)/(R1+R2))+R3;      #Considering only 40V source
I1=V2/Rb;
I1R3=I1;
I1R1=I1*(R2)/(R2+R3);
I1R2=I1-I1R1;
Ires3=IR1-I1R1;              # Adding the currents algebraically
Ires2=IR2+I1R2;
Ires4=I1R3-IR3;
print"Current in 3 Ohm resistor using Superposition Theorem",round(Ires3,2),"A"
print"Current in 2 Ohm resistor using Superposition Theorem",round(Ires2,2),"A"
print"Current in 4 Ohm resistor using Superposition Theorem",round(Ires4,2),"A"

Current in 3 Ohm resistor using Superposition Theorem 5.51 A
Current in 2 Ohm resistor using Superposition Theorem 10.51 A
Current in 4 Ohm resistor using Superposition Theorem 5.0 A


## Ex1.56:pg-77¶

In [121]:
import numpy as np
from numpy.linalg import inv
I1=1;                      #Assigning values to parameters
R1=3;
R2=2;
R3=2;
R4=2;
R5=1;
Ra=(R1*R2)/(R1+R2);
Rb=(R3*R4)/(R3+R4);
Iab=(I1*Ra)/(Ra+Rb+R5);
A=[5,0,-2],[0,4,-2],[2,2,-5];   #Current coeffecients by applying KVL
B=[-1],[1],[0];
I=np.dot(inv(A),B)
IR5=I[2][0]+Iab;
print"Current in 1 Ohm resistor",round(IR5,3),"A"

Current in 1 Ohm resistor 0.031 A


## Ex1.57:pg-79¶

In [125]:
V1=10.0;                         #Assigning values to parameters
R1=10.0;
R2=1.0;
V2=8.0;
R3=8.0;
V3=12.0;
R4=20.0;
I20=V1/(R2+R4);                # Considering only 10V source
Ia20=V3/(R2+R4);               # Considering only 12V source
Ib20=V2/(R2+R4);               # Considering only 8V source
I=Ia20+Ib20-I20;               # Adding the currents algebraically
print"Current through 20 Ohm resistor using Superposition principle",round(I,3),"A"

Current through 20 Ohm resistor using Superposition principle 0.476 A


## Ex1.58:pg-82¶

In [126]:
V1=4.0;                             #Assigning values to parameters
R1=2.0;
I1=1.0;
R2=1.0;
R3=3.0;
I2=3.0;
I1a=V1/(R1+R2);                 #Considering the current flow due to 4V voltage source
I1b=(I2*R1)/(R1+R2);            #Considering the current flow due to 3A current source
I1c=(I1*R1)/(R2+R1);            #Considering the current flow due to 1A current source
I=I1a+I1b+I1c;
print"Current in 1 Ohm resistor using Superposition principle",round(I,3),"A"

Current in 1 Ohm resistor using Superposition principle 4.0 A


## Ex1.59:pg-83¶

In [132]:
V1=50.0;                         #Assigning values to parameters
V2=36.0;
R1=5.0;
R2=20.0;
R3=10.0;
I1=4.0;
R4=(R2*R3)/(R2+R3);
R5=R4+R1;
I5a=V1/R5;                    #Considering only 50V source
I5b=I1*(R4/(R4+R1));            #Considering only 4A current source
I2=V2/R3;                     #Converting 36V voltage source to 3.6A current source using source transformation
I5c=I2*(R4/(R4+R1));            #Considering only 3.6A current source
print"Current through 5 Ohm resistor using Superposition principle",round(I,2),"A"

Current through 5 Ohm resistor using Superposition principle 0.06 A


## Ex1.60:pg-85¶

In [131]:
V1=80.0;                          #Assigning values to parametrs
V2=20.0;
I1=20.0;
R1=5.0;
R2=10.0;
R3=50.0;
R4=20.0;
R5=(R3*R4)/(R3+R4);
I10a=V1/(R1+R2+R5);           #Considering only 80V voltage source
I2=V2/R4;                     #Converting 20V voltage source to 1A current source
I10b=(I2*R5)/(R1+R2+R5);      #Considering only 1A current source
I10c=(I1*R1)/(R1+R2+R5);      #Considering only 20A current source
print"Current through 5 Ohm resistor using Superposition principle",round(I,2),"A"

Current through 5 Ohm resistor using Superposition principle 1.17 A


## Ex1.61:pg-90¶

In [59]:
V1=10.0;                     #Assigning values to parameters
V2=20.0;
R1=6.0;
R2=1.0;
R3=2.0;
R4=3.0;
R5=5.0;
A=[7,-1],[1,-6]          #Mesh current coeffecients
B=[10],[0]
I=np.dot(inv(A),B)
Vth=V2+R4*I[1][0];       #Calculation of Thevenin vlotage
Ra=(R1*R2)/(R1+R2);
Rb=Ra+R3;
Rth=(R4*Rb)/(R4+Rb);   #Calculation of Thevenin current
I1=Vth/(Rth+R5)
print"Current in 5 Ohm resistor using Thevenin theorem",round(I1,2),"A"

Current in 5 Ohm resistor using Thevenin theorem 3.21 A


## Ex1.62:pg-92¶

In [51]:
R1=1.5;                         #Assignig values to parameters
R2=6;
R3=5;
R4=7.5;
R5=9;
V1=6;
V2=30;
A=[-22.5,7.5],[7.5,-12.5];      #Current coeffecients
B=[0],[30];
I=np.dot(inv(A),B)
Vth=(V1+R3*I[1][0]+R2*I[0][0])*-1;   #Thevenin voltage
Ra=(R3*R4)/(R4+R3);
Rb=Ra+R2;
Rth=(Rb*R5)/(R5+Rb);              #Thevenin resistance
I1=Vth/(Rth+R1)
print"Current in 1.5 Ohm resistor",round(I1,3),"A"

Current in 1.5 Ohm resistor 2.5 A


## Ex1.63:pg-94¶

In [39]:
V1=2.0;
V2=4.0;
R1=5.0;
R2=10.0;
R3=10.0;
R4=8.0;
R5=5.0;
A=[-15,10],[10,-25];
B=[-2],[4];
I=np.dot(inv(A),B)
Vth=V2+R1*I[1][0];
Ra=(R1*R2)/(R1+R2);
Rb=Ra+R3;
Rth=(Rb*R5)/(Rb+R5);
I1=Vth/(Rth+R4)
print"Current in 8 Ohm resistor",round(I1,3),"A"

Current in 8 Ohm resistor 0.281 A


## Ex1.64:pg-96¶

In [35]:
R1=8;                          #Assigning values to parameters
R2=4;
R3=12;
R4=12;
R5=34;
R6=30;
R7=30;
R8=17;
R9=13;
V=180;
R10=R1+R2;
R11=R8+R9;
Ra=(R10*R3)/(R3+R4+R10);       #Converting Delta to Star
Rb=(R3*R4)/(R3+R4+R10);
Rc=(R10*R4)/(R3+R4+R10);
Rx=(R6*R7)/(R6+R7+R11);       #Converting Delta to Star
Ry=(R7*R11)/(R6+R7+R11);
Rz=(R6*R11)/(R6+R7+R11);
Rp=R5+Ra+Rx;
Rm=Rc+Ry;
Rn=(Rp*Rm)/(Rp+Rm);
Rth=Rb+Rz+Rn;
I=V/(Rp+Rc+Rz);
Vth=Rp*I
Rl=10;
Il=Vth/(Rl+Rth);
print"Current in 10 Ohm load using Thevenin theorem is",round(I1,2),"A"

Current in 10 Ohm load using Thevenin theorem is 4.0 A


## Ex1.65:pg-101¶

In [28]:
V1=12.0;                     #Assigning values to parameters
V2=8.0;
I1=4.0;
R1=2.0;
R2=10.0;
R3=20.0;
R4=5.0;
R5=15.0;
R6=25.0;
R7=5.0;
A=[1,-1,0],[-12,-20,15],[0,15,-45];   #Current coeffecients
B=[4],[-12],[8];
I=np.dot(inv(A),B)
Vth=V1-R1*I[0][0]-R2*I[0][0];     #Thevenin voltage
Ra=R1+R2;
Rb=R6+R7;
Rc=(R5*Rb)/(R5+Rb);
Rd=R4+Rc;
Rth=(Ra*Rd)/(Ra+Rd);          #Thevenin resistance
Il=Vth/(R3+Rth);
P=Il*Il*R3;
print"Power drawn by 20 Ohm resistor",round(P,2),"Watts"

Power drawn by 20 Ohm resistor 9.96 Watts


## Ex1.66:pg-103¶

In [24]:
import numpy as np
from numpy.linalg import inv
V1=150.0;                  #Assigning values to parameters
V2=50.0;
I1=13.0;
R1=15.0;
R2=60.0;
R3=40.0;
R4=30.0;
A=[-1,1],[-15,-100];      #Current coeffecients
B=[13],[-150];
I=np.dot(inv(A),B)
Vth=-V2+R3*I[1][0];#Thevenin voltage
Ra=R1+R2;
Rth=(R3*Ra)/(R3+Ra);#Thevenin resistance
I1=Vth/(R4+Rth)
print" Current flowing in 20 Ohm resistor",round(I1,3),"A"

 Current flowing in 20 Ohm resistor 1.248 A


## Ex1.67:pg-105¶

In [80]:
V=100.0;                                      #Assigning values to parameters
R1=20.0;
R2=80.0;
R3=40.0;
R4=50.0;
I1=V/(R1+R2);
I2=V/(R3+R4);
Vth=R3*I2-R1*I1;                             #Calculating Thevenin voltage
Rth=((R1*R2)/(R1+R2))+((R3*R4)/(R3+R4));    # Calculating Thevenin resistance
Rl=5.0;
I1=Vth/(Rth+R1);                           #Calculating Thevenin current
Rla=10.0;
Ila=Vth/(Rth+Rla);
Rlb=20.0;
Ilb=Vth/(Rth+Rlb);

Current in 5 Ohm load 0.5656 A
Current in 10 Ohm load 0.507 A
Current in 20 Ohm load 0.4198 A


## Ex1.68:pg-108¶

In [93]:
R1=10.0;                     #Assigning values to parameters
R2=20.0;
R3=40.0;
R4=30.0;
R5=15.0;
V=2.0;
I1=V/(R1+R4);
I2=V/(R2+R5);
Vth=R2*I2-R1*I1;         #Calculation of Thevenin voltage
Rth=((R1*R4)/(R1+R4))+((R2*R5)/(R2+R5));   #Calculation of Thevenin resistance
Il=Vth/(Rth+R3);

Load current 11.465 mA


## Ex1.69:pg-110¶

In [68]:
R1=10.0;                    #Assigning values to parameters
R2=10.0;
R3=15.0;
R4=20.0;
V=100.0;
A=[-20,10],[10,-25]        #Current coeffecients by KVL equations
B=[-100],[0];
I=np.dot(inv(A),B);
IN=I[1][0];              #Norton's current
RN=(R1*R2)/(R1+R2)+R3;  #Norton's resistance
I1=(IN*RN)/(RN+RN);
print"Current in load of 20 Ohm resistor using Norton theorem ",round(I1,2),"A"

Current in load of 20 Ohm resistor using Norton theorem  1.25 A


## Ex1.70:pg-112¶

In [67]:
I1=5.0;                    #Assigning values to parameters
I2=2.0;
V1=6.0;
R1=2.0;
R2=4.0;
I1=5.0;
I2=(R1*I1-6)/R1;
I3=I2+2;
IN=I3;                #Calculation of Norton current
RN=R1;                #Calculation of Norton resistance
I1=(IN*RN)/(RN+R2);     #Calculation of load current using Norton theorem
print"Current in 4 Ohm resistor by Norton theorem",round(I1,2),"A"

Current in 4 Ohm resistor by Norton theorem 1.33 A


## Ex1.71:pg-114¶

In [64]:
I1=6.0;                             #Assigning values to parameters
V1=10.0;
V2=24.0;
R1=2.0;
R2=1.0;
R3=10.0;
R4=3.0;
R5=2.0;
R6=4.0;
A=[-13,10,1],[10,-15,3],[1,3,-4];   #Current coefficients using KVL equations
B=[-12],[10],[-24];
I=np.dot(inv(A),B);
IN=I[2][0];                      #Norton current
Rx=R2+R3+(R2*R3)/R4;           #Converting Star to Delta
Ry=R3+R4+(R3*R4)/R2;
Rz=R2+R4+(R2*R4)/R3;
Ra=(R1*Rx)/(R1+Rx);
Rb=(Ry*R5)/(Ry+R5);
Rc=Ra+Rb;
RN=(Rz*Rc)/(Rz+Rc);         #Norton resistance
I1=(IN*RN)/(RN+R6);
print"Current in 4 Ohm resistor using Nortonn Theorem",round(I1,2),"A"

Current in 4 Ohm resistor using Nortonn Theorem 4.1 A


## Ex1.72:pg-117¶

In [116]:
I1=6.0;                             #Assigning values to parameters
I2=2.0;
V=10.0;
V2=24.0;
R1=3.0;
R2=5.0;
R3=6.0;
R4=2.0;
R5=10.0;
R6=6.0;
R7=4.0;
R8=3.0;
A=[1,0,0],[0,-18,10],[0,10,-23];   #Current coefficients using KVL equations
B=[6],[-10],[12];
I=np.dot(inv(A),B)
IN=I[0][0]-I[1][0];                                  #Norton current
RN=((R5*(R6+R7+R8))/(R5+R6+R7+R8))+R3+R4;         #Norton resistance
I1=(IN*RN)/(RN+R2)
print"Current in 4 Ohm resistor using Nortonn Theorem",round(I1,2),"A"

Current in 4 Ohm resistor using Nortonn Theorem 4.14 A


## Ex1.73:pg-121¶

In [114]:
V=120.0;                     #Assigning values to parameters
R1=40.0;
R2=20.0;
R3=60.0;
Rth=((R1*R2)/(R1+R2))+R3; #Calculation of Thevenin Resistance
Rl=Rth;                  #For maximum power,load resistance should be equal to Thevenin resistance
I=V/(R1+R2);             #Calculation of Circuit Current
Vth=R2*I;                #Calculation of Thevenin Voltage
Pmax=(Vth*Vth)/(4*Rth);  #Calculation of Maximum Power
print"Maximum power by Maximum Power transfer theorem",round(Pmax,2),"Watts"

Maximum power by Maximum Power transfer theorem 5.45 Watts


## Ex1.74:pg-122¶

In [109]:
V=10.0;
I=6.0;
R1=5.0;
R2=2.0;
R3=3.0;
R4=4.0;
Rth=((R1*R2)/(R1+R2))+R3+R4;
A=[-1,1],[-5,-2];   #Current coefficients using KVL equations
B=[6],[-10];
I=np.dot(inv(A),B);
Vth=R2*I[1][0];
Pmax=(Vth*Vth)/(4*Rth)
print"Maximum Power",round(Pmax,2),"W"

Maximum Power 3.87 W


## Ex1.75:pg-124¶

In [106]:
V=30.0;                              #Assigning values to parameters
I1=25.0;
I2=10.0;
R1=5.0;
R2=10.0;
R3=2.0;
R4=10.0;
Rth=((R3*(R1+R2))/(R3+R1+R2))
Rth=round(Rth,2)
A=[-1,1,0],[-15,-12,10],[0,10,-10];   #Current coefficients using KVL equations
B=[10],[-125],[30];
I=np.dot(inv(A),B);
Vth=V+R3*I[1][0];
Vth=round(Vth,2)
Pmax=(Vth*Vth)/(4*Rth)
print"Maximum Power",round(Pmax,2),"W"

Maximum Power 491.45 W


## Ex1.76:pg-126¶

In [97]:
R1=2.0;                     #Assigning values to parameters
R2=4.0;
R3=1.0;
R4=5.0;
R5=8.0;
V=50.0;
Ra=(R1*R2)/(R1+R2+R4);   #Converting Delta to Star
Rb=(R1*R4)/(R1+R2+R4);
Rc=(R2*R4)/(R1+R2+R4);
Rm=R3+Ra;
Rn=Rb+R5;
Rth=Rc+((Rm*Rn)/(Rm+Rn)); #Calculating Thevenin resistance
Rl=Rth;
Rp=R2+R4;
Rq=R3+R5;
Rr=(Rp*Rq)/(Rp+Rq);
I=V/(R1+Rr);
I1=I*Rp/(Rp+Rq);
I2=I*Rq/(Rp+Rq);
Vth=R3*I2-R2*I1;        #Calculating Thevenin voltage
Pmax=(Vth*Vth)/(4*Rth); #Calculating Maximum Power
print"Maximum Power",round(Pmax,2),"Watts"

Maximum Power 10.19 Watts