Chapter 1:Concepts of Measurements and Electromechanical Instruments

Example:1.1,Page No:28

In [1]:
import math

#variable declaration
Vm    = 112.68;                 #voltmeter reading in V
Vt    = 112.6;                  #true value of voltage in V

#calculations
Es  =  Vm-Vt;                   #static error in V
Cs  = -Es;                      #static correction in V

#result
print'static error = %3.2f'%Es,'V';
print'static correction = %3.2f'%Cs,'V';
static error = 0.08 V
static correction = -0.08 V

Example:1.2,Page No:29

In [2]:
import math

#variable declaration
V   =  92.35;                 #thermometer reading in °C
Cs  =  -0.07;                 #static correction in °C

#calculations
Vt   = V+Cs;                  #true value in °C

#result
print'true value = %3.2f'%Vt,'°C';
true value = 92.28 °C

Example:1.3,Page No:29

In [3]:
import math

#variable declaration
Vm   = 2.65;                      #voltage reading in V
Vt   = 2.70;                      #true voltage value in V
x    = 5;                         #scale range

#calculation
Es   = Vm-Vt;                     #absolute error in V
Cs   = -Es;                       #absolute correction in V
Er   = (Es/float(Vt))*100;              #relative error as a function of true value in %
Es1   = (Es/float(x))*100;                     #relative error as a function of full scale deflection in %

#result
print'absolute error =%3.2f'%Es,'V';
print'relative error = %3.2f'%Cs,'V';
print'relative error = %3.2f'%(Er),'%';
print'relative error = %3.2f'%(Es1),'%';
absolute error =-0.05 V
relative error = 0.05 V
relative error = -1.85 %
relative error = -1.00 %

Example:1.4,Page No:29

In [6]:
import math

#variable declaration
Vm    = 42;                    #pressure reading in bar
Vt    = 41.4;                  #true value of pressure in bar
x     = 5;                     #scale range

#calculations
Es    = Vm-Vt;                 #static error in bar
Vs    = -Es;                   #static correction in bar
Er    =  (Es/float(Vt))*100;         #relative error in %

#result
print'static error      = %3.1f'%Es,'bar';
print'static correction = %3.1f'%Vs,'bar';
print'relative error    = %3.2f'%Er,'%';
static error      = 0.6 bar
static correction = -0.6 bar
relative error    = 1.45 %

Example:1.5,Page No:29

In [8]:
import math

#variable declaration
p1    =  50;              #pressure range in bar
e    =  0.15;             #error in bar(indicates both in -ve and +ve value)
p2    = 10;               #error in bar

#calculations
pe1   = (e/float(p1))*100;     #percentage error on basis of maximum scale value(indicates both in -ve and +ve value)
pe2   = (e/float(p2))*100;     #percentage error on basis of maximum scale value of 10 bar(indicates both in -ve and +ve value)

#result
print'percentage error = %3.1f'%pe1,'%';
print'percentage error = %3.1f'%pe2,'%';
percentage error = 0.3 %
percentage error = 1.5 %

Example:1.6,Page No:30

In [9]:
import math

#variable declaration

e1   = 0.3;              #accuracy limits for transmitter(indicates both in -ve and +ve value)
e2   = 1.4;              #accuracy limits for relay(indicates both in -ve and +ve value)
e3   = 0.9;              #accuracy limits for receiver(indicates both in -ve and +ve value)


#calculations
em    = e1+e2+e3;                               #maximum possible error(indicates both in -ve and +ve value)
x     = math.sqrt((e1**2)+(e2**2)+(e3**2));     #least root square accuracy(indicates both in -ve and +ve value)

#result
print'error is possibly as large as %3.2f'%em,'%',' but probably not large than %3.2f'%x,'%'; 
error is possibly as large as 2.60 %  but probably not large than 1.69 %

Example:1.7,Page No:31

In [10]:
import math

#variable declaration
r1  = 5;                #pressure gauge minimum value in bar
r2  = 60;               #pressure guage maximum value in bar
a   = 0.2;              #accuracy in percent(indicates both in -ve and +ve value)

#calculations
r     =  r2-r1;             #span of pressure gauge in bar
es    =  (a*r)/float(100);  #maximum static error in bar(indicates both in -ve and +ve value)

#result
print'maximum static error = %3.2f'%es,'bar';
maximum static error = 0.11 bar

Example:1.8,Page No:34

In [27]:
import math

#variable declaration
d   = 300;                    #full scale deflection in degrees
r   = 90;                     #radius of scale in mm
p   = 60;                     #calibration pressure in pascals

#calculations
f   = (d/float(180));    #full scale deflection(multiple of math.pi) in rad.
l   = f*r;               #length of scale(multiple of math.pi) in mm
s   = l/float(p);                #sensitivy in mm/pa

#result
print'sensitivity = %3.1f'%s,'*(math.pi) mm/Pa';
sensitivity = 2.5 *(math.pi) mm/Pa

Example:1.9,Page No:35

In [28]:
import math

#variable declaration
d   = 2.4;                      #change in deflection in mm
R   = 6;                        #change in arm of wheatstone bridge in Ω

#calculations
s   = d/float(R);                        #sensitivity in mm/Ω
D   = R/float(d);                        #deflection factor in Ω/mm

#result
print'sensitivity = %3.1f'%s,'mm/Ω';
print'deflection factor = %3.1f'%D,'Ω/mm';
sensitivity = 0.4 mm/Ω
deflection factor = 2.5 Ω/mm

Example:1.10,Page No:35

In [29]:
import math

#variable declaration
s1   = 6.8;              #sensitivity of piezoelectric transducer in pC/bar
s2   = 0.0032;           #sensitivity of charge amplifier in V/pC
s3   = 16;               #sensitivity of ultraviolet charge recorder  in mm/V
i    = 20;               #pressure change in bar 

#calculations
S   = s1*s2*s3;          #overall sensitivty of measuring system in mm/bar
O   = S*i;               #change of output signal in mm


#result
print'deflection on the chart = %3.2f'%O,'mm';
deflection on the chart = 6.96 mm

Example:1.11,Page No:37

In [30]:
import math

#variable declaration
Rn    = 200;                    #range of force 0-200
r     = 0.15;                   #resolution of full scale in %

#calculations
s    = (r*Rn)/float(100);        #smallest change which can be measured in N

#result
print'smallest change = %3.1f'%s,'N';
smallest change = 0.3 N

Example:1.12,Page No:37

In [32]:
import math

#variable declaration
V     = 50;                #full scale reading in V
d     = 50;                #divisions
y       = 10;              #reciprocal of scale division

#calculations
x     = 1/float(y);      #scale division
s1      = V/float(d);      #one scale division
R       = x*s1;            #resolution in V

#result
print'resolution = %3.1f'%R,'V';
resolution = 0.1 V

Example:1.13,Page No:37

In [33]:
import math

#variable declaration
f  =  9.999;                   #full scale reading in V
R  =  9999;                    #read out range in counts

#calculations
r    =  f/float(R);             #resolution of a digital voltmeter in V

#result
print'resolution of digital voltmeter = %3.1d'%(r*10**3),'mV';
resolution of digital voltmeter =   1 mV

Example:1.14,Page No:38

In [34]:
import math

#variable declaration
t1   = 300;                #calibration minimum value in °C
t2   = 800;                #calibration minimum value in °C 
d    = 0.11;               #dead zone in percent of span

#calculations
s    = t2-t1;              #span of the pyrometr in °C
D    =  (d*s)/float(100);  #dead zone in °C

#result
print'Hence a change of %3.2f°C must occur before it is detected'%D,;
Hence a change of 0.55°C must occur before it is detected

Example:1.15,Page No:39

In [4]:
import math

#variable declaration
Rv       = 125;                       #internal resistance of the voltmeter in kΩ
Rappt    = 30;                        #apparent resistance in kΩ
Rappt1    = 50;                        #apparent resistance in kΩ
v1       = 180;                       #voltage in V
i1       = 6*10**-3;                  #current in A
v2       = 60;                       #voltage in V
i2       = 1.2*10**-3;               #current in A

#calculations
Rt      = (v1/float(i1))*10**-3;                            #total resistance of circuit in kΩ
Ract    = (Rt*Rv)/float(Rv-Rt);                             #actual value of resistance in kΩ
pe      = ((Ract-Rappt)/float(Ract))*100;                   #percentage loading error in %
Rt1      = (v2/float(i2))*10**-3;                           #total resistance of circuit in kΩ
Ract1    = ((Rt1*Rv)/float(Rv-(Rt1/float(1000))));                        #actual value of resistance in kΩ
pe1      = ((Ract1-Rappt1)/float(Ract1))*100;               #percentage loading error in %

