In [2]:

```
from __future__ import division
#Given data
# Values of measurements
x1 = 49
x2 = 51
x3 = 52
x4 = 50
x5 = 49
n = 5 # numbers of reading
Xn_bar = (x1+x2+x3+x4+x5)/n # average value for the set of measurements
# For n = 3
P = 1 - abs( (x3-Xn_bar)/x3) # the value of third measurement
P = P * 100 # in %
print "The precision of the 3rd measurement = %0.1f %% " %P
```

In [5]:

```
#Given data
At = 150 # in V
Am = 149 # in V
e = At-Am #absolute error in V
print "The absolute error = %0.f V " %e
e_r = ((At-Am)/At)*100 # e_r stands for %e_r in %
print "The percentage error = %0.2f %% " %e_r
A = 1 - abs( (At-Am)/At ) # relative accuracy
print "The Relative accuracy = %0.4f " %A
a = A*100 #Relative accuracy in %
print "The percentage accuracy = %0.2f %% " %a
fsd = 200 #full scale reading in V
# Percentage error
PerError = ((At-Am)/fsd)*100 # in %
print "Percentage error expressed as percentage of full scale reading = %0.1f %% " %PerError
```

In [5]:

```
from __future__ import division
#Given data
ChangeInOutput= 5 #change in output in mm
ChangeInInput= 2 # change in input in A
# Sensitivity,
sensitivity= ChangeInOutput/ChangeInInput # in mm/A
# Deflection factor,
defFactor= 1/sensitivity # in A/mm
print "Sensitivity of the ammeter = %0.1f mm/A" %sensitivity
print "Deflection factor of the ammeter = %0.1f A/mm" %defFactor
```

In [6]:

```
#Given data
Fullscaledeflection = 30 #full scale deflection in cm
n = 30 # number of divisions
scaledivision = Fullscaledeflection/n #scale division in cm
scaledivision = scaledivision * 10 # in mm
Resolution = (1/20)*scaledivision # in mm
print "The Resolution of the scale = %0.1f mm " %Resolution
```

In [43]:

```
from math import sqrt
import numpy as np
#Given data
# Reported values for average petrol consumption
x= [25.5,30.3, 31.1, 29.6, 32.4, 39.4, 28.9, 30.0, 33.3, 31.4, 29.5, 30.5, 31.7, 33.0, 29.2]
n = 15 # number of reading
sigma_x=0 # initialization of variable
for i in range(0,15) :
sigma_x= sigma_x+x[i] # sum of reading
Mean =sigma_x/n # mean value
print "The mean value = %0.4f " %Mean
sorted_x= np.sort(x)
Xmedian = sorted_x[(n+1)/2-1] # median value
print "The median value = %0.1f " %Xmedian
sigma_d_sq=0
d= [None]*15
for i in range(0,15) :
d[i]=x[i]-Mean
sigma_d_sq= sigma_d_sq+d[i]*d[i]
sigma = round(sqrt( sigma_d_sq/(n-1))) # standard deviation
print "The standard deviation = %0.2f " %sigma
V = sigma**2 # variance
print "The variance = %0.2f " %V
```

In [30]:

```
#Given data
# Value of readings
x=[147.2, 147.4, 147.9, 148.1, 147.7, 147.5, 147.6, 147.4, 147.6, 147.5]
n = 10 # number of reading
sigma_x=0 # initialization of variable
for i in range(0,n) :
sigma_x= sigma_x+x[i] # sum of readings
x_bar= sigma_x/n # mean value
print "The arthmatic mean = %0.2f " %x_bar
sigma_d_sq=0
d= [None]*n
for i in range(0,n) :
d[i]=x[i]-x_bar
sigma_d_sq= sigma_d_sq+d[i]*d[i]
sigma = sqrt( sigma_d_sq/(n-1) ) # standard deviation
print "The standard deviation = %0.4f " %sigma
# probable error of average of the ten reading
e_m = 0.6745 * ( sigma/(sqrt(n-1)) )
print "The probable error of average of the ten reading = %0.6f " %e_m
```

In [10]:

```
#Given data
Vrange=50 #range of voltmeter in V
V= 15 #instrument reading in V
# Limiting error at full scale
del_A= Vrange*1/100 # in V
# limiting error
PerE= del_A/V*100 # in %
print "The limiting error = %0.2f %% " %PerE
```

