# Chapter 2: D.C. Circuits¶

## Example 2.1, Page 32¶

In [1]:
#Variable declaration
E = 24.;           # E.m.f of battery,V
R1 = 330;         # Resistance, ohms
R2 = 1500;        # Resistance, ohms
R3 = 470;         # Resistance, ohms

#Calculations
# As resistances R1, R2 & R3 are joined end-to-end hence, they are in series & in series connection, circuit resistance is the sum of individual resistances present in the circuit
R = R1 + R2 + R3;    # Resistance of circuit, ohms
I = E/R;             # Circuit current, A
# As the resistances are in series so same current flows through each resistor & potential drop across each resistor is equal to the product of circuit current & its respective resistance( from Ohm's law, V = I*R )
V1 = I*R1;           # Potential difference developed across resistance R1, V
V2 = I*R2;            # Potential difference developed across resistance R2, V
V3 = I*R3;             # Potential difference developed across resistance R3, V
P = E*I;               # Electric power dissipated by the complete circuit, W

# Results
print "The circuit resistance = %4d ohms or %3.1f kilo-ohms"%(R, R*1e-03);
print "The circuit current = %5.2f milli-ampere"%(I/1e-03);
print "The potential drop across resisatnce R1 = %4.2f volts\nThe potential drop across resistance R2 = %5.2f volts\nThe potential drop across resistance R3 = %4.2f volts"%(V1, V2, V3);
print "The power dissipated by the complete circuit = %4.2f watt or %3d milli-watt"%(P,P/1e-03)

The circuit resistance = 2300 ohms or 2.3 kilo-ohms
The circuit current = 10.43 milli-ampere
The potential drop across resisatnce R1 = 3.44 volts
The potential drop across resistance R2 = 15.65 volts
The potential drop across resistance R3 = 4.90 volts
The power dissipated by the complete circuit = 0.25 watt or 250 milli-watt


## Example 2.2, Page 34¶

In [16]:
import math

#Variable declaration
E = 12.;                 # E.m.f of battery, V
R_BC = 16.;               # Resistance across branch BC, ohms
P_BC = 4;                # Electric power dissipated by resistance R_BC, W

#Calculations
# using relation P = I^2/R, solving for I
I = math.sqrt( P_BC/R_BC);     # Electric current,A
R = E/I;                   # Total circuit resistance, ohms
R_AB = R - R_BC;            # Resistance across branch AB, ohms

# Result
print "The circuit current = %3.1f A\nThe value of other resistor = %1d ohms"%(I, R_AB)

The circuit current = 0.5 A
The value of other resistor = 8 ohms


## Example 2.3, Page 37¶

In [3]:
#Variable declaration
E = 24.;             # E.m.f of battery, V
R_1 = 330.;          # Resistance, ohms
R_2 = 1500.;          #Resistance, ohms
R_3 = 470.;            #Resistance, ohms

#Calculations
# Since one end of each resistor is connected to positive terminal of battery and the other end to the negative terminal, therefore, the resistors are in parallel & in parallel connection the equivalent resistance of  the circuit is equal to the reciprocal of the sum of conductances of individual resistances present in the circuit i.e 1/R = 1/R_1 + 1/R_2 + 1/R_3, solving for R
R = (R_1*R_2*R_3)/( R_1*R_2 + R_2*R_3 + R_3*R_1);      # Equivalent resisance of circuit, ohms
# Since the resistances are in parallel so potetial difference across each resistor is same & in our case is equal to e.m.f of battery & from Ohm's law, V = I*R, solving for I
I_1 = E/R_1;          # Current through resistor R_1, A
I_2 = E/R_2;          # Current through resistor R_2, A
I_3 = E/R_3;          # Current through resistance R_3, A
# Current drawn from battery is equal to the sum of branch currents
I = I_1 + I_2 + I_3;              # Current drawn from battery, A

# Results
print "The total resistance of the circuit = %6.2f ohms"%(R);
print "The branch current I1 = %5.2f mA\nThe branch current I2 = %2d mA\nThe branch current I3 = %5.2f mA"%(I_1/1e-03, I_2/1e-03, I_3/1e-03);
print "The current drawn from the battery = %5.1f mA"%(I/1e-03)