#calculations
print'loading error %3.0f'%pe,'%';
print'loading error %3.3f'%pe1,'%';
print'When voltmeter with high internal resistance is connectedd across two points in a high resistance circuit ,'
print'the loading effect is appreciable and, therefore, the voltmeter gives misleading voltage reading\n'
print'The saame voltmeter has a negligible loading error when connected across a low resistance circuit and'
print'it gives more reliable voltage reading'
loading error  24 %
loading error 0.040 %
When voltmeter with high internal resistance is connectedd across two points in a high resistance circuit ,
the loading effect is appreciable and, therefore, the voltmeter gives misleading voltage reading

The saame voltmeter has a negligible loading error when connected across a low resistance circuit and
it gives more reliable voltage reading

Example:1.18,Page No:60

In [45]:
import math

#variable declaration 
Ii      = 160;                   #input in  °C
t1      = 1.2;                   #time constant in s
t2      = 2.2;                   #time constant in s
Iin     = 20;                    #initial reading in  °C

#calculations
x       = t1/float(t2);                  #ratio of time to time constant   
I0      = Ii*(1-(math.exp(-x)));          #thermometer's reading
e       = math.exp(-x);
I1      = (Ii)+(((Iin)-(Ii))*e);          #thermometer's reading if intial temperature was 20°C
#calculations
print'thermometers reading %3.2f'%I0,'°C';
print'thermometers reading %3.2f'%I1,'°C';
            
thermometers reading 67.27 °C
thermometers reading 78.86 °C

Example:1.19,Page No:60

In [46]:
import math

#variable declaration
t1   = 5;             #time constant in s
t2  = 10;            #time constant in s
Iin = 30;            #initial temperature in °C
Ii  = 160;           #final temperature in °C

#calculations
x       = t2/float(t1);                                #ratio of time to time constant     
I0      = (Ii)+(((Iin)-(Ii))*(math.exp(-x)));          #temperature afte 10s in °C

#result
print'temperature after 10s is %3.1f'%I0,'°C'; 
temperature after 10s is 142.4 °C

Example:1.20,Page No:60

In [48]:
import math
 
#variable declaration
T      = 9;                     #three time constant in s
X      =  0.5;                  #temperature difference of I0/I1 

#calculations
T1     = T/float(3);            #time constant in s
t      = -3*math.log(1-X);      #time taken by the transducer in s

#result
print'time taken by the transducer = %3.2f'%t,'s';
time taken by the transducer = 2.08 s

Example:1.21,Page No:61

In [49]:
import math

#variable declaration
sg  = 0.296;                      #steady stage gain W/°C
dT  = 80;                         #change in temperature in °C
t   = 12;                         #time in s
T   = 4.8;                        #time constant in s
R   = 90;                         #stable resistance before step change in W


#calculations
r  = sg*dT;                       #step input in terms of resistance in Ω
Rt = r*(1-(math.exp(-t/T)))+(R);  #resistance in Ω

#result
print'resistance = %3.2f'%Rt,'Ω';
resistance = 111.74 Ω

Example:1.22,Page No:61

In [6]:
import math

#variable declaration
Iin   = 15;                  #intial temperature in °C
Ii    = 140;                 #temperature in °C
Io    = 75;                  #temperature in °C
X     = 5

#calculation
x      =  (Io-Ii)/float(Iin-Ii);           #change in output to input
t      =  -4/float(math.log(x));          #time constant for the thermometer in s   
I0     =  Ii+(Iin-Ii)*math.exp(-X);        #indicated temperature after five minutes constant in °C

#result
print'time constant for the thermometer = %3.2f'%t,'s';
print'indicated temperature after five minutes constant %3.2f'%I0,'°C';
print'After a time interval equivalent to five times constants, the thermometer reaches the equivaence condition'
time constant for the thermometer = 6.12 s
indicated temperature after five minutes constant 139.16 °C
After a time interval equivalent to five times constants, the thermometer reaches the equivaence condition

Example:1.23,Page No:62

In [52]:
import math

#variable declaration
Edy   = 3.9;                 #dynamic error °C
phi   = 0.2;                 #slope °C/s

#calculation
T   = Edy/float(phi);       #time constant in s

#result
print'time constant = %3.1f'%T,'s';
time constant = 19.5 s

Example:1.24,Page No:62

In [53]:
import math

#variable declaration
T    = 8;                 #time constant  in s
rt   = 5;                 #rate of rise of the ballon in m/s
T1   = 30;                #temperature indicated at ana altitude of 2500 min °C
Rt   = 0.011;             #rate of temperature variation with altitude  in °C/m
h    = 2500;              #height in m

#calculations
y    = Rt*rt;                  #rate of change of temperature with time in °C/s
Edy  = y*T;                    #error in °C
e    = Edy/float(Rt);          #error in amplitude in m
a    = h-e;                    #actual altitude in m

#result
print'actual altitude %d'%a,'m';
actual altitude 2460 m

Example:1.25,Page No:62

In [54]:
import math

#variable declaration
T    = 50;            #time constant of thermometer on s
t    = 500;           #time period in s

#calculations
w       =  (2*math.pi)/float(t);                 #frequency of temperature variaton in rad/s
x       =  1/float(math.sqrt(1+((w*T)**2)));     #ratio of output to input 
phi     =  math.atan(w*T);                       #phase shift in rad 
tl      =  (1/float(w))*phi;                     #time lag in s

#result
print'ratio of output to input %3.4f'%x;
print'Time lag %3.2f'%tl,'s';
ratio of output to input 0.8467
Time lag 44.64 s

Example:1.26,Page No:63

In [55]:
import math

#variable declaration
T        = 20;             #time constant in s
Ii       = 25;             #sinusoidal variation of input in °C
t        = 4;              #time in minutes

#calculation
f        = 1/float(t*60);                        #frequency in Hz
w        = 2*math.pi*f;                          #angular frequency in rad./s
x        = 1/float(math.sqrt((1+(w*T)**2)));     #temperature indicated to temperature of the medium 
I0       = x*Ii;                                 #variation in temperature indictaed in °C(indicates both in -ve and +ve value)
phl      = math.atan(w*T);                       #phase lag in rad
l        = (1/w)*phl;                            #lag in seconds

#result
print'variation in indicated temperature %3.2f'%I0,'°C';
print'lag = %3.2f'%l,'s';
variation in indicated temperature 22.15 °C
lag = 18.42 s

Example:1.27,Page No:64

In [56]:
import math

#variable declaration
f     = 120;            #input frequency in s
p     = 4;              #amplitude accuracy permissible in %
x     = 0.96             #temperature indicated to temperature of the medium 

#calculations
w      = 2*math.pi*f;               #angular fruequency in rad/s
x1     = 1/float(x);
t1     = ((x1)-1);
T      = t1/(float(w));             #maximum time constant in s
phi    = math.atan(w*T);             #for sinusoidal input phi 
tl     = (1/float(w))*phi;           #time lag at 90 cycles per second

#result
print'maximum time constant %3.3e'%T,'s';
print'time lag at 90 cycles per second is %3.3e'%tl,'s';
maximum time constant 5.526e-05 s
time lag at 90 cycles per second is 5.523e-05 s

Example:1.28,Page No:64

In [57]:
import math

#variable declaration
R1     = 520;                 #Range of temperature in °C
R2     = 580;                 #Range of temperature in °C
t      = 50;                  #periodic time in  s
T      = 10;                  #time constant in s
Ii     = 30;                  #initial amplitude in °C

#calculations
R       = (R1+R2)/float(2.0);                    #temperature  oscillating mean value in °C
w       = (2*math.pi)/float(t);                  #angular frequency in rad/s
X       =  1/float(math.sqrt((1+(w*T)**2)));     #amplitude ratio after transient effect dies away 
I0      = X*Ii;                                  #amplitude in  °C                  
Tmax    = R+I0;                                  #maximum temperature in °C
Tmin    = R-I0;                                  #minimum temperature in °C
phi     = math.atan(w*T);                        #phase shift in rad
Tl      = (1/float(w))*phi;                      #time lag in s

#result
print'maximum temperature = %3.2f'%Tmax,'°C';
print'minimum temperature = %3.2f'%Tmin,'°C';
print'phase shift  = %3.3f'%phi,'°';
print'time lag = %3.2f'%Tl,'s';
maximum temperature = 568.68 °C
minimum temperature = 531.32 °C
phase shift  = 0.899 °
time lag = 7.15 s

Example:1.29,Page No:65

In [59]:
import math

#variable declaration
Ii   = 0.35;                           #sinusoidal input amplitude from given expression 0.35sin(25t)
T    = 0.3;                            #time constant in s
w    = 25;                             #angular frequency in °,from given expression 0.35sin(25t)