In [15]:

```
#Given data
del_a1 = 0.02 # limiting error in current
del_a2 = 0.5 # limiting error in resistor
A1 = 2
A2 = 120
e1 = del_a1/A1
e2 = del_a2/A2
n = 2
# limiting error
e_T = (n*e1)+e2
e_T_Per= e_T*100 # limiting error in percentage
print "The limiting error = ±",round(e_T,5),"or ±",round(e_T_Per,3),"%"
```

In [19]:

```
#Given data
R1= 15 #value of resistance in Ω
Re1= R1*5/100 #error in resistance in Ω
R2= 33 #value of resistance in Ω
Re2= R2*2/100 #error in resistance in Ω
R3= 75 #value of resistance in Ω
Re3= R3*5/100 #error in resistance in Ω
R_T= R1+R2+R3 #resultant resistance in Ω
R_T_e= Re1+Re2+Re3 #limiting error in resistance in Ω
print "The resultant = ",int(R_T),"Ω with the limiting error of ",round(R_T_e,2),"Ω"
e_T= R_T_e/R_T*100 # in %
print "The percentage relative limiting error in resultant = ±",round(e_T,1),"%"
```

In [24]:

```
from math import sqrt
#Given data
R1= 100 #resistance in Ω
Re1= 0.1 #error in Ω
R2= 50 #resistance in Ω
Re2= 0.03 #error in Ω
R= R1+R2 #resistance in Ω
w= sqrt(Re1**2+Re2**2)
print "For Series connection, R =",int(R),"±",round(w,4),"Ω"
R= R1*R2/(R1+R2) # in Ω
del_RbyR1= ((R1+R2)*R2-R1*R2)/(R1+R2)**2
del_RbyR2= ((R1+R2)*R1-R1*R2)/(R1+R2)**2
w= sqrt(del_RbyR1**2*Re1**2+del_RbyR2**2*Re2**2)
print "For Parallel connection, R =",round(R,2),"±",round(w,5),"Ω"
```

In [26]:

```
#Given data
At = 8.5 #true value in A
Am = 8.3 #measured value in A
Absoluteerror = At - Am #absolute error in A
print "The Absolute error = %0.1f A " %Absoluteerror
# Relative percentage error
Per_Error = ((At-Am)/At)*100 # %e in %
print "The relative percentage error = %0.2f %% " %Per_Error
```

In [27]:

```
#Given data
Am = 111.5 #measured value in V
Per_Error = 5.3 # %e in %
# Per_Error = ((At-Am)/At)*100
At = Am/(1 - (Per_Error/100)) #true value of voltage in V
print "The true value of voltage = %0.2f V " %At
```

In [28]:

```
#Given data
fullscaledivision = 100 #full scale division in V
n = 200 #number of divisions
scaledivision = fullscaledivision/n #scale division in V
Resolution = 1/2*scaledivision # in V
print "The Resolution of meter = %0.2f V " %Resolution
```

In [35]:

```
#Given data
V = 150 #voltage in V
R1 = 50 #resistance in k ohm
R2 = 100 #resistance in k ohm
V_AB = R1 * (V/(R1+R2)) # in V
sensitivity = 1 # in k ohm/V
R = sensitivity*V_AB # in k ohm
V_AB1 = ((R1*R)/(R1+R))*( V/(R2+(R1*R)/(R1+R)) ) #voltage reading on the voltmeter in V
print "Part (i) When voltmeter sensitivity is 1 kΩ/volt : "
print "The voltage reading on the voltmeter = %0.f V " %V_AB1
Per_Error= ((V_AB-V_AB1)/V_AB)*100 # %e in %
print "The percentage error = +%0.f %% " %Per_Error
sensitivity = 25 # in k ohm/V
R = sensitivity*V_AB # in k ohm
Rnet = (R1*R)/(R1+R) # assumed for calculation
V_AB2 = Rnet*( V/(R2+Rnet) ) # in V
print "Part (ii) When voltmeter sensitivity is 25 kΩ/volt : "
print "The voltage reading on the voltmeter = %0.3f V " %V_AB2
Per_Error = ((V_AB-V_AB2)/V_AB)*100 # %e in %
print "The percentage error = %0.2f %% " %Per_Error
print "Thus the voltmeter with low sensitivity shows more error"
print " while voltmeter with high sensitivity shows less error."
```

