In [1]:

```
#pg 48
#calculate the current
# Given data
R1 = 6.;# in ohm
R2 = 6.;# in ohm
R3 = 6.;# in ohm
V = 24.;# in V
#calculations
R_T =R1+R1*R2/(R1+R2);# in ohm
I_T = V/R_T;# in A
I1 = (R1/(R1+R2))*I_T;# in A
V = 12;# in V
I_T = V/R_T;# in A
I2 = (R1/(R1+R2))*I_T;# in A
I = I1+I2;# in A
#results
print "The current in A is",I
```

In [2]:

```
#pg 51
#calculate the current
# Given data
R1 = 5.;# in ohm
Vth= 10.;# in ohm
R2 = 7.;# in ohm
R3=10.;# in ohm
R_L = 12.;# in ohm
V = 20.;# in ohm
#calculations
Vth = (Vth*V)/(R1+R3);# in V
Rth = R2 + ((Vth*R1)/(Vth+R1));# in ohm
# The current through 12 ohm resistor
I = Vth/(Rth+R_L);# in A
#results
print "The current through 12 ohm resistor in A is",round(I,2)
```

In [3]:

```
#pg 54
#calculate the current
# Given data
R1 = 6.;# in ohm
R2 = 7.;# in ohm
R3 = 4.;# in ohm
R_L = 12.;# in ohm
V = 30.;# in V
#calculations
Vth = (R3*V)/(R3+R1);# in V
Rth = R2 + ((R3*R1)/(R3+R1)) ;# in ohm
I_N = Vth/Rth;# in A
#The current through 12 ohm resistor
I = (I_N*Rth)/(Rth+R_L);# in ohm
#results
print "The current through 12 ohm resistor in A is",round(I,3)
```

In [4]:

```
#pg 57
#calculate the resistance and max power
# Given data
R1 = 5.;# in ohm
R2 = 10.;# in ohm
R3 = 7.;# in ohm
V = 20.;# in V
#calculations
Vth = R2*V/(R1+R2);# in V
Rth = R3 + ((R2*R1)/(R2+R1));# in ohm
R_L = Rth;# in ohm
Pmax = (Vth**2)/(4*R_L);# in W
#results
print "The value of load resistance in ohm is",round(R_L,2)
print "The magnitude of maximum power in W is",round(Pmax,1)
```

In [5]:

```
#pg 59
#calculate the current
# Given data
V1 = 12.;# in V
V2 = 10.;# in V
R1 = 6.;# in ohm
R2 = 7.;# in ohm
R3 = 4.;# in ohm
#calculations
R_T = R1 + ( (R2*R3)/(R2+R3) );# in ohm
I_T = V1/R_T;# in A
I1 = (R2/(R2+R3))*I_T;# in A
R_T = R2 + ( (R1*R3)/(R1+R3) );# in ohm
I_T = V2/R_T;# in A
I2 = (R1*I_T)/(R1+R3);# in A
# current across 4 ohm resistor
I = I1+I2;# in A
#results
print "The current across 4 ohm resistor in A is",round(I,2)
```

In [6]:

```
#pg 60
#calculate the current
# Given data
R1 = 2.;# in ohm
R2 = 3.;# in ohm
R3 = 1.;# in ohm
R4= 2.;# in ohm
V1 = 4.2;# in V
V2 = 3.5;# in V
#calculations
R_T =R1+R3+R2*R4/(R2+R4);# in ohm
I_T = V1/R_T;# in A
I1 = (R1/(R1+R2))*I_T;# in A
R = R1+R3;# in ohm
R_desh = (R*R2)/(R+R2);# in ohm
R_T = R_desh+R1;# in ohm
I_T = V2/R_T;# in A
I2 = (R2/(R2+R))*I_T;# in A
# current in the branch AB
I = I2-I1;# in A
#results
print "The current in the branch AB of the circuit in A is",I
```

In [7]:

```
#pg 62
#calculate the current
# Given data
R1 = 2.;# in ohm
R2 = 4.;# in ohm
R3 = 8.;# in ohm
Ig = 2.;# in A
V = 20.;# in V
#calculations
R_T = R1+R3;# in ohm
I1 = V/R_T;# in A
I2 = (R1/(R1+R3))*Ig;# in A
# current through in 8 ohm resistor
I = I1-I2;# in A
#results
print "The current through in 8 ohm resistor in A is",I
```

In [8]:

```
#pg 63
#calculate the current
# Given data
R1 = 4.;# in ohm
R2 = 24.;# in ohm
R_L = 16.;# in ohm
V1 = 20.;# in V
V2 = 30.;# in V
#calculations
# V1-R1*I-R2*I-V2 = 0;
I= (V1-V2)/(R1+R2)
# V1-R1*I-Vth = 0;
Vth = V1-R1*I;# in V
Rth = (R1*R2)/(R1+R2);# in ohm
# current through 16 ohm resistor
I_L = Vth/(Rth+R_L);# in A
#results
print "The current through 16 ohm resistor in A is",round(I_L,4)
```

In [9]:

```
#pg 64
#calculate the current
# Given data
R1 = 6.;# in ohm
R2 = 4.;# in ohm
R3 = 3.;# in ohm
R_L = 6.;# in ohm
V1 = 6.;# in V
V2 = 15.;# in V
#calculations
# V1 - R1*I - R3*I -V2 = 0
I= (V1-V2)/(R1+R3);
# Vth - R3*I -V2 = 0;
Vth =V2+R3*I;# in V
Rth = ((R1*R3)/(R1+R3)) + R2;# in ohm
# current through 6 ohm resistance
I_L = Vth/(Rth+R_L);# in A
#results
print "The current through 6 ohm resistance in A is",I_L
```

In [10]:

```
#pg 65
#calculate the current
# Given data
R1 = 8.;# in ohm
R2 = 5.;# in ohm
R3 = 2.;# in ohm
R_L = 10.;# in ohm
V1= 20.;# in V
V2= 12.;# in V
#calculations
# V1-R3*I - R2*I = 0;
I = V1/(R2+R3);# in A
# Vth + V2 - R3*I = 0;
Vth = R3*I - V2;# in V
Rth = ((R2*R3)/(R2+R3)) + R1;# in ohm
# current through 10 ohm resistance
I_L = abs(Vth)/(Rth+R_L);# in A
#results
print "The current through 10 ohm resistance in A is",round(I_L,4)
```

In [11]:

```
#pg 66
#calculate the current
# Given data
R1 = 4.;# in ohm
R2 = 3.;# in ohm
R3 = 2.;# in ohm
R_L = 5.;# in ohm
I = 6.;# in A
V = 15.;# in V
#calculations
# V-R1*I1-R3*(I1+I) = 0;
I1 = (V-R3*I)/(R1+R3);# in A
I = I1 + I;# in A
Vth = R3*I;# in V
Rth = ((R1*R3)/(R1+R3)) + R2;# in ohm
# current in 5 ohm resistance
I_L = Vth/(Rth+R_L);# in A
#results
print "The current in 5 ohm resistance in A is",round(I_L,1)
```

In [12]:

```
#pg 68
#calculate the value of voltage and resistance
# Given data
R1 = 8.;# in ohm
R2 = 32.;# in ohm
V = 60.;# in V
I1= 5.;# in A
I2= 3.;# in A
#calculations
# Vth-R1*I1-(I1+I2)*R2-V=0
Vth= R1*I1+(I1+I2)*R2+V
Rth = R1+R2;# in ohm
#results
print "The value of Vth in volts is : ",Vth
print "The value of Rth in ohm is : ",Rth
```

In [13]:

```
#pg 69
#calculate the current
# Given data
R1 = 6.;# in ohm
R2 = 4.;# in ohm
R3 = 3.;# in ohm
R_L = 6.;# in ohm
V1 = 6.;# in V
V2= 15.;# in V
#calculations
# V1 - R1*I - R3*I -V2 = 0;
I= (V1-V2)/(R1+R3)
Vth = V2 + (R3*I);# in V
Rth = ((R1*R3)/(R1+R3)) + R2;# in ohm
I_N = Vth/Rth;# in A
# current through 6 ohm resistor
I = (I_N*Rth)/(Rth+R_L);# in A
#results
print "The current through 6 ohm resistor in A is",I
```

In [14]:

```
#pg 70
#calculate the current
# Given data
R1 = 5.;# in ohm
R2 = 2.;# in ohm
R3 = 8.;# in ohm
V1 = 20.;# in V
V2 = 12.;# in V
#calculations
# V1-R2*I-R1*I = 0;
I = V1/(R1+R2);# in A
# Vth + V2 - R2*I = 0;
Vth = (R2*I) - V2;# in V
Rth = ((R1*R2)/(R1+R2)) + R3;# in ohm
I_N = Vth/Rth;# in A
R_L = 10;# in ohm
# current through 10 ohm resistace
I = (abs(I_N)*Rth)/(Rth+R_L);# in A
#results
print "The current through 10 ohm resistace in A is",round(I,4)
```