#calculations

X       =  1/float(math.sqrt((1+((w*T)**2))));     #amplitude ratio
I0      =  X*Ii;                                   #magnitude of output 
phi     =  math.atan(w*T);                         #phase shift in radians

#result
print'output expression %3.4f'%I0,'sin(25t-%3.1f'%((phi*180)/float(math.pi)),'°)';
output expression 0.0463 sin(25t-82.4 °)

Example:1.30,Page No:66

In [60]:
import math

#variable declaration
T1    = 18;                                    #time constant for the bulb in s
T2    = 36;                                    #time constant for the well in s
t     = 120;                                   #time in s
Temp  = 20;                                    #rate of change in temperature in °C

#calculation
w      = (2*math.pi)/float(t);
X1     =  1/float(math.sqrt((1+(w*T1)**2)));     #amplitude ratio of first system 
X2     =  1/float(math.sqrt((1+(w*T2)**2)));     #amplitude for second system 
X      = X1*X2;                                    #amplitude for double capacity system
Tmax   = Temp*X;                                   #maximum temperature in °C(indicates both in -ve and +ve value)
Al     = math.atan(w*T1)+math.atan(w*T2);          #angle of lag in rad
Tl     = (1/float(w))*Al;                         #time lag in s

#result
print'maximum value of temperature indicated %3.2f'%Tmax,'°C';
print'Time lag = %3.2f'%Tl,'s';
maximum value of temperature indicated 6.82 °C
Time lag = 35.12 s

Example:1.31,Page No:66

In [61]:
import math

#variable declaration
T     = 0.3;                          #time constant in s
I1    = 2;                            #sinusoidal input amplitude from given expression 2sin(2t)+0.5sin(10t)
w1    = 2;                            #angular frequency in °,from given expression 2sin(2t)+0.5sin(10t)
I2    = 0.5;                          #sinusoidal input amplitude from given expression 2sin(2t)+0.5sin(10t)
w2    = 10;                            #angular frequency in °,from given expression 2sin(2t)+0.5sin(10t)

#calculations
X1       =  1/float(math.sqrt((1+((w1*T)**2))));     #magnitude of output 
phi1     =  math.atan(w1*T);                         #phase shift in radians
X2       =  1/float(math.sqrt((1+((w2*T)**2))));      #magnitude of output
phi2     =  math.atan(w2*T);                         #phase shift in radians

#result

print'output expression %3.3f'%X1,'sin(2t-%3.2f' %((phi1*180)/float(math.pi)),'°)','+ %3.3f'%X2,'sin(10t-%3.2f' %((phi2*180)/float(math.pi)),'°)';
output expression 0.857 sin(2t-30.96 °) + 0.316 sin(10t-71.57 °)

Example:1.32,Page No:67

In [63]:
import math

#variable declaration
T     = 0.15;                          #time constant in s
I1    = 2;                            #sinusoidal input amplitude from given expression 2sin(2t)+0.5cos(8t) or 2sin(2t)-0.5sin(180-8t)  
w1    = 2;                            #angular frequency in °,from given expression 2sin(2t)+0.5sin(8t) or 2sin(2t)-0.5sin(180-8t)
I2    = 0.2;                          #sinusoidal input amplitude from given expression 2sin(2t)+0.5sin(8t) or 2sin(2t)-0.5sin(180-8t)
w2    = 8;                            #angular frequency in °,from given expression 2sin(2t)+0.5sin(8t) or 2sin(2t)-0.5sin(180-8t)

#calculations
X1       =  1/float(math.sqrt((1+((w1*T)**2))));      #amplitude ratio
I01      =  X1*I1;                                   #magnitude of output 
phi1     =  math.atan(w1*T);                         #phase shift in radians
X2       =  1/float(math.sqrt((1+((w2*T)**2))));      #amplitude ratio
I02      =  X2*I2;                                   #magnitude of output
phi2     =  math.atan(w2*T);                         #phase shift in radians

#result

print'output expression %3.3f'%I01,'sin(2t-%3.1f' %((phi1*180)/float(math.pi)),'°)','- %3.3f'%I02,'sin(8t+180-%3.2f' %((phi2*180)/float(math.pi)),'°)';
output expression 1.916 sin(2t-16.7 °) - 0.128 sin(8t+180-50.19 °)

Example:1.34,Page No:68

In [64]:
import math

#variable declaration
m1   = 4.5;                 # mass in g
p   = 1.15;                  #percentage increase requiredd in %

#formula
#wn2  =  p*wn1
#m2   = m1*(wn2/wn1)
x    = (1/float(p))**2;
#m2   = m1*x
#percentage reduction = (m1-m2)/m1
# p   = (m1-x*m1)/m1
m3    = ((1-x)/float(1))*100;              #percentage  reduction in mass(%)


#result
print'percentage  reduction in mass %3.1f'%m3,'%'
percentage  reduction in mass 24.4 %

Example:1.35,Page No:69

In [66]:
import math
wn     = 5.477;                  #natural frequency
k1     = 0.1;                    #ratio of 2*gamma/wn
k      = 1;                     #static sensitivity 

#calculations
gamma    = (k1*wn)/float(2);      #damping ratio
y        = (1-(gamma**2));        #damped natural frequency in rad/s
wd       = wn*math.sqrt(y);       #static sensitivity
t        = 1/float(wn);           #time constant in s

#result
print'damping ratio  = %3.3f'%gamma;
print'damped natural frequency = %3.3f'%wd,'rad/s';
print'static sensitivity =%3.0f'%k;
print'time constant = %3.4f'%t,'s';
damping ratio  = 0.274
damped natural frequency = 5.268 rad/s
static sensitivity =  1
time constant = 0.1826 s

Example:1.36,Page No:70

In [67]:
import math

#variable declaration
w    = 1.95;                        #angular frequency in rad/s
em   = 8;                           #maximum permissible error in %
J    = 0.14;                        #moment of inertia of load in kg m**2
q    = 1.22;                        #torsional constant of the shaft in Nm/rad
M    = 1.08;                        #amplitude ratio 

#calculations
wn    = math.sqrt(q/float(J));      #natural frequency in rad/s
r     = w/float(wn);                #normalised frequency ratio
x     = 1/float(M**2);              
gamma =math.sqrt((x-((1-r**2)**2))/float(2*r)**2);   #damping ratio 
wd    = wn*(math.sqrt(1-(gamma**2)));                #damped natural frequency in rad/s
T     = 1/float(wn);                                 #time constant in s

#result
print'natural frequency = %3.2f'%wn,'rad/s';
print'damping ratio %3.3f'%gamma;
print'damped natural frequency %3.3f'%wd,'rad/s';
print'time constant %3.3f'%T,'s';
natural frequency = 2.95 rad/s
damping ratio 0.556
damped natural frequency 2.454 rad/s
time constant 0.339 s

Example:1.37,Page No:71

In [68]:
import math

#variable declaration
po    =12;                          #percentage overshoot in %
Tr    = 0.22;                      #rise time in s

#calculations
x      = -math.log(12/float(100));         
gamma  = x/float(math.sqrt((x**2)+(math.pi**2)));    #effective damping ratio 
wd     = math.pi/float(Tr);                          #damped natural frequency in rad/s
wn     = wd/float(math.sqrt(1-(gamma**2)));          #undamped angular frequency in rad/s
fn     = wn/float(2*math.pi);                         #undamped natural frequency in Hz
 
#result
print'effective damping ratio = %3.2f'%gamma;
print'undamped natural frequency = %3.2f'%fn,'Hz';
effective damping ratio = 0.56
undamped natural frequency = 2.74 Hz

Example:1.38,Page No:73

In [70]:
import math

#variable declaration
gamma   = 0.62;                  #damping ratio 
fn      = 5;                    #natural frequency in Hz
f       = 7;                    #exicitation frequency in Hz
 
#calculations
r   = f/float(fn);                                              #ratio of excitation frequency tonatural frequency
M   = 1/float(math.sqrt(((1-(r**2))**2)+((2*gamma*r)**2)));     #amplitude ratio
e   = (1-M)*100;                                                 #error in %

#result
print'natural frequency %3.1f'%r;
print'amplitude ratio %3.3f'%M;
print'error = %3.1f'%e,'%';
natural frequency 1.4
amplitude ratio 0.504
error = 49.6 %

Example:1.39,Page No:73

In [73]:
import math

#variable declaration
fn      = 800;                       #natural frequency of the system in cps
gamma   = 62;                        #damping ratio per cent
d       = 12;                        #maximum amount of deviation of amplitude ratio in per cent
M       = 1.12; 
M1      =0.88;

