In [1]:

```
from __future__ import division
#Given data
Rh = 1000 # in ohm
Rm = 50 # in ohm
V = 3 # in V
Ifsd = 1 # in mA
Ifsd = Ifsd * 10**-3 # in A
R1 = Rh - ( (Ifsd*Rm*Rh)/V ) # in ohm
print "The value of R1 = %0.2f Ω " %R1
R2 = (Ifsd*Rm*Rh)/(V-(Ifsd*Rh)) # in ohm
print "The value of R2 = %0.f Ω " %R2
# Due to 5 % drop in battery voltage, the voltage becomes
V = V - (0.05*V) # in V
R2 = (Ifsd*Rm*Rh)/(V-(Ifsd*Rh)) # in ohm
print "Maximum value of R2 = %0.3f Ω " %R2
```

In [2]:

```
#Given data
R1 = 10 #resistance in k ohm
R2 = 2 #resistance in k ohm
R3 = 5 #resistance in k ohm
Rx = (R1/R2)*R3 #value of unknown resistance in k ohm
print "The value of unknown resistance = %0.F kΩ " %Rx
```

In [3]:

```
#Given data
# Values of resistances of the circuit
R1 = 7 # in k ohm
R2 = 2 # in k ohm
R3 = 4 # in k ohm
R4 = 20 # in k ohm
Rg = 300 # in ohm
E = 8 # in V
#Use Thevenin's equivalent for Ig, V_TH=V_BD=V_AD-V_AB=( ((E/(R3+R4))*R4) - ((E/(R1+R2))*R1) )
V_TH = ( ((E/(R3+R4))*R4) - ((E/(R1+R2))*R1) ) # in V
Req = ((R1*R2)/(R1+R2)) + ((R3*R4)/(R3+R4)) # in k ohm
# Current through galvanometer
Ig = V_TH/((Req*10**3)+Rg) # in A
Ig = Ig * 10**6 # in µA
print "The current through galvanometer = %0.2F µA " %Ig
```

In [4]:

```
#Given data
R3 = 100.03 #standard resistance in µohm
R3 = R3 * 10**-6 # in ohm
R2 = 100.24 #outer ratio arms resistance in ohm
R1 = 200 #outer ratio arms resistance in ohm
b = 100.31 # in ohm
a = 200 # in ohm
Ry = 700 # in µohm
Ry = Ry * 10**-6 # in ohm
Rx = ((R1*R3)/R2) + ( ((b*Ry)/(Ry+a+b)) * ((R1/R2) - (a/b)) ) # in ohm
Rx = Rx * 10**6 #unknown resistance in µohm
print "The unknown resistance = %0.3F µΩ " %Rx
```

In [5]:

```
#Given data'
R1 = 100 # in ohm
R2 = 1000 # in ohm
R3 = 200 # in ohm
R4 = 2000 # in ohm
Rg = 200 # in ohm
S = 12 # in mm/µA
R = 5 # in ohm
R4 = R4 + R # in ohm
E = 10 # in V
# By Thevenin's equivalent
V_TH = E*( (R3/(R1+R3)) - (R4/(R2+R4)) ) # in V
Req = ((R1*R3)/(R1+R3)) + ((R2*R4)/(R2+R4)) # in ohm
Ig = abs(V_TH)/(Req+Rg) # in A
Ig = Ig * 10**6 # in µA
# S =D/I
D = S*Ig #deflection of the galvanomter in mm
print "The deflection of the galvanomter = %0.2f mm " %D
# Note:In the book the calculated value of V_TH is not correct. Correct value of V_TH is -5.546312 mV not -5.213 mV,
# So there is some difference between coding and the answer of the book.
```

In [6]:

```
#Given data
R1 = 1000 # in ohm
R2 = 1000 # in ohm
R3 = 121 # in ohm
R4 = 119 # in ohm
Rg = 200 # in ohm
E = 5 # in V
S = 1 # in mm/µA
# Calculation of Thevenin's equivalent due to change in R3 and R4
V_TH = E*( (R3/(R3+R1)) - (R4/(R4+R2)) ) # in V
Req = ((R1*R3)/(R1+R3)) + ((R2*R4)/(R2+R4)) # in ohm
Ig = V_TH/(Req+Rg) # in A
Ig = Ig * 10**6 # in µA
# S = D/I
D = S*Ig #deflection of the galvanometer in mm
print "The deflection of the galvanometer = %0.2f mm " %D
```

In [7]:

```
#Given data
R = 500 # in ohm
del_r = 20 # in ohm
E = 10 # in V
Rg = 125 # in ohm
V_TH = (E*del_r)/(4*R) # in V
Req = R # in ohm
# The current through the galvanometer
Ig = V_TH/(Req+Rg) # in A
Ig = Ig * 10**6 # in µA
print "The current through the galvanometer = %0.f µA " %Ig
```

In [8]:

```
#Given data
# Rx/R2 = Rb/Ra = 1/1200
R1 = 10 # in ohm
# Rx/R2= Rb/Ra= 1/1200
R2 = R1/0.5 # in ohm
Rx = R2/1200 #unknown resistance in ohm
print "The value of unknown resistance = %0.4f Ω " %Rx
```

In [9]:

```
#Given data
R1 = 10 # in k ohm
R2 = 10 # in k ohm
R3 = 10 # in k ohm
E = 10 # in V
# R2/R_V = R1/R3
R_V = (R2*R3)/R1 # in k ohm
T=80 # in °C
Rv=9 # in kΩ
# Evaluation of error voltage by Thevenin's equivalent voltage
e = E*( (R3/(R1+R3)) - (Rv/(R2+Rv)) ) # in V
# Evaluation of error voltage by approximation of slightly unbalanced bridge
del_r = R_V-Rv # in k ohm
errorVoltage = (E*del_r)/(4*R1) # in V
print "The temperature at which the bridge is balanced = %0.f °C " %T
print "The error voltage at 60 °C by Thevenin''s voltage = %0.3f volts " %e
print "The error voltage at 60 °C by approximation of slightly unbalanced bridge = %0.2f Volts is " %errorVoltage
```