In [15]:

```
#pg 71
#calculate the current
# Given data
V = 15.;# in V
R1 = 4.;# in ohm
R2 = 3.;# in ohm
R3 = 2.;# in ohm
R_L = 5.;# in ohm
Ig = 6.;# in A
#calculations
# V - R1*I1 - R3*(I1+Ig) = 0;
I1 = (V-R3*Ig)/(R1+R3);# in A
I = I1 + Ig;# in A
Vth = R3*I;# in V
Rth = ((R1*R3)/(R1+R3)) + R2;# in ohm
I_N = Vth/Rth;# in A
# current through 5 ohm resistor
I = (I_N*Rth)/(Rth+R_L);# in A
#results
print "The current through 5 ohm resistor in A is",round(I,3)
```

In [16]:

```
#pg 72
#calculate the resistance
# Given data
V = 6.;# in V
R1 = 2.;# in ohm
R2 = 1.;# in ohm
R3 = 3.;#in ohm
R4 = 2.;# in ohm
#calculations
Rth=(R1*R2/(R1+R2)+R3)*R4/((R1*R2/(R1+R2)+R3)+R4)
R_L = Rth;# in ohm
#results
print "The value of R in ohm is",round(R_L,2)
```

In [17]:

```
#pg 73
#calculate the power and load resistance
# Given data
R1 = 10.;# in ohm
R2 = 10.;# in ohm
R3 = 4.;# in ohm
V = 20.;# in V
#calculations
# V - R1*I1 - R2*I1 = 0;
I1 = V/(R1+R2);# in A
Vth = R1*I1;# in V
Rth =R1*R2/(R1+R2)+R3
R_L = Rth;# in ohm
Pmax = (Vth**2)/(4*Rth);# in W
#results
print "The value of load resistance in ohm is",R_L
print "The power delivered to the load in W is",round(Pmax,3)
```

In [18]:

```
#pg 74
#calculate the current
# Given data
R1 = 3.;# in ohm
R2 = 9.;# in ohm
R3 = 6.;# in ohm
V1 = 120.;# in V
V2 = 60.;# in V
#calculations
R = (R3*R2)/(R3+R2);# in ohm
R_T = R+R1;# in ohm
I_T = V1/R_T;# in A
I1 = (R2/(R2+R3)) * I_T;# in A
R_T = 2 + R2;# in ohm
I_T = V2/R_T;# in A
I2 = (R1/(R1+R3)) * I_T;# in A
# current through 6 ohm resistor
I = I1-I2;# in A
#results
print "The current through 6 ohm resistor in A is",round(I,2)
```

In [19]:

```
#pg 75
#calculate the current
# Given data
R1 = 36.;# in ohm
R2 = 12.;# in ohm
R3 = 8.;# in ohm
V1 = 90.;# in V
V2 = 60.;# in V
#calculations
R_T = (R2*R3)/(R2+R3)+R1;# in ohm
I_T = V1/R_T;# in A
I1 = (R2/(R2+R3)) * I_T;# in A
R = (R1*R3)/(R1+R3);# in ohm
R_T = R2+R;# in ohm
I_T = V2/R_T;# in A
I2 = (R1/(R1+R3))*I_T;# in A
Ra = (R1*R2)/(R1+R2);# in ohm asumed
I_T = 2;# in A
I3 = (Ra/(Ra+R3))*I_T;# in A
# current in 8 ohm resistor
I = I1+I2+I3;# in A
#results
print "The current in 8 ohm resistor in A is",round(I,2)
```

In [20]:

```
#pg 77
#calculate the thevenins voltage
# Given data
R1 = 5.;# in ohm
R2 = 10.;# in ohm
R3 = 5.;# in ohm
V1 = 60.;# in v
V2 = 30.;# in V
#calculations
#-R1*i1 - R3*i1 - V2+V1 = 0;
i1 = (V2-V1)/(R1+R3);# in A
V_acrossR3 = R3*i1;# in V
Vth = V_acrossR3+V1;# in V
V_AB =Vth;# in V
R = (R1*R3)/(R1+R3);# in ohm
Rth = R2+R;# in ohm
#results
print "The Thevenins voltage in V is",V_AB
print "The Thevenins resistance in ohm is",Rth
```

In [21]:

```
#pg 78
#calculate the current
# Given data
R1 = 4.;# in ohm
R2 = 3.;# in ohm
R3 = 2.;# in ohm
R_L = 5.;# in ohm
V = 15.;# in V
I2 = 6.;# in A
#calculations
# -R1*I1 - R3*I1 + R3*I2 + V = 0;
I1 = (V+R3*I2)/(R1+R3);# in A
Vth = I2/R3;# in V
V_CD = Vth;# in V
Rth = (R1*R3)/(R1+R3)+R2;# in ohm
I = Vth/(Rth+R_L);# in A
#results
print "The current flowing through 5 ohm resistor in A is",round(I,3)
```

In [23]:

```
#pg 80
#calculate the resistance and current
# Given data
R1 = 20.;# in ohm
R2 = 5.;# in ohm
R3 = 3.;# in ohm
R4 = 2.;# in ohm
V = 30.;# in V
I1=4.;# in A
#calculations
V1= I1*R3;# in V
# R1*I -R2*I+V = 0;
I = V/(R1+R2);# in A
V_acrossR2= R2*I;# in V
V_AB = V_acrossR2-V1;# in V
Vth = abs(V_AB);# in V
Rth = (R1*R2)/(R1+R2)+R3+R4;# in ohm
I_N = Vth/Rth;# in A
#results
print "The value of Rth in ohm is",Rth
print "The value of I_N in A is",round(I_N,3)
```

In [24]:

```
#pg 81
#calculate the resistance and voltage
# Given data
R1 = 2.;# in ohm
R2 = 4.;# in ohm
R3 = 6.;# in ohm
R4 = 4.;# in ohm
V = 16.;# in v
I1= 8.;# in A
I2= 16;# in A
#calculations
V1= I1*R2;# in V
V2= I2*R3;# in V
# Applying KVL : R2*I+V1+R3*I-V2+V+R1*I
I= (V2-V1-V)/(R1+R2+R3);# in A
Vth= V2-R3*I;# in V
Rth= (R1+R2)*R3/((R1+R2)+R3)+R4;# in ohm
#results
print "The value of Vth in volts is : ",Vth
print "The value of Rth in ohm is : ",Rth
```

In [25]:

```
#pg 82
#calculate the load resistance
# Given data
R1 = 3.;# in ohm
R2 = 2.;# in ohm
R3 = 1.;# in ohm
R4 = 8.;# in ohm
R5 = 2.;# in ohm
V = 10.;# in V
#calculations
R = ((R1+R2)*R5)/((R1+R2)+R5);# in ohm
Rth = R + R3;# in ohm
R_L = Rth;# in ohm
#results
print "The value of load resistance in ohm is",round(R_L,2)
```

In [26]:

```
#pg 84
#calculate the resistance and max power
# Given data
V = 250.;# in V
R1 = 10.;# in ohm
R2 = 10.;# in ohm
R3 = 10.;# in ohm
R4 = 10.;# in ohm
I2 = 20.;# in A.
#calculations
#Applying KVL in GEFHG : -R1*I1-R2*I1-R2*I2 + V = 0;
I1= (V-R2*I2)/(R1+R2);# in A
V_AB= R3*I2+V-R1*I1;# in V
Vth = V_AB;# in V
Rth = (R1*R2)/(R1+R2)+R3+R4;# in ohm
R_L = Rth;# in ohm
Pmax = (Vth**2)/(4*R_L);#maximum power in W
#results
print "The value of R_L in ohm is",R_L
print "The value of maximum power in W is",Pmax
```

In [27]:

```
#pg 85
#calculate the current
# Given data
R1 = 2.;# in ohm
R2 = 4.;# in ohm
R_L = 4.;# in ohm
V1 = 6.;# in v
V2 = 12.;# in V
#calculations
# -R2*Ix -R1*Ix-V1+V2= 0;
Ix = (V2-V1)/(R1+R2);# in A
Vth = V1+R1*Ix;# in V
Rth = (R1*R2)/(R1+R2);# in ohm
I_N = Vth/Rth;# in A
I = (I_N*Rth)/(Rth+R_L);# in A
#results
print "The current in A is",I
print 'Note: At last, there is calculation error to find the value of I, so the answer in the book is wrong.'
```

In [28]:

```
#pg 86
#calculate the current
# Given data
import numpy
R1 = 3.;# in ohm
R2 = 6.;# in ohm
R_L = 4.;# in ohm
V = 27.;# in V
I=3.;# in A
#calculations
# -I1+I2= I (i)
# Applying KVL: I1*R1+I2*R2=V (ii)
A= ([[-1, R1], [1, R2]]);
B= ([I, V])
I= numpy.dot(B,numpy.linalg.inv(A));# Solving eq(i) and (2) by Matrix method
I1= I[0];# in A
I2= I[1];# in A
Vth= R2*I2;# in V
Rth= R1*R2/(R1+R2);# in ohm
# current in 4 ohm resistor
I= Vth/(Rth+R_L);# in A
#results
print "The current in 4 ohm resistor in A is : ",I
```