#calculations
#M  = 1/math.sqrt(((1-r**2)**2)+((2*0.62*r)**2));
x     = (1/float(M))**2;
#1+(r**4)-(2*r**2)+(1.58*(r**2))=x
#r**4-((0.462)*(r**2))+0.203 =0
y     = (1/float(M1))**2
#1+(r**4)-(2*r**2)+(1.58*(r**2))=y
#r**4-(0.462*(r**2))-0.29=0
x    = math.sqrt((0.462**2)+(4*0.29));
r1   = (0.462+x)/float(2);
r    = math.sqrt(r1);
f    = fn*r;

#result
print'the deviation remains within 12 percent of output for the frequency range 0 - %3.2f'%f,'cps';
the deviation remains within 12 percent of output for the frequency range 0 - 723.09 cps

Example:1.40,Page No:74

In [74]:
import math

#variable declaration
f     = 0.6;                            #frequency in rad/s
m     = 1;                             #magnitude of input
a     = 3.77;                         #angle value from sin(3.77t)

#calculations
w       = 2*math.pi*f;                     #angular frequency
#x      = complex(8/float(((j*w)**2)+(4*j*w)+20));
x1      =(-(w**2)+20)/float(8);
y1      = (4*w)/float(8);
x       = (complex(x1,y1));
X       = abs(x);
phi     = ((math.atan(y1/float(x1)))*180)/(math.pi);    #phase lag in rad
m       = (1/float(2.02))*m;

#result
print'required expresssion for the output is %3.3f'%m,'sin(3.77t-%3.2f°)'%phi;
print'output ampliude %3.3f'%m;
print'output frequency %3.2f'%a;
print'phase lag %3.2f'%phi,'°';
required expresssion for the output is 0.495 sin(3.77t-69.00°)
output ampliude 0.495
output frequency 3.77
phase lag 69.00 °

Example:1.41,Page No:75

In [75]:
import math

#variable declaration
R    = 500;                        #range of wattemeter in W
e    = 1.5;                        #percentage of full scale deflection rantging -1.5 to +1.5
Qs   = 50;                         #true or specified power in W
me1   = 7.5;                        #percentage of full scale deflection indicating -7.5 to +7.5

#calculations
me    = (e/float(100))*R;                 #magnitude of limiting error at full scale in W ranging -me to +me
Rmax  = Qs+me;                            #maximum wattmeter reading may be Rmax in W
Rmin  = Qs-me;                            #minimum wattmeter reading may be Rmin in W
Er    = (me1/float(Qs))*100;               #relative error in %
Em    = ((e*Qs)/float(100));
Mmax  = Qs+Em;                            #maximum wattmeter reading may be Mmax in W
Mmin  = Qs-Em;                            #minimum wattmeter reading may be Mmin in W

#result
print'when the error is specified as a percentage of full scale deflection,the wattmeter reading may be between %3.1f'%Rmin,'to %3.1f'%Rmax,'W';
print'when the error is specified as a percentage of true value,the wattmeter reading may be between %3.2f'%Mmin,'to %3.2f'%Mmax,'W';
when the error is specified as a percentage of full scale deflection,the wattmeter reading may be between 42.5 to 57.5 W
when the error is specified as a percentage of true value,the wattmeter reading may be between 49.25 to 50.75 W

Example:1.42,Page No:76

In [77]:
import math

#variable declaration
Er    = 3;                          #accuracy of flow meter of full scale reading in % ranging -Er to +Er
Qs    = 2.5*10**-6;                 #full scale reading in m**3/s
Qs1     = 1.25*10**-6;              #flow measured by the meter in m**3/s

#calculations
dQ    = (Er/float(100))*Qs;          #magnitude of limiting error ranging -dQ to +dQ  in m**3/s
Er1   = dQ/float(Qs1);               #relative error 
Q1     = Qs1*(1);                    #flow rate in m**3/s
Q2     = Qs1*Er1;                    #flow rate in m**3/s
Er2    = (Q2/float(Q1))*100;         #percentage limiting error ranging -Er2 to +Er1 in %

#result

print'percentage limiting error = %3.2f'%Er2,'%';
percentage limiting error = 6.00 %

Example:1.43,Page No:77

In [82]:
import math

#variable declaration
R1     = 25;                               #resitance in Ω
R2     = 65;                               #resitance in Ω
R3     = 45;                               #resitance in Ω
e1     = 4;                                #limiting error indicating both in -ve and +ve values in %
e2     = 4;                                #limiting error indicating both in -ve and +ve values in %
e3     = 4;                                #limiting error indicating both in -ve and +ve values in % 

#calculations
e11   = (e1*R1)/float(100);            #error value indicating both in -ve and +ve values
e21   = (e2*R2)/float(100);            #error value indicating both in -ve and +ve values
e31   = (e3*R3)/float(100);            #error value indicating both in -ve and +ve values
R     = R1+R2+R3;                     #magnitude of resitance in Ω
e     = e11+e21+e31;                  #error indicating both in -ve and +ve values
Rmax  = R+e;
Rmin  = R-e;
p     =((e)/float(R))*100;            #percent limiting error of the series combination of resistance in %(indicating both in -ve and +ve values)


#result
print'limting value of resultant reistance is %3.2f'%Rmax,' and %3.2f'%Rmin,' Ω';
print'percent limiting error of the series combination of resistance %3.2f'%p,'%';
limting value of resultant reistance is 140.40  and 129.60  Ω
percent limiting error of the series combination of resistance 4.00 %

Example:1.44,Page No:78

In [83]:
import math

#variable declaration
x    = 1.2;                #limiting error in the measurement of power(dP/p) in % 
y    = 0.8;                #limiting error in the measurement of current(dI/I) in %

#calculations
z    = (x+(2*y));            #limiting error in the measurement of resistance(dR/R) indicating -z to +z in %

#result
print'limiting error in the measurement of resistance %3.2f'%z,'%';
limiting error in the measurement of resistance 2.80 %

Example:1.45,Page No:78

In [84]:
import math

#variable declaration
R1    = 50;                  #resistance in Ω
R2    = 500;                  #resistance in Ω
R3    = 440;                  #resistance in Ω
dR1   = 0.5;                  #limiting error(dR1/R1) of R1 ranging -dR1 to +dR1 in %
dR2   = 0.5;                  #limiting error(dR2/R2) of R1 ranging -dR2 to +dR2 in %
dR3   = 0.5;                  #limiting error(dR3/R3) of R1 ranging -dR3 to +dR3 in %

#calculations
R4    = (R2*R3)/float(R1);                      #unknoen resistance in Ω
x     = (dR1+dR2+dR3);                          #relative limiting error of unknown resistance ranging -x to +x in %
e     = (x*R4)/float(100);                      #limiting error(Ω) indcating -ve and +ve values 
Rmax  = R4+e;                                   #maximum value of resitance in Ω
Rmin  = R4-e;                                   #minimum value of resistance in Ω

#result
print'magnitude of unknown resitance= %3.2f'%R4,'Ω';
print'relative limiting error %3.2f'%x,'%;'
print'limiting error %3.2f'%e,'Ω';
print'the guaranteed values of resitance lie between %3.2f'%Rmin,'and %3.2f'%Rmax,'Ω';
magnitude of unknown resitance= 4400.00 Ω
relative limiting error 1.50 %;
limiting error 66.00 Ω
the guaranteed values of resitance lie between 4334.00 and 4466.00 Ω

Example:1.46,Page No:78

In [85]:
import math

#variable declaration 
db    = 0.01;           #accuracy of width ranging -db to +db
b     = 4.5;            #width in mm
dd    = 0.01;           #accuracy of depth ranging -dd to +dd
d     = 0.9;            #depth in mm
dl    = 0.01;           #accuracy of length ranging -dl to +dl
l     = 45;             #length in mm
x     = 0.2;            #modulus of rigidity(dE/E) in %
dy    = 0.1;            #accuracy of deflection ranging -dy to +dy
y     = 1.8;            #deflection in mm

#calculations 
f    = (x+(db/float(b))+(3*(dd/float(d)))+(3*(dl/float(l)))+(dy/float(y)));     #limiting error in force(dF/F) ranging -f to +f in %

#result
print'limiting error in force %3.4f'%f,'%';
limiting error in force 0.2918 %

Example:1.47,Page No:79

In [86]:
import math

#variable declaration
F    = 4.26;                  #force at the end of torque arm in kg
dF   = 0.02;                  #error in force ranging -dF to +dF in kg 
L    = 382;                   #length of torque arm in mm
dL   = 1.2;                   #error in length ranging -dL to +dL in mm
R    = 1192;                  #number of revolutions during time t
dR   = 1.0;                   #error in number of revolutions 
t    = 60;                    #time for test run in s
dt   = 0.5;                   #error in time in s