In [37]:

```
#Given data
V = 80 # in V
I = 15 # in mA
I = I * 10**-3 # in A
R_T = V/I # in ohm
R_T = R_T * 10**-3 #apparent resistance in k ohm
Rapp = R_T # in k ohm
print "The apparent resistance = %0.3f kΩ " %Rapp
sensitivity = 1.5 # in k ohm
f_s_reading = 150 #full scale reading in V
Rv = sensitivity*f_s_reading # in k ohm
#R_T = (Rx*Rv)/(Rx+Rv)
Rx = (R_T*Rv)/(Rv-R_T) #Actual resistance of unknown resistor in k ohm
print "Actual resistance of unknown resistor = %0.3f kΩ " %Rx
At = Rx # in k ohm
Am = Rapp # in k ohm
PerError = ((At-Am)/At)*100 #Error due to loading effect of voltmeter in %
print "Error due to loading effect of voltmeter = %0.2f %% " %PerError
PerAccu = (1-abs(PerError*10**-2))*100 #Percentage relative accuracy in %
print "Percentage relative accuracy = %0.2f %% " %PerAccu
```

In [39]:

```
#Given data
# Values of resistance
R1 = 200 # in ohm
R2 = 100 # in ohm
R3 = 50 # in ohm
R_T = R1+R2+R3 #resultant resistance in ohm
# Error in resistance
e1 = 5 # in %
e2 = e1 # in %
e3 = e1 # in %
a1 = R1 # in ohm
a2 = R2 # in ohm
a3 = R3 # in ohm
Per_e_T = ( ((R1/R_T)*e1) + ((R2/R_T)*e2) + ((R3/R_T)*e3) ) # in %
# Per_e_T= del_R_T/R_T*100
del_R_T= Per_e_T*R_T/100 # in Ω
print "The magnitude of the resultant resistance = %0.f Ω " %R_T
print "The limiting error (in percentage) is : ± ",int(Per_e_T),"%"
print "The limiting error (in ohm) is : ± ",round(del_R_T,1)," Ω"
```

In [42]:

```
#Given data
# Values of resistances
R1 = 36 # in ohm
R2 = 75 # in ohm
R_T = (R1*R2)/(R1+R2) # in ohm
# Error in resistance
e1 = 5 # in %
e_1 = e1+e1 # in % assumed
e2 = ( ((R1/(R1+R2))*e1) + ((R2/(R1+R2))*e1) ) # in %
e_T = e_1+e2 #limiting error in %
# Per_e_T= del_R_T/R_T*100
del_R_T= e_T*R_T/100 #limiting error in Ω
print "The limiting error (in percentage) is : ±",int(e_T)," %"
print "The limiting error (in ohm) is : ±",round(del_R_T,2)," Ω"
```

In [45]:

```
#Given data
Error = 2/100
Voltmeterrange = 50 #voltmeter range in V
Ammeterrange = 125 #ammeter range in mA
A1 = 40 #voltmeter reading in V
A2 = 125 #ammeter reading in mA
del_a1 = Error*Voltmeterrange # in V
del_a2 = Error*Ammeterrange # in mA
e1 = del_a1/A1 # error in voltage
e2 = del_a2/A2 # error in current
e_T= (e1+e2)*100 #limiting error of the power calculated in %
print "The limiting error of the power calculated is : ±",round(e_T,1)," %"
```

In [51]:

```
#Given data
R1 = 120 #resistance in ohm
e1= 0.1 #error in %
R2 = 2700 #resistance in ohm
e2= 0.5 #error in %
R3 = 470 #resistance in ohm
e3= 0.5 #error in %
Rx = (R2*R3)/R1 #magnitude of the unknown resistance in ohm
print "The magnitude of the unknown resistance = %0.f Ω " %Rx
e_T= e1+e2+e3 #limiting error in %
# Per_e_T= del_R_T/R_T*100
del_Rx= e_T*Rx/100 #limiting error in Ω
print "The limiting error (in percentage) is : ± ",round(e_T,1),"%"
print "The limiting error (in ohm) is : ± ",round(del_Rx,3),"Ω"
print "Hence the guaranteed values of the resistance is between",round(Rx-del_Rx,3)," Ω to ",round(Rx+del_Rx,3),"Ω"
```

In [38]:

```
#Given data
x=[101.2, 101.4, 101.7, 101.3, 101.3, 101.2, 101.0, 101.3, 101.5, 101.1] # measured value
n = 10 # number of reading
sigma_x= 0 # initialization of variable
for i in range(0,n) :
sigma_x= sigma_x+x[i] # sum of readings
x_bar=sigma_x/n # mean value
print "The arithmatic mean = %0.1f " %x_bar
sigma_d_sq=0 # initialization of variable
sigma_d=0 # initialization of variable
d= [None]*n
for i in range(0,n) :
d[i]=x[i]-x_bar
sigma_d= sigma_d+abs(d[i])
sigma_d_sq= sigma_d_sq+d[i]*d[i]
DevFrommean =sigma_d/n # Deviation from mean
print "The Deviation from mean = %0.2f " %DevFrommean
sigma = sqrt( sigma_d_sq/(n-1) ) #standard deviation in V
print "The standard deviation = %0.1f V " %sigma
ProError= 0.6745*sigma #probable error of one reading in V
print "The probable error of one reading = %0.4f V " %ProError
ProError = 0.6745*sigma # in V
e_m = ProError/( sqrt(n-1) ) # probable error of mean
print "The probable error of mean = %0.4f " %e_m
```

In [49]:

```
import numpy as np
#Given data
x= [29.6, 32.4, 39.4, 28.9, 30.0, 33.3, 31.4, 29.5, 30.5, 31.7, 33.0, 29.2] # measured value
n = 12 # number of reading
sigma_x= 0 # initialization of variable
for i in range(0,n) :
sigma_x= sigma_x+x[i] # sum of readings
x_bar=sigma_x/n # mean value
print "The mean value = %0.3f " %x_bar
sorted_x= np.sort(x)
x_median= (sorted_x[n/2]+sorted_x[n/2-1])/2 # median value
print "The median value = %0.2f " %x_median
sigma_d_sq=0
d= [None]*n
for i in range(0,n) :
d[i]=x[i]-x_bar
sigma_d_sq= sigma_d_sq+d[i]*d[i]
sigma = sqrt( sigma_d_sq/(n-1) ) #standard deviation in V
print "The standard deviation = %0.4f V " %sigma
```

In [58]:

```
#Given data
x= [41.7, 42.0, 41.8, 42.0, 42.1, 41.9, 42.0, 41.9, 42.5, 41.8] # measured value
n = 10 # number of reading
sigma_x= 0 # initialization of variable
for i in range(0,n) :
sigma_x= sigma_x+x[i] # sum of reading
x_bar=sigma_x/n # mean
print "The mean = %0.2f " %x_bar
sigma_d_sq=0
d= [None]*n
for i in range(0,n) :
d[i]=x[i]-x_bar
sigma_d_sq= sigma_d_sq+d[i]*d[i]
sigma = sqrt( sigma_d_sq/(n-1) ) #standard deviation in V
print "The standard deviation = %0.6f V " %sigma
ProError= 0.6745*sigma #probable error of one reading in V
print "The probable error of one reading = %0.4f V " %ProError
ProError = 0.6745*sigma # in V
e_m = ProError/( sqrt(n-1) ) # probable error of mean
print "The probable error of mean = %0.5f " %e_m
sorted_x= np.sort(x)
Range= sorted_x[0]-sorted_x[n-1] # range
print "Range = ",round(sorted_x[0],1)," to ",round(sorted_x[n-1],1)," = ",round(Range,1)
```

In [57]:

```
#Given data
Vrange= 600 #range in V
del_A= 2.5*Vrange/100 #limiting error at full scale in V
V= 400 #voltage in V
PerError= del_A/V*100 #percentage error in %
print "The limiting error is : ±",round(PerError,2)," %"
```

In [59]:

```
#Given data
At = 6.54 #true value in A
Am = 6.7 #measured value in A
AbsError = At-Am # absolute error
PerError= ((At-Am)/At)*100 # percentage error
print "The error = %0.3f %% " %PerError
```

In [63]:

```
#Given data
Wrange= 500 #wattmeter range in W
del_A= 1.5*Wrange/100 #limiting error at full scale in W
P= 50 #power in W
Pmin= P-del_A # minimum power in W
Pmax= P+del_A # maximum power in W
print "The range of the reading =",round(Pmin,1),"watts to",round(Pmax,1),"watts"
```