The total resistance of the circuit = 171.68 ohms
The branch current I1 = 72.73 mA
The branch current I2 = 16 mA
The branch current I3 = 51.06 mA
The current drawn from the battery = 139.8 mA


## Example 2.4, Page 38¶

In [4]:
#Variable declaration
E = 12;                # E.m.f of battery, V
R1 = 6;                # Resistance, ohms
R2 = 3;                # Resistance, ohms

#Calculations
# Since the two resistances are in parallel, therefore effective resistance of the circuit is equal to the reciprocal
#of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit i.e 1/R = 1/R1 + 1/R2,
#simplifying for R
R = ( R1*R2)/(R1 + R2);          # Effective resistance of the circuit, ohms
# Fron Ohm's law, V = I*R, solving for I
I = E/R;                 # Circuit current, A
I1 = E/R1;               # Current through resistance R1, A
I2 = E/R2;               # Current thrugh resistance R2, A

# Results
print "Effective resistance of the circuit = %1d ohms"%R
print "The current drawn from the battery = %1d A"%I
print "The current through resistor R1 = %1d A"%I1
print "The current through R2 resistor = %1d A"%I2

Effective resistance of the circuit = 2 ohms
The current drawn from the battery = 6 A
The current through resistor R1 = 2 A
The current through R2 resistor = 4 A


## Example 2.5, Page 39¶

In [5]:
#Variable declaration
R1 = 10.;                  # Resistance, ohm
R2 = 20.;                  # Resistance, ohm
R3 = 30.;                  # Resistance, ohm

#Calculations
# Part (a)
# Since in series combination, the equivalent resistance of the circuit is the sum of the individual resistances
#present in the circuit i.e R = R1 + R2 + R3
R_s = R1 + R2 + R3;         # Equivalent series resistance of the circuit, ohms
# Part (b)
# Since in parallel combination, the equivalent resistance of the circuit is the reciprocal of the  sum of the
#conductances of the individual resistances present in the circuit i.e 1/R = 1/R1 + 1/R2 + 1/R3, solving for R;
R_p = ( R1*R2*R3 )/( R1*R2 + R2*R3 + R3*R1 );      # Equivalent parallel resistance of the circuit, ohms

# Results
print "Equivalent series resistance of the circuit = %2d ohm"%R_s
print "Equivalent parallel resistance of the circuit = %4.2f ohm"%R_p

Equivalent series resistance of the circuit = 60 ohm
Equivalent parallel resistance of the circuit = 5.45 ohm


## Example 2.6, Page 44¶

In [6]:
#Variable declaration
E = 64.;                    # E.m.f of battery, V
R1 = 6.;                   # Resistance, ohm
R2 = 4.;                   # Resistance, ohm

#Calculations
# Part (a)
# Since R1 & R2 are  parallel to one another hence, their equivalent resistance is equal to the sum of reciprocal of
#their individual resistances
R_BC = ( R1*R2)/( R1 + R2 );           # Equivalent resistance across branch BC, ohm
R_AB = 5.6;                           # Resistance across branch AB, ohm
# Since R_AB & R_BC are in series, therefore, their equivalent resistance is equal to the sum of their individual
#resistances
R_AC = R_AB + R_BC;                     # Total circuit resistance, ohm
# From Ohm's law, V = I*R, solving for I
I = E/R_AC;                               # Total circuit current, A
# Part (b)
V_BC = I*R_BC;                           # Potential difference across branch BC, V
I1 = V_BC/R1;                             # Electric current through resistor R1, A
# Part (c)
# Since P = I^2*R
P_AB = I**2*R_AB;                          # Power dissipated by 5.6 ohm resistance, W

# Results
print "The current drawn from the supply = %1d A "%I;
print "The current through %1d ohm resistor = %3.1f A"%(R1, I1);
print "The power dissipated by %3.1f ohm resistor = %5.1f W"%(R_AB, P_AB);

The current drawn from the supply = 8 A
The current through 6 ohm resistor = 3.2 A
The power dissipated by 5.6 ohm resistor = 358.4 W