#calculations
P   = (2*math.pi*9.81*F*L*R)/float(t*10**6);      #magnitude of power in kW
p   = ((dF/float(F))+(dL/float(L))+(dR/float(R))+(dt/float(t)));   #limiting error(dP/P) computed ranging -p to +p
dp  = p*P;                              #limiting error in kW
Pmax  = P+dp;                           #maximum value of power in kW
Pmin  = P-dp;                           #minimum value of power in kW

#result
print'magnitude of power = %3.3f'%P,'kW';
print'magnitude of limiting error %3.4f'%dp,'kW';
print'magnitude of limiting error can lie between %3.2f'%Pmax,'and %3.2f'%Pmin,'kW';
magnitude of power = 1.993 kW
magnitude of limiting error 0.0339 kW
magnitude of limiting error can lie between 2.03 and 1.96 kW

Example:1.48,Page No:80

In [87]:
import math

#variable declaration
I    = 26.5;                    #current in A
Ix   = 1.1;                     #ammeter reading was low  by Ix
R    = 0.12;                    #resistance in Ω
Rx   = 0.25;                    #resistance reading was high by Rx

#calculations
It   = I*((1+(Ix/float(100))));      #true value of current in A
Rt   = R*((1-(Rx/float(100))));      #true value of resistance in Ω
Pt   = (It**2)*Rt;                   #true value of power in W
Pm   = (I**2)*R;                     #measured value of power in W
P    = (Pt/float(Pm))*100;           #power percentage of that originally calculated in %

#result
print'power percentage to original power %3.2f'%P,'%';
power percentage to original power 101.96 %

Example:1.49,Page No:87

In [88]:
import math

#varioable declaration
q1     = 1.34;                 #micrometer reading in mm
q2     = 1.38;                #micrometer reading  in mm
q3     = 1.56;                #micrometer reading in mm
q4     = 1.47;                #micrometer reading in mm
q5     = 1.42;                #micrometer reading in mm
q6     = 1.44;                #micrometer reading in mm
q7     = 1.53;                #micrometer reading in mm
q8     = 1.48;                #micrometer reading in mm
q9     = 1.40;                #micrometer reading in mm
q10    = 1.59;                #micrometer reading in mm
n      = 10;                  #number of readings

#calculations
q   = (q1+q2+q3+q4+q5+q6+q7+q8+q9+q10)/float(10);    #arthmetic mean in mm
d1  = q1-q;                         #derivation in mm
d2  = q2-q;                         #derivation in mm
d3  = q3-q;                         #derivation in mm
d4  = q4-q;                         #derivation in mm
d5  = q5-q;                         #derivation in mm
d6  = q6-q;                         #derivation in mm
d7  = q7-q;                         #derivation in mm
d8  = q8-q;                         #derivation in mm
d9  = q9-q;                         #derivation in mm
d10  = q10-q;                         #derivation in mm
d    = (abs(d1)+abs(d2)+abs(d3)+abs(d4)+abs(d5)+abs(d6)+abs(d7)+abs(d8)+abs(d9)+abs(d10))/float(n);  #average deviation in mm
s    = math.sqrt(((d1**2)+(d2**2)+(d3**2)+(d4**2)+(d5**2)+(d6**2)+(d7**2)+(d8**2)+(d9**2)+(d10**2))/float(n-1)); #standard deviation in mm
V    = s**2;              #variance in mm**2

#result
print'arthimetic mean %3.3f'%q,'mm';
print'average deviation %3.3f'%d;
print'standard deviation %3.5f'%s,'mm';
print'variance %3.5f'%V,'mm**2';
arthimetic mean 1.461 mm
average deviation 0.065
standard deviation 0.08075 mm
variance 0.00652 mm**2

Example:1.50,Page No:88

In [90]:
import math

#variable declaration
q1     = 412;               #resonant frequency in KHz
q2     = 428;               #resonant frequency in KHz
q3     = 423;               #resonant frequency in KHz
q4     = 415;               #resonant frequency in KHz
q5     = 426;               #resonant frequency in KHz
q6     = 411;               #resonant frequency in KHz
q7     = 423;               #resonant frequency in KHz
q8     = 416;               #resonant frequency in KHz
n      = 8;                 #number of readings 

#calculations
q   = (q1+q2+q3+q4+q5+q6+q7+q8+q9+q10)/float(n);        #arthimetc mean in khz
d1  = q1-q;                            #deviation in kHz
d2  = q2-q;                            #deviation in kHz
d3  = q3-q;                            #deviation in kHz
d4  = q4-q;                            #deviation in kHz
d5  = q5-q;                            #deviation in kHz
d6  = q6-q;                            #deviation in kHz
d7  = q7-q;                            #deviation in kHz
d8  = q8-q;                            #deviation in kHz
d    = (abs(d1)+abs(d2)+abs(d3)+abs(d4)+abs(d5)+abs(d6)+abs(d7)+abs(d8))/float(n);           #average deviation in kHz
s    = math.sqrt(((d1**2)+(d2**2)+(d3**2)+(d4**2)+(d5**2)+(d6**2)+(d7**2)+(d8**2))/float(n-1));   #standard deviation in k Hz
V    = s**2;                                     #variance in (kHz)**2

#result
print'arthimetic mean %3.2f'%q,'kHz';
print'average deviation %3.2f'%d,'kHz';
print'standard deviation %3.2f'%s,'kHz';
print'variance %3.2f'%V,'kHz**2';
arthimetic mean 419.62 kHz
average deviation 5.75 kHz
standard deviation 6.55 kHz
variance 42.95 kHz**2

Example:1.51,Page No:94

In [92]:
import math

#varioable declaration
q1     = 39.6;                       #temperature reading °C
q2     = 39.9;                       #temperature reading °C
q3     = 39.7;                       #temperature reading °C
q4     = 39.9;                       #temperature reading °C
q5     = 40.0;                       #temperature reading °C
q6     = 39.8;                       #temperature reading °C
q7     = 39.9;                       #temperature reading °C
q8     = 39.8;                       #temperature reading °C
q9     = 40.4;                       #temperature reading °C
q10    = 39.7;                       #temperature reading °C
n      = 10;                         #number of observations

#calculations
q   = (q1+q2+q3+q4+q5+q6+q7+q8+q9+q10)/float(10);         #arthimetic mean in °C
d1  = q1-q;                    #deviation in °C
d2  = q2-q;                    #deviation in °C
d3  = q3-q;                    #deviation in °C
d4  = q4-q;                    #deviation in °C
d5  = q5-q;                    #deviation in °C
d6  = q6-q;                    #deviation in °C
d7  = q7-q;                    #deviation in °C
d8  = q8-q;                    #deviation in °C
d9  = q9-q;                    #deviation in °C
d10  = q10-q;                     #deviation in °C
R1   = 40.4;                     #maximum value of temperature in °C
R2   = 39.6;                     #minimum value of temperature in °C
s    = math.sqrt(((d1**2)+(d2**2)+(d3**2)+(d4**2)+(d5**2)+(d6**2)+(d7**2)+(d8**2)+(d9**2)+(d10**2))/float(n-1));   #standard deviation in °C
r1   = 0.6745*s;                  #probable error of one reading in °C
rm   = r1/math.sqrt(float(n-1));   #probable error of mean in °C
R    = R1-R2;                       #range in °C
#result
print'arthimetic mean %3.2f'%q,'°C';
print'standard deviation %3.5f'%s,'°C';
print'probable error = %3.2f'%r1,'°C';
print'probable error of mean %3.2f'%rm,'°C';
print'range %3.2f'%R,'°C';
arthimetic mean 39.87 °C
standard deviation 0.22136 °C
probable error = 0.15 °C
probable error of mean 0.05 °C
range 0.80 °C

Example:1.52,Page No:96

In [94]:
import math

#variable declaration
T1  = 197;                       #temperature reading °C
T2  = 198;                       #temperature reading °C
T3  = 199;                       #temperature reading °C
T4  = 200;                       #temperature reading °C
T5  = 201;                       #temperature reading °C
T6  = 202;                       #temperature reading °C
T7  = 203;                       #temperature reading °C
T8  = 204;                       #temperature reading °C
T9  = 205;                       #temperature reading °C
f1  = 2;                         #frequency of occurence 
f2  = 4;                         #frequency of occurence 
f3  = 10;                         #frequency of occurence 
f4  = 24;                         #frequency of occurence 
f5  = 36;                         #frequency of occurence 
f6  = 14;                         #frequency of occurence 
f7  = 5;                          #frequency of occurence 
f8  = 3;                          #frequency of occurence 
f9  = 2;                          #frequency of occurence 