In [29]:

```
#pg 88
#calculate the current
# Given data
R1 = 20.;# in ohm
R2 = 12.;# in ohm
R3 = 8.;# in ohm
V1 = 90.;# in V
V2 = 60.;# in V
#calculations
R_T = R1 + ((R2*R3)/(R2+R3));# in ohm
I_T = V1/R_T;# in A
I1 = I_T;# in A
R_T = R2 + ((R1*R3)/(R1+R3));# in ohm
I_T = V2/R_T;# in A
I2 = (R3/(R3+R1))*I_T;# in A
R_T = R1 + ((R2*R3)/(R2+R3));# in ohm
I_T = 2;# in A (given)
R = (R2*R3)/(R2+R3);# in ohm
I3 = (R/(R1+R))*I_T;# in A
# current in 20 ohm resistor
I20 = I1-I2-I3;# in A
#results
print "The current in 20 ohm resistor in A is",round(I20,3)
```

In [30]:

```
#pg 89
#calculate the current
# Given data
R1 = 10.;# in ohm
R2 = 20.;# in ohm
R3 = 60.;# in ohm
R4 = 30.;# in ohm
E1 = 120.;# in V
E2 = 60.;# in V
#calculations
R_T = ((R2*R3)/(R2+R3)) + R4+R1;# in ohm
I_T = E1/R_T;# in A
I1 = (R3/(R2+R3))*I_T;# in A
R_T = ( ((R1+R4)*R2)/((R1+R4)+R2) ) + R3;# in ohm
I_T = E2/R_T;# in A
I2 = ((R1+R4)/(R1+R4+R2))*I_T;# in A
# current through R2 resistor
I= I1+I2;# in A
#results
print "The current through R2 resistor in A is",round(I,4)
```

In [31]:

```
#pg 91
#calculate the current in all cases
# Given data
R1 = 4.;# in ohm
R2 = 4.;# in ohm
R3 = 8.;# in ohm
Ig = 3.;# in A
V = 15.;# in V
I3 = 0.;# in A
#calculations
I1 = R1/(R1+R2)*Ig;# in A
I2 = -I1;# in A
R_T = ((R1+R2)*R3)/((R1+R2)+R3);# in ohm
I_T = V/R_T;# in A
I_2= R3/(R1+R2+R3)*I_T;# in A
I_1 = I_2;# in A
# Total current through upper 4 ohm resistor
tot_cur_up_4ohm= I1+I2;# in A
# Total current through lower 4 ohm resistor
tot_cur_low_4ohm= I_1+I_2;# in A
# Total current through 8 ohm resistor
tot_cur_8ohm= I3+I_T;# in A
#results
print "Total current through upper 4 ohm resistor in A is : ",tot_cur_up_4ohm
print "Total current through lower 4 ohm resistor in A is : ",tot_cur_low_4ohm
print "Total current through 8 ohm resistor in A is : ",tot_cur_8ohm
```

In [32]:

```
#pg 92
#calculate the total current in all cases
# Given data
R1 = 5.;# in ohm
R2 = 5.;# in ohm
R3 = 10.;# in ohm
V = 10.;# in V
Ig = 2.;# in A
#calculations
I2 = (R1/R3)*Ig;# in A
I1 = I2;# in A
I3 = 0;# in A
R_T = ((R1+R2)*R3)/((R1+R2)+R3);# in ohm
I_T = V/R_T;# in A
I_2 = (R3/((R1+R2)+R3))*I_T;# in A
I_1 = I_2;# in A
I_3 = I_1;# in A
# Total current through upper in 5 ohm resistor
tot_cur_up_5ohm = I1-I2;# in A
# Total current through lower in 5 ohm resistor
tot_cur_low_5ohm = I_1+I_2;# in A
# Total current through 10 ohm resistor
tot_cur_10ohm = I3+I_3;# in A
#results
print "The total current through upper in 5 ohm resistor in A is",tot_cur_up_5ohm
print "The total current through lower in 5 ohm resistor in A is",tot_cur_low_5ohm
print "The total current through in 10 ohm resistor in A is",tot_cur_10ohm
```