## Example 2.7, Page 46¶

In [7]:
#Variable declaration
E = 18.;                  # E.m.f of battery, V
R1 = 4.;                 # Resistance, ohm
R2 = 6.;                 # Resistance, ohm
R3 = 5.;                 # Resistance, ohm
R4 = 3.;                 # Resistance, ohm
R5 = 6.;                 # Resistance, ohm
R6 = 8.;                 # Resistance, ohm

#Calculations
# Part (a)
# Since resistance R1 & R2 are in parallel, therefore, equivalent resistance across branch AB will be equal to the
#reciprocal of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit
#i.e 1/R_AB = 1/R1 + 1/R2, simplifying for R_AB
R_AB = ( R1*R2 )/( R1 + R2);            # Resistance, ohm
R_BC = R3;                              # Resistance across branch BC, ohm
# Since resistance R4, R5 & R6 are in parallel, therefore, equivalent resistance across branch CD will be equal to
#the reciprocal of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit
#i.e 1/R_CD = 1/R4 + 1/R5 + 1/R6, simplifying for R _CD
R_CD = ( R4*R5*R6 )/( R4*R5 + R5*R6 + R6*R4 );      # Resistance, ohm
# Since R_AB, R_BC & R_CD forms series combination, therefore circuit resistance will be their series sum
R = R_AB + R_BC + R_CD;                  # Circuit resistance, ohm
I = E/R;                 # Supply current, A
# Part (b)
# AS resistances R1 & R2 are parallel, therefore tere will be same potential difference across them, denoted by V_AB
V_AB = I*R_AB;                           # Potential difference, V
# AS resistances R4, R5 & R6 are parallel, therefore tere will be same potential difference across them, denoted by V_CD
V_CD = I*R_CD;                  # Potential difference, V
V_BC = I*R_BC;                  # Potential difference, V
# Part (c)
I1 = V_AB/R1;                   # Current through R1 resistor, A
I2 = V_AB/R2;                   # Current through R2 resistor, A
I4 = V_CD/R4;                  # Current through R4 resistor, A
I5 = V_CD/R5;                  # Current through R5 resistor, A
I6 = V_CD/R6;                  # Current through R6 resistor, A
# Part (d)
P3= I**2*R3;                     # Power dissipated, W

# Results
print "The current drawn from the source = %1d A"%I
print "The p.d. across resistor %1d ohm & %1d ohm = %3.1f V"%(R1, R2, V_AB);
print "The p.d. across resistor %1d ohm, %1d ohm & %1d ohm = %3.1f V"%(R4, R5, R6, V_CD);
print "The p.d. across resistor %1d ohm = %2d V"%(R3, V_BC);
print "The current through resistor %1d ohm = %3.1f A"%(R1, I1);
print "The current through resistor %1d ohm = %3.1f A"%(R2, I2);
print "The current through resistor %1d ohm = %1d A"%(R3, I);
print "The current through resistor %1d ohm = %5.3f A"%(R4, I4);
print "The current through resistor %1d ohm = %5.3f A"%(R5,I5);
print "The current through resistor %1d ohm = %3.1f A"%(R6, I6);
print "The power dissipated by the %1d ohm resistor = %2d W"%(R3, P3);

The current drawn from the source = 2 A
The p.d. across resistor 4 ohm & 6 ohm = 4.8 V
The p.d. across resistor 3 ohm, 6 ohm & 8 ohm = 3.2 V
The p.d. across resistor 5 ohm = 10 V
The current through resistor 4 ohm = 1.2 A
The current through resistor 6 ohm = 0.8 A
The current through resistor 5 ohm = 2 A
The current through resistor 3 ohm = 1.067 A
The current through resistor 6 ohm = 0.533 A
The current through resistor 8 ohm = 0.4 A
The power dissipated by the 5 ohm resistor = 20 W


## Example 2.8, Page 49¶