#calculations
t1  = T1*f1;
t2  = T2*f2;
t3  = T3*f3;
t4  = T4*f4;
t5  = T5*f5;
t6  = T6*f6;
t7  = T7*f7;
t8  = T8*f8;
t9  = T9*f9;
n   = (f1+f2+f3+f4+f5+f6+f7+f8+f9);    
AM  = (t1+t2+t3+t4+t5+t6+t7+t8+t9)/float(n);   #arthimetic mean in °C
tf  = (t1+t2+t3+t4+t5+t6+t7+t8+t9)/float(n);
d1  = T1-tf;
d2  = T2-tf;
d3  = T3-tf;
d4  = T4-tf;
d5  = T5-tf;
d6  = T6-tf;
d7  = T7-tf;
d8  = T8-tf;
d9  = T9-tf;
x1  = d1*f1;
x2  = d2*f2;
x3  = d3*f3;
x4  = d4*f4;
x5  = d5*f5;
x6  = d6*f6;
x7  = d7*f7;
x8  = d8*f8;
x9  = d9*f9;
x   = abs(x1)+abs(x2)+abs(x3)+abs(x4)+abs(x5)+abs(x6)+abs(x7)+abs(x8)+abs(x9);
y1  = f1*(d1**2);
y2  = f2*(d2**2);
y3  = f3*(d3**2);
y4  = f4*(d4**2);
y5  = f5*(d5**2);
y6  = f6*(d6**2);
y7  = f7*(d7**2);
y8  = f8*(d8**2);
y9  = f9*(d9**2);
y   = y1+y2+y3+y4+y5+y6+y7+y8+y9;
sigma  = x/float(n);                 #average deviation in °C
sd     = math.sqrt(y/float(n));      #standard deviation in °C
V      = sd**2;                      #variance in  °C**2
r1     = 0.6745*sd;                  #probable error of one reading in  °C
rm     = r1/float(math.sqrt(n));     #probable error of mean in  °C
sigmam = sd/float(math.sqrt(n));       #standard deviation of the mean  in °C
sigmasd = sigmam/float(math.sqrt(2));   #standard deviation of standard deviation in  °C

#result
print'arthimetic mean = %3.2f'%AM,'°C';
print'average deviation = %3.3f'%sigma,'°C';
print'standard deviation = %3.3f'%sd,'°C';
print'variance = %3.3f'%V,'°C**2';
print'probable error of one reading = %3.0f'%r1,'°C';
print'probable error of the mean = %3.1f'%rm,'°C';
print'standard deviation of the standard deviation = %3.4f'%sigmasd,'°C';
arthimetic mean = 200.77 °C
average deviation = 1.096 °C
standard deviation = 1.482 °C
variance = 2.197 °C**2
probable error of one reading =   1 °C
probable error of the mean = 0.1 °C
standard deviation of the standard deviation = 0.1048 °C

Example:1.53,Page No:97

In [96]:
import math

#variable declaration
I     = 80;                           #current in A
p     = 0.2;                          #p(y) value given 
x     = 0.8;                          #probabiltiy of error             
y     = 0.5248;                        #y valu from probability tables for sorresponding p(y) value
x1    = 1.2;                          #probabiltiy of error

#calculation
sigma     = (x/float(y));             #standard eviation
y1        = x1/float(sigma);         
#p(y) value corresponding to y1 value from probabitiy table is 0.2842
p1         = 0.2842;
P          = (2*p1)*100;                             #probabity of an error 

#result
print'thus about %3.0f'%P,'% of readings are within -1.2A to 1.2A of the true value';
thus about  57 % of readings are within -1.2A to 1.2A of the true value

Example:1.54,Page No:97

In [99]:
import math

#variable declaration
x1  =25;                  #deflaction in mm
x2  = 21.9;               #deflaction in mm
r   = 2.1;                #probable error  in mm

#calculations
x      = x1-x2;               #deviation in mm
sigma  = r/float(0.6745);     #standard deviation
y      = x/float(sigma);      #ratio 
n      = 2*0.341*100;     
ne     = 100-n;               #number of readings exceeding a deviation of 3.1
nx     = ne/float(2);         #number of readings exceeding maximum deflection of 25mm in mm

#result
print'number of readings exceeding maximum deflection of 25mm is %3.0f'%nx,'mm';
number of readings exceeding maximum deflection of 25mm is  16 mm

Example:1.55,Page No:98

In [100]:
import math

#variable declaration
#in case of me of normal distribution .thereis equal probability of +ve and -ve errors
n1   = 5000;                        #number of rods having length greater than 20 mm
n2   = 1000;                        #number of rods having length greater than 20.25 mm
n3   = 5000;                        #number of rods having length smaller than 20 mm
y    = 1.3;                         #from probability tables ,corresponding to the probability of p(y)                                          
x1   = 20.25;                       #maximum length of rod ,that should not be exceed in mm
x2   = 20.0;                        #nominal length in mm
x4   = 19.5;                        #minimum length of rod ,that should not be smmaler than this value in mm
y2   = 0.4953;                      #from probability tables ,corresponding to the y value  

#calculations
n4    = n1-n2;                          #number of rods wehere length lies between 20mm and 20.25
x    = x1-x2;                           #probability that 4000 rods have a value greater than 20mm and less than 20.25mm
sigma  = x/float(y);                    #standard deviation
y1     = (x2-x4)/float(sigma);          #y value for with nominal length of 19.5mm and 20mm
n      = (n1+n3)*y2;                    #number of rods that have lengths between 19.5 and 20mm
N      = n+n4;                          #total number of rods whose length between specified limits         

#result
print'total number of rods whose length between specified limits is %3.0f'%N;
total number of rods whose length between specified limits is 8953

Example:1.56,Page No:98

In [102]:
import math

#variable declaration
q    = 1515;         #tachometer reading in rpm
q1   = 1500;         #tachometer reading in rpm
h    = 0.04;         #precision index
p    = 0.3015;       #p(y) value from probability table corresponding to  y value
n    =20;            #number of readings

#calculations
x      = q-q1;                        #deviation in r.p.m(indicates in both -ve and +ve value)
sigma  = 1/float((math.sqrt(2))*h);   #standard deviation
y      = x/float(sigma);              
#p(y) from probability table is 0.3015
p     = 2*p;                           #probability of an error
N     = p*n;                           #number of redings

#result
print'we expect %3.2d'%N,'readings to lie between 1485 to 1515 rpm';
we expect  12 readings to lie between 1485 to 1515 rpm

Example:1.57,Page No:99

In [105]:
import math

#variable declaration
d    = 15;              #nominal depth of water in cm
n    = 40;              #total number of times the measurements taken
n1   = 10;              #number of measurement reading found to lie outside a particular range 
h    = 9;               #precision index in cm**-1
y    = 1.15;             #from probability table corresponding value of p(y)

#calculations
P     = (n-n1)/float(n);                  #probability of falling within a particular range 
p1     = P/float(2);                      #half of these measiurements  have a +ve and half have -ve errors
sigma  = 1/float((math.sqrt(2))*h);       #standard defviation
x     = y*sigma;                      
Rmax  = d+x;
Rmin  = d-x;

#result
print'Thus 75 percent of depth measurements lie within th range %3.2f'%Rmax,'and -%3.2f'%Rmin,'cm';
Thus 75 percent of depth measurements lie within th range 15.09 and -14.91 cm

Example:1.58,Page No:100

In [107]:
import math

#variable declaration
py1  = 0.45;             #py1 is p(y) given data
y     = 0.675;           #from probavility table corresponding to p(y) value
x     = 4.8;             
q     = 100;             #fixed mass flow rate in kg/s
q1    = 88;              #flow meter reading in kg/s
n     = 30;              #number of days in  november month
n1    = 4;               #number of times flow is checked in a day
x1     = 0.5;              #overall probabilty         
y2   = 1.96;             #y value corresponding to py ,from probability table

#calculations
sigma  = x/float(y);                         #standard deviation 
a      = (math.sqrt(2))*sigma;
h      = 1/float(a);                         #precision index
x1     = q-q1;
y1     = x1/float(sigma);                        #y value for masss flow rate of 88kg/s

#p(y) corresponding to y1 is 0.45

e      = 0.5-py1;                               #amount it fall into false alarms    
N      = n*n1;                                  #number of measurements in themonth of november
E      = e*N;                                   #expected false alarms
E1     = x*E;                                   #reduced number of flase alarms
P      = E1/float(N);                           #probability of false alarms
py     = 0.5-P;                                 #probability of datato lie in tolerent band
sigma1  = x1/float(y2);                         #standard deviation
h1      = 1/float((math.sqrt(2))*sigma1);       #precision index