In [10]:

```
#Given data
R1 = 120 # in ohm
R2 = 120 # in ohm
R3 = 120 # in ohm
R_V = 121 # in ohm
E_TH = 10 # in mV
E_TH = E_TH * 10**-3 # in V
# E_TH = E * ( (R3/(R3+R1)) - (R_V/(R_V+R2)) )
E = E_TH/((R3/(R3+R1)) - (R_V/(R_V+R2))) #required supply voltage in V
print "The required supply voltage = %0.2f V " %E
R = 120 # in ohm
del_r = R_V-R # in ohm
# E_TH = (E*del_r)/(4*R)
E = E_TH*4*R #The approximation of slightly unbalanced bridge in V
print "The approximation of slightly unbalanced bridge = %0.1f V " %E
```

In [12]:

```
#Given data
R1 = 1000 # in ohm
R2 = 100 # in ohm
R3 = 4 # in k ohm
R3 = R3*10**3 # in ohm
#At bridge balance, R1*R3 = R2*R4
R4 = (R1*R3)/R2 # in ohm
R4= R4*10**-3 #maximum unknown resistance in k ohm
print "The maximum unknown resistance = %0.f kΩ " %R4
R4= R4*10**3 # in ohm
R_TH = ((R1*R2)/(R1+R2)) + ((R3*R4)/(R3+R4)) # in ohm
Si = 70 # in mm/µA
Si = Si * 10**6 # in mm/A
theta = 3 # in mm
E = 10 # in V
Rg = 80 # in ohm
# theta = (Si*E*R3*del_R)/((R_TH+Rg)*((R3+R4)**2))
del_R = (theta*((R_TH+Rg)*((R3+R4)**2)))/(Si*E*R3) # in ohm
print "The value of del_R = %0.4f Ω " %del_R
print "This much unbalance is necessary to cause the deflection of 3 mm"
```

In [14]:

```
from math import sqrt
#Given data
P = 0.4 #power dissipation in each arm in W
Rarm = 150 # in ohm
#P = (I**2)*Rarm
I = sqrt(P/Rarm) # in A
#Apply KVL to the loop ABCEFA, (-I*Rarm) - (I*Rarm) - (2*I) + 25 - (2*I*R) = 0
R = ((-I*Rarm) - (I*Rarm) - (2*I) + 25)/(2*I) #required series resistance in ohm
print "The required series resistance = %0.4f Ω " %R
```

In [15]:

```
#Given data
R1 = 100 # in ohm
R2 = 1000 # in ohm
R3 = 0.00377 #standard resistance in ohm
a = 99.92 # in ohm
b = 1000.6 # in ohm
Ry = 0.1 #resistance of link in ohm
Rx =R1*R3/R2+b*Ry/(Ry+a+b)*(R1/R2-a/b) #unknown resistance in ohm
Rx = Rx * 10**3 # in mohm
print "The value of unknown resistance = %0.4f mΩ " %Rx
# Note: The answer will be in mΩ not MΩ.
```

In [16]:

```
#Given data
P = 10 # in ohm
Q = 10 # in ohm
S = 10 # in ohm
# For first balance
p = 30000 # in ohm
q = 25000 # in ohm
R_AB = (P*p)/(P+p) # in ohm
R_BC = (Q*q)/(Q+q) # in ohm
# R_AB*R = R_BC*S
R = (R_BC/R_AB)*S # in ohm
print "The value of R for first balance = %0.3f Ω " %R
# For second balance
p = 15000 # in ohm
q = 40000 # in ohm
R_AB = (P*p)/(P+p) # in ohm
R_BC = (Q*q)/(Q+q) # in ohm
# R_AB*S = R_BC*R
R = (R_AB/R_BC)*S # in ohm
print "The value of R for second balance = %0.4f Ω " %R
```

In [32]:

```
#Given data
P = 1000 # in ohm
Q = 1000 # in ohm
p = 1000 # in ohm
q = 1000 # in ohm
S = 0.001 # in ohm
R = (P/Q)*S # in ohm
print "The value of unknown resistance = %0.3f Ω " %R
Rb = 5 # in ohm
V = 100 # in V
I = V/(Rb+R+S) # in A
print "The current through the unknown resistance = %0.2f A " %I
# Vac = ( (R+r+S)/(Rb+R+r+S) )*V
Vac = ((R+S)/(Rb+R+S))*V # in V
Vab = (P/(P+Q))*Vac # in V
Vab = Vab * 10**3 # in mV
# Vamd = (R + (Pr/(p+q+r)))/(R+S+(((p+q)*r)/(p+q+r)))
Vamd = (R/(R+S))*Vab*10**-3 # in V
Vamd = Vamd * 10**3 # in mV
Vout = Vab - Vamd #output voltage in mV
Vout = Vout*10**-3 # in V
print "The output voltage = %0.5f V " %Vout
# Note : The value of Vout in the book is wrong.
```

In [33]:

```
#Given data
R = 1000 # in ohm
E = 20 # in V
Ig = 0.1 # in nA
Ig = Ig * 10**-9 # in A
Req = R # in ohm
#For small change in resistance, Thevenin's voltage, V_TH = (E*del_r)/(4*R)
# Ig = V_TH/Req
del_r = (Ig*4*R*R)/E #smallest change in resistance in ohm
del_r= del_r*10**6 # in µΩ
print "The smallest change in resistance = %0.f µΩ " %del_r
```