In [8]:
#Variable declaration&Calculations
# Applying Kirchhoff's current law (the sum of the currents arriving at a junction is equal to the sum of the
#currents leaving that junction) at junction A
I2 = 40 + 10;                  # Electric current, A
# Applying Kirchhoff's current law at junction C
I1 = 80 - I2;                  # Electric current, A
# Applying Kirchhoff's current law at junction D
I3 = 80 + 30;                  # Electric current, A
# Applying Kirchhoff's current law at junction E
I4 = I3 - 25;                   # Electric current, A
# Applying Kirchhoff's current law at junction F
I5 = 30 - 85;                   # Electric current, A

# Result
print "Current I1 = %2d A\nCurrent I2 = %2d A\nCurrent I3 = %3d A\nCurrent I4 = %2d A\nCurrent I5 = %2d A,"%(I1, I2, I3, I4, I5);

Current I1 = 30 A
Current I2 = 50 A
Current I3 = 110 A
Current I4 = 85 A
Current I5 = -55 A,


## Example 2.9, Page 52¶

In [9]:
import numpy as np
from numpy import linalg
from numpy.linalg import inv

#Variable declaration
R1 = 3;                # Resistance, ohms
R2 = 2;                # Resistance, ohms
R3 = 10;               # Resistance, ohms
E1 = 10;               # E.m.f, V
E2 = 4;                 # E.m.f, V

#Calculations
# Applying Kirchhoff's Current Law(the sum of the currents arriving at a junction is equal to the sum of the
#currents leaving that junction)
A = np.array([[3.,-2.],[13.,10.]])
B = np.array([6.,10.])
I1,I2 = np.linalg.solve(A,B)
I3 = ( I1 + I2 );                # Electric current through branch CD, A
V_CD = R3*I3;                    # P.d.across R3 resistor, V

# Results
print "The current through branch FA = %6.3f A"%I1
print "The current through branch EB = %5.3f A"%I2
print "The current through branch CD = %5.3f A"%I3
print "p.d.across %2d resistor = %4.2f V"%(R3,V_CD)

The current through branch FA =  1.429 A
The current through branch EB = -0.857 A
The current through branch CD = 0.571 A
p.d.across 10 resistor = 5.71 V


## Example 2.10, Page 53¶

In [10]:
import numpy as np
from numpy import linalg

#Variable declaration
E1 = 6;                     # E.m.f of battery, V
E2 = 4.5;                  # E.m.f of battery, V
R1 = 1.5;                 # Resistance, ohm
R2 = 2;                  # Resistance, ohm
R3 = 5;                 # Resistance, ohm

#Calculations
# Part (a)
# Using matrix method for solving set of equations
A = np.array([[6.5, 5], [5, 7]])
B = np.array([6, 4.5]);
#X = inv(A)*B;
I1,I2 = np.linalg.solve(A,B)          # Electric current through branch FA & DC, A
I3 = ( I1 + I2);         # Electric current through branch BE, A
# Part (b)
V_BE = I3*R3;            # P.d across resistor R3, V

# Results
print "Electric current through branch FA = %5.3f A"%I1
print "Electric current through branch DC = %6.4f A"%I2
print "Electric current through branch BE = %5.3f A"%I3
print "p.d across resistor %1d ohms = %5.3f V"%(R3, V_BE);

Electric current through branch FA = 0.951 A
Electric current through branch DC = -0.0366 A
Electric current through branch BE = 0.915 A
p.d across resistor 5 ohms = 4.573 V


## Example 2.11, Page 57¶

In [11]:
import numpy as np
from numpy import linalg

#Variable declaration
R_AB = 6;                   # Resistance, ohm
R_BC = 4;                   # Resistance, ohm
R_DC = 1;                   # Resistance, ohm
R_AD = 3;                   # Resistance, ohm
R_BD = 5;                   # Resistance, ohm

#Calculations
# Using matrix method for solving the set of equations
A = np.array([[6, -3, 5], [-4, 1, 10], [0, 4, 1]]);
B = ([0, 0, 10]);
#X = inv(A)*B;
I1,I2,I3 = np.linalg.solve(A,B);  # Electric current, A
I_BC = I1 - I3;                 # Electric current, A
I_DC = I2 + I3;                # Electric current, A
I = I1 + I2;                  # Supply current, A