#result
print'precision index %3.3f'%h;
print'number of false alarms %3.2f'%E;
print'precision index %3.4f'%h1;
precision index 0.099
number of false alarms 6.00
precision index 0.1155

Example:1.59,Page No:103

In [109]:
import math

#varioable declaration
q1     = 5.30;                       #length in cm
q2     = 5.73;                       #length in cm
q3     = 6.77;                       #length in cm
q4     = 5.26;                       #length in cm
q5     = 4.33;                       #length in cm
q6     = 5.45;                       #length in cm
q7     = 6.09;                       #length in cm
q8     = 5.64;                       #length in cm
q9     = 5.81;                       #length in cm
q10    = 5.75;                       #length in cm
n      = 10;                         #number of copper wires

#calculations
q   = (q1+q2+q3+q4+q5+q6+q7+q8+q9+q10)/float(10);         #arthimetic mean in cm
d1  = q1-q;                    #deviation in cm
d2  = q2-q;                    #deviation in cm
d3  = q3-q;                    #deviation in cm
d4  = q4-q;                    #deviation in cm
d5  = q5-q;                    #deviation in cm
d6  = q6-q;                    #deviation in cm
d7  = q7-q;                    #deviation in cm
d8  = q8-q;                    #deviation in cm
d9  = q9-q;                    #deviation in cm
d10  = q10-q;                     #deviation in cm
s    = math.sqrt(((d1**2)+(d2**2)+(d3**2)+(d4**2)+(d5**2)+(d6**2)+(d7**2)+(d8**2)+(d9**2)+(d10**2))/float(n-1));   #standard deviation in cm 
x1   = abs(d1)/float(s);        #ratio of deviation to standard deviation
x2   = abs(d2)/float(s);        #ratio of deviation to standard deviation
x3   = abs(d3)/float(s);        #ratio of deviation to standard deviation
x4   = abs(d4)/float(s);        #ratio of deviation to standard deviation
x5   = abs(d5)/float(s);        #ratio of deviation to standard deviation
x6   = abs(d6)/float(s);        #ratio of deviation to standard deviation
x7   = abs(d7)/float(s);        #ratio of deviation to standard deviation
x8   = abs(d8)/float(s);        #ratio of deviation to standard deviation
x9   = abs(d9)/float(s);        #ratio of deviation to standard deviation
x10   = abs(d10)/float(s);        #ratio of deviation to standard deviation

#result
print'It is given that for 10 readings  the ratio of deviation to standard deviation is not to exceed 1.96';
print'therfore x5 = %3.2f'%x5,'which is greater than 1.96,reading  %3.2f should be rejected'%q5;
It is given that for 10 readings  the ratio of deviation to standard deviation is not to exceed 1.96
therfore x5 = 2.05 which is greater than 1.96,reading  4.33 should be rejected

Example:1.60,Page No:105

In [111]:
import math

#variable declaration
u1   = 1.8;             #initial velocity
u2   = 4.6;             #initial velocity
u3   = 6.6;             #initial velocity
u4   = 9.0;             #initial velocity
u5   = 11.4;             #initial velocity
u6   = 13.4;             #initial velocity
n    = 6;
v1   = 2.2;             #final velocity
v2   = 3.2;             #final velocity
v3   = 5.2;             #final velocity
v4   = 6.4;             #final velocity
v5   = 8.0;             #final velocity
v6   = 10.0;             #final velocity

#calulations
w1     = u1*v1;
w2     = u2*v2;
w3     = u3*v3;
w4     = u4*v4;
w5     = u5*v5;
w6     = u6*v6;
x1     = u1**2;
x2     = u2**2;
x3     = u3**2;
x4     = u4**2;
x5     = u5**2;
x6     = u6**2;
u      = u1+u2+u3+u4+u5+u6;
v      = v1+v2+v3+v4+v5+v6;
w      = w1+w2+w3+w4+w5+w6;
x      = x1+x2+x3+x4+x5+x6;
a      = ((n*w)-(u*v))/float((n*x)-(u**2));
b      = ((v*x)-(w*u))/float((n*x)-(u**2));
y1     = (((a*u1)+b-v1)**2);
y2     = (((a*u2)+b-v2)**2);
y3     = (((a*u3)+b-v3)**2);
y4     = (((a*u4)+b-v4)**2);
y5     = (((a*u5)+b-v5)**2);
y6     = (((a*u6)+b-v6)**2);
y      = y1+y2+y3+y4+y5+y6;
Sv     = math.sqrt(y/float(n));                              #standard deviation indicate sboth -ve and +ve values
Su     = Sv/float(a);                                        #standard deviation indicate sboth -ve and +ve values
Sa     = (math.sqrt((n)/float(abs((n*x)-(u**2)))))*Sv;                    #standard deviation indicate sboth -ve and +ve values
Sb     = (math.sqrt((x)/float(abs((n*x)-(u**2)))))*Sv;                    #standard deviation indicate sboth -ve and +ve values


#result
print'linear equation %3.3f'%a,'u +%3.3f'%b;
print'standard deviation = %3.2f'%Sv;
print'standard deviation = %3.2f'%Su;
print'standard deviation = %3.2f'%Sa;
print'standard deviation = %3.2f'%Sb;
linear equation 0.672 u +0.591
standard deviation = 0.34
standard deviation = 0.51
standard deviation = 0.04
standard deviation = 0.31

Example:1.61,Page No:106

In [113]:
import math

#variable declaration
u1   = 550;             #initial velocity
u2   = 700;             #initial velocity
u3   = 850;             #initial velocity
u4   = 1000;             #initial velocity
n    = 4;
v1   = 0.04182;             #final velocity
v2   = 0.04429;             #final velocity
v3   = 0.05529;             #final velocity
v4   = 0.0610;             #final velocity

#calulations
#P   = ((a)*(f**2))+(b*f)
#P/f  = (a*f)+b
w1     = u1*v1;
w2     = u2*v2;
w3     = u3*v3;
w4     = u4*v4;
x1     = u1**2;
x2     = u2**2;
x3     = u3**2;
x4     = u4**2;
u      = u1+u2+u3+u4;
v      = v1+v2+v3+v4;
w      = w1+w2+w3+w4;
x      = x1+x2+x3+x4;
a      = ((n*w)-(u*v))/float((n*x)-(u**2));
b      = ((v*x)-(w*u))/float((n*x)-(u**2));


#result
print'Best fit equation %3.3e'%a,'f**2 +%3.3e f'%b,'mW';
Best fit equation 4.569e-05 f**2 +1.519e-02 f mW

Example:1.62,Page No:108

In [114]:
import math

#variable declaration
q1  = 50;                  #measuremnent in series in units
q2  = 100;                  #measuremnent in series in units
x   = 0.02;                 #error in measurement of q1
y   = 0.01;                 #error in measurement of q2
a   = 1;                    #x % of 50
b   = 1;                    #y % of 100


#calculations
e1   = (q1*x)/float(q1+q2);              #individual limiting errors
e2   = (q2*y)/float(q1+q2);             #individual limiting errors
e    = (e1+e2)*100;                     #combined limiting errors in % (indicates both -ve and +ve values)
er  = (math.sqrt((a**2)+(b**2)));      #resultant error 
er1  = (er/float(q1+q2))*100;          #standard deviation in %

#result
print'limiting error %3.2f'%e,'%';
print'standard deviations %3.3f'%er1,'%';
limiting error 1.33 %
standard deviations 0.943 %

Example:1.63,Page No:116

In [117]:
import math

#variable declaration
Rm  =2.5;                #resistance in Ω
Im  = 0.1;               #current in A
V   = 10;                #voltage in V
I   = 10;                #ammeter reading in A

#calculations
Rs   = (V/float(Im))-Rm;           #series resistance in Ω
Rsh  = (Im*Rm)/float(I-Im);        #shunt resistance in Ω

#result
print'series resistance %3.1f'%Rs,'Ω';
print'shunt resistance %3.5f'%Rsh,'Ω';
series resistance 97.5 Ω
shunt resistance 0.02525 Ω

Example:1.64,Page No:116

In [118]:
import math

#variable declaration
Rm   = 10;             #resistance in Ω
Im   = 0.005;          #current in A
I    = 1;              #current in A
V    = 5;              #voltage in V

#calculations
Rsh   = (Im*Rm)/float(I-Im);             #shunt resistance in Ω
Rs    = (V-(Im*Rm))/float(Im);           #series resistance in Ω

#result
print'shunt resistance %3.5f'%Rsh,'Ω';
print'series resistance %3.0f'%Rs,'Ω';
shunt resistance 0.05025 Ω
series resistance 990 Ω