# Results
print "The current through %1d ohm resistor = %5.3f A"%(R_AB, I1)
print "The current through %1d ohm resistor = %4.2f A"%(R_BC, I_BC);
print "The current through %1d ohm resistor = %5.3f A"%(R_DC, I_DC);
print "The current through %1d ohm resistor = %5.3f A"%(R_AD, I2);
print "The current through %1d ohm resistor = %5.3f A"%(R_BD, I3);
print "The supply current = %5.3f A"%I

The current through 6 ohm resistor = 1.074 A
The current through 4 ohm resistor = 0.89 A
The current through 1 ohm resistor = 2.638 A
The current through 3 ohm resistor = 2.454 A
The current through 5 ohm resistor = 0.184 A
The supply current = 3.528 A


## Example 2.12, Page 58¶

In [12]:
#Variable declaration
R_AB = 6;               # Resistance across branch AB, ohm
R_BC = 4;               # Resistance across branch BC, ohm
R_DC = 2;               # Resistance across branch DC, ohm

#Calculations
# Since R_AB/R_AD = R_BC/R_DC, so the wheatstone bridge is balanced hence no current flows through branch BD
I3 = 0;

# Result
print "The current through branch BD i.e I3 = %1d A"%I3

The current through branch BD i.e I3 = 0 A


## Example 1.13, Page 62¶

In [13]:
import numpy as np
from numpy import linalg

#Variable declaration
R1 = 20;                    # Resistance, ohm
R2 = 10;                    # Resistance, ohm
R3 = 8;                    # Resistance, ohm
R4 = 5;                    # Resistance, ohm
R5 = 2;                    # Resistance, ohm

#Calculations
A = np.array([[20, -10, 8], [-5, 2, 15], [0, 12, 2]]);
B = np.array([0, 0, 10]);
I1,I2,I3 = np.linalg.solve(A,B)    # Electric current through BD, A
V_BD = I3*R3;              # P.d across branch BD, V
# For balance conditions i.e I3 = 0, R1/R2 = R4/R5, solving for R4
R_4 = ( R1*R5 )/R2;          # Resistance, ohm

# Results
print "The p.d between terminals B and D = %5.3f V"%V_BD
print "The value to which %1d ohm resistor must be adjusted in order to reduce the current through %1d ohm resistor to zero = %1d ohm"%(R4, R3, R_4);

The p.d between terminals B and D = 0.195 V
The value to which 5 ohm resistor must be adjusted in order to reduce the current through 8 ohm resistor to zero = 4 ohm


## Example 2.14, Page 64¶

In [14]:
#Variable declaration
# For part (a)
Rm = 1000.;                # Resistance, ohm
Rd = 1;                   # Resistance, ohm
Rv = 3502.;                # Resistance, ohm
# Using Wheatstone bridge balanced condition i.e Rx/Rv = Rm/Rd , solving for Rx
Rx = ( Rm/Rd) * Rv;          # Resistance,ohm
print "The value of the resistance being measured = %5.3f mega-ohm"%(Rx*1e-06);

# Part (b)
Rm = 1.;                # Resistance, ohm
Rd = 1000;                   # Resistance, ohm
Rv = 296;                # Resistance, ohm
# Using Wheatstone bridge balanced condition i.e Rx/Rv = Rm/Rd , solving for Rx
Rx = ( Rm/Rd )*Rv;          # Resistance,ohm
print "The value of the resistance being measured = %5.3f ohm"%Rx

The value of the resistance being measured = 3.502 mega-ohm
The value of the resistance being measured = 0.296 ohm


## Example 2.15, Page 67¶

In [15]:
#Variable declaration
l1 = 600e-03;             # Scale reading, metre
l2 = 745e-03;            # Scale reading, metre
l_s = 509.3e-03;           # Total scale length, metre
E_s = 1.0186;               # Source voltage, V

#Calculations
E1 = ( l1/l_s )*E_s;         # Voltage drop across length l1, V
E2 = ( l2/l_s)*E_s;          # Voltage drop across length l2, V

# Results
print "The emf of the first cell = %3.1f V "%E1
print "The emf of the second cell = %3.2f V "%E2

The emf of the first cell = 1.2 V
The emf of the second cell = 1.49 V