Example:1.65,Page No:117

In [119]:
import math

#variable declaration
N     = 100;        #number of turns 
l     = 0.03;       #length of each side in m
B     = 0.09;       #flux density in Wb/m**2
I     = 0.01;       #current through the coil in A


#calculation
F   = N*B*I*l;                       #force in N
T   = F*l;                           #deflecting torque in N-m

#result
print'deflecting torque %3.1e'%T,'N-m';
deflecting torque 8.1e-05 N-m

Example:1.66,Page No:118

In [120]:
import math

#variable declaration
Rm    = 5;             #resistance in Ω
Im    = 0.015;         #current through instrument in A
I     = 100;           #current to be measured in A
alpham  = 0.00015;     #manganin in °C
alphac  = 0.004;       #copper in °C
R1      = 1;           #reistance of copper in Ω
R2      = 4;           #reistance of manganin in Ω
T       = 20;          #temperature in °C
 
#calculations
Ish    = I-Im;                                #current through shunt in A
v      = Im*Rm;                               #voltage across the shunt in V
Rsh    = v/float(Ish);                        #shunt resistance in Ω 
Rshunt = Rsh*(1+(T*alpham));                  #shunt resistance after rise of temperature  in Ω 
Rinst  = Rm*(1+(T*alphac));                   #instrument resistance in Ω 
i      = (Rshunt/float(Rinst+Rshunt))*100;    #current through instrument in A
R      = (i/float(Im))*100;                   #reading of instrument in A
e      = I-R;                                 #percentage error 
Rinst1  = R1*(1+(T*alphac))+R2*(1+(T*alpham)); #instrument resistance in Ω    
Iinst   = (Rshunt/float(Rinst1+Rshunt))*100;   #instrument current in A
Iread   = (Iinst*100)/float(Im);               #instrument reading in A
e1      = I-Iread;                             #percentage error 
#result
print'percentage error when internal resiatance is 5Ω is %3.2f'%e;
print'percentage error after rise of temperature %3.1f'%e1;
percentage error when internal resiatance is 5Ω is 7.13
percentage error after rise of temperature 1.5

Example:1.67,Page No:118

In [121]:
import math

#variable declaration
V     = 250;                #voltage in V
R     = 500;                #resistance in Ω
L     = 1;                  #inductance in H
I     = 0.05;               #current in A
f     = 100;                #frequency  in Hz

#calculations
R1   = V/float(I);                                 #total ohmic resistance in Ω
Z    = math.sqrt((R1**2)+((2*math.pi*f*L)**2));    #coil impedance in Ω
Vr   = (V*R1)/float(Z);                            #voltage reading in A.c
e    = ((V-Vr)/float(V))*100;                      #percentage error in %

#result
print'percentage error %3.1f'%e,'%';
percentage error 0.8 %

Example:1.68,Page No:119

In [122]:
import math

#variable declaration
R      = 300;                #resistance in Ω
L      = 0.12;               #inductance in H
f      = 25;                 #frequency in Hz
I      = 15;                 #current in A
f1     = 100;                 #frequency in Hz


#calculations
Z    = math.sqrt((R**2)+((2*math.pi*f*L)**2));       #impedance at 25Hz in Ω
V    = I*(R/float(Z));                               #voltmeter reading at 25 Hz in V
Z1   = math.sqrt((R**2)+((2*math.pi*f1*L)**2));       #impedance at 100Hz in Ω      
V1    = I*(R/float(Z1));                              #voltmeter reading at 100Hz in V

#result
print'voltmeter reading at 25Hz frequency %3.2f'%V,'V';
print'voltmeter reading at 100Hz frequency %3.2f'%V1,'V';
print'As frequency is increased ,impedance of the voltmeter increases ,hence current is decreased';
print'therefore voltmeter readings are lower';
voltmeter reading at 25Hz frequency 14.97 V
voltmeter reading at 100Hz frequency 14.55 V
As frequency is increased ,impedance of the voltmeter increases ,hence current is decreased
therefore voltmeter readings are lower

Example:1.69,Page No:132

In [123]:
import math

#variable declaration
W1   =920;       #wattmeter reading in W
W2   =300;       #wattmeter reading in W

#calculations
phi   = math.atan(((math.sqrt(3))*(W1-W2))/(float(W1+W2)))*(180/float(math.pi));    
pf    = math.cos((phi)*(math.pi/float(180)));                                       #power factor 

#result
print'power factor of the motor %3.2f'%pf,'(lag)';
power factor of the motor 0.75 (lag)

Example:1.70,Page No:132

In [124]:
import math

#variable declaration
W1   =14.2;       #wattmeter reading in W
W2   =-6.1;       #wattmeter reading in W 
El    = 440;       #line voltage in V
P    = 8.1*1000;    #power in W

#calculations
phi   = math.atan(((math.sqrt(3))*(W1-W2))/(float(W1+W2)))*(180/float(math.pi));    #phase lag
pf    = math.cos((phi)*(math.pi/float(180)));     #power factor 
Il     = P/float((math.sqrt(3))*(El)*(pf));      #line current in A

#result
print'power factor of the motor %3.2f'%pf,'(lag)';
print'line current %3.2f'%Il,'A';
power factor of the motor 0.22 (lag)
line current 47.34 A

Example:1.71,Page No:132

In [125]:
import math

#variable declaration
P    = 25;                   #input power in kW
El    = 440;                  #line voltage in 
pf    = 0.6;         #power factor

#calculations
phi  = ((math.acos(pf))*180)/float(math.pi);
t    = (math.tan((phi)*(math.pi/float(180))));
#we have tan = math.sqrt(3)*(W1-W2)/W1+W2
#W1+W2 =E
y    = (P*t)/float(math.sqrt(3));
W1    = (P+y)/float(2);
W2    = (P-y)/float(2);

#result
print'W1 = %3.2f'%W1,'kW';
print'W2 = %3.2f'%W2,'kW';
W1 = 22.12 kW
W2 = 2.88 kW

Example:1.72,Page No:134

In [126]:
import math

#variable declaration
V       = 230;               #voltage in V
i       = 5;                 #current in A     
t       = 360;               #time in s
n       = 60;                #number of revolutions
n1      = 520;               #number of revolutions
cosphi  = 1;                 #power factor        

#calculations

E   =  (V*i*cosphi*t)/float(1000*3600);       #energy consumed in 360 seconds in kWh
Er  =  n/float(n1);                           #energy recorded by the meter in kWh
e   =  ((Er-E)/float(Er))*100;                #percentage error in %

#result

print'percentage error %3.2f'%(e),'%(fast)';
percentage error 0.33 %(fast)

Example:1.73,Page No:135

In [144]:
import math

#variable declaration
V       = 230;                #voltage in V
i       = 4.5;                #current in A
cosphi  = 1;
t       = 190;                  #time in s
n       = 10;                  #number of revolutions
n1      = 185;                 #number of revolutions

#calculations
E   =  (V*i*cosphi*t)/float(1000*3600);       #energy consumed in 360 seconds in kWh
Er  =  n/float(n1);                           #energy recorded by the meter in kWh
e   =  ((E-Er)/float(Er))*100;                #percentage error in %

#result
print'percentage error %3.4f'%(e),'%';
print'Note:Ans printing mistake in textbook'
percentage error 1.0562 %
Note:Ans printing mistake in textbook

Example:1.74,Page No:135

In [145]:
import math

#variable declaration
x   = 150;       #number of revolutions
t   = 45;        #time in s


#calculations
p   = 1*(x/float(15000));            #power metered in kWh
a   =t/float(3600);                  #energy consumed in t seconds in times of P
P   = p/float(a);                    #power in the circuit in W

#result
print'power in the circuit %3.0f'%(P*1000),'W';
power in the circuit 800 W

Example:1.75,Page No:135

In [146]:
import math

#variable declaration
V   = 230;                         #D.C supply in V
r   = 225;                         #number of revolutions
i   = 40*225;                      #meter reading in A-s
t   =10;                           #time in minutes
l   = 14;                          #current in A


#calculations
L    = i/float(10*60);            #current in A
E    = (V*L*t)/float(1000*60);    #energy recorded in kWh
Ea   = (V*l*t)/float(1000*60);    #actual energy consumed kWh
e    = ((E-Ea)/float(E))*100;     #percentage error in %

#result
print'energy recorded %3.3f'%E,'kWh';
print'actual energy consumed  %3.4f'%Ea,'kWh';
print'percentage error %3.2f'%e,'%'
energy recorded 0.575 kWh
actual energy consumed  0.5367 kWh
percentage error 6.67 %