#precision of the 5th measurement
#given data :
X1=98.0
X2=101.0
X3=102.0
X4=97.0
X5=101.0
X6=100.0
X7=103.0
X8=98.0
X9=106.0
X10=99.0
Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10
Xn=101 # value of 5th measurement
P=(1-abs((Xn-Xn_bar)/Xn_bar))*100
print "Precision of the 5th measurement, P = ", round(P,2), " %"
#Absolute error
#given data :
Ae=80.0 # in V
Am=79.0 # in V
e=Ae-Am
print "Absolute error, e = ", e, " V"
#Error
#given data :
Ae=80.0 # in V
Am=79.0 # in V
e=Ae-Am
error1=(e/Ae)*100
print "Error = ", error1, " %"
#Relative accuracy
#given data :
Ae=80.0 # in V
Am=79.0 # in V
e=Ae-Am
error1=(e/Ae)*100
A=(1-abs(e/Ae))
print "Relative Accuracy, A = ", A
# % accuracy
#given data :
Ae=80.0 # in V
Am=79.0 # in V
e=Ae-Am
error1=(e/Ae)*100
A=(1-abs(e/Ae))
accuracy=A*100
print "Accuracy = ", accuracy, " %"
# % error
#given data :
Ae=80.0 # in V
Am=79.0 # in V
e=Ae-Am
f=100.0 #full scale deflection
error1=(e/Ae)*100
A=(1-abs(e/Ae))
accuracy=A*100
P_error=(e/f)*100
print "% error = ", P_error, " %"
#Maximum error
#given data :
V1=100.0 # in V
V2=200.0 #in V
V=V2-V1
A=0.25 #may be ± in %
max_error=(A/100)*V
print "Maximum error = ± ", max_error, " V"
# sensitivity and deflection error
#given data :
C=4.0 # change in output in mm
M=8.0 # magnitude of input in ohm
S=C/M
print "sensitivity, S = ", S, " mm/ohm"
D=M/C
print "Deflection factor, D = ", D, " ohm/mm"
#Resolution
#given data :
V=200.0 # full scale reading in V
N=100.0 # number of divisions
Scale_div=V/N
R=(1.0/10)*Scale_div
print "Resolution, R = ", R, " V"
#Resolution
#given data :
V=9.999 # full scale read out in volt
c=9999.0 # range from 0 to 9999
R=(1/c)*V*10**3
print "Resolution, R = ", R, " mV"
#Magnitude and relative error
#given data :
R1=15.0 #ohm
E1=R1*5.0/100 # ± limiting error for R1
R2=33.0 #ohm
E2=R2*2.0/100 # ± limiting error for R2
R3=75.0 #ohm
E3=R3*5.0/100 # ± limiting error for R3
RT=R1+R2+R3 # ohm(in series)
ET=E1+E2+E3 #±limiting error for RT
print "For series connection, magnitude is ", RT, " ohm & limiting error is ± ", ET, " ohm."
Epr=ET/RT*100 #%
print "Percent relative error : ±", round(Epr,1)," %"
# Answer is not accurate in the textbook.
#Magnitude and relative error
#given data :
R1=36.0 #ohm
E1=5.0 # ± limiting error for R1
R2=75.0 #ohm
E2=5.0 # ± limiting error for R2
RT=(R1*R2)/(R1+R2) #ohm(in parallel)
EP1=E1+E2 # ± limiting error
EP2=((R1*E1)/(R1+R2))+((R2*E2)/(R1+R2))
ET=EP1+EP2
etm=(ET/100)*RT
print "Magnitude of limiting error is ±", round(etm,2), " ohm"
print "Percentage relative error is ±", ET, " %"
# Limiting error
vr=40.0 #reading of voltmeter in volts
v=50.0 #rane in volts
va=50.0 #ammeeter reading in mA
i=125.0 #range in mA
fsd=2.0 #accurace in percentage in ±
dv=(2.0/100)*v #limiting error of voltmeter
da=(2./100)*i #liming error of the ammeter in mA
erv=dv/vr #relative limiting error in voltmeter reading
eri=da/i #relative limiting error in ammeter reading
et=erv+eri
pet=et*100 #percentage limiting error of the power calcultaed
print "Percentage limiting error of the power calcultaed is ± ",pet," %"
# limiting error
r1=120.0 # ohm
er1=0.5 #limiting error in resistance 1 in ohm ±
r2=2 #in A
er2=0.02 #limiting error in amperes ±
e1=er2/r2 #limiting error in current
e2=er1/r1 #limiting eror in resistance
et=(2*e1+e2) #total error
etp=et*100 #percentage limtimg error
print "Percentage limiting error in the value of power dissipation is ±",round(etp,3)
#magnitude and limiting error
r1=120 #in ohm
er1=0.1 #limiting error in resistance 1 in ohm ±
r2=2700 #in ohm
er2=0.5 #limiting error in resistance 2 in ohm ±
r3=470 #in ohm
er3=0.5 #limiting error in resistance 3 in ohm ±
rxm=(r2*r3)/r1 #magnitude of unknown resistance in ohm
rxe=(er1+er2+er3) #error
er=(rxe*rxm)/100 #relative error ±
print "Magnitude of unknown resistance is ",rxm," kohm"
print "Relative limiting error is ±",er," ohm"
print "Guranteed value of resistance is between ",rxm-er, " ohm to " ,rxm+er," ohm"
# absolute error, % error, relative error, % accuracy and % error of full scale reading
#given data :
Ae=80.0 # in volt
Am=79 # in volt
fsd=100 #full scale reading in volt
e=Ae-Am
print "Absolute error, e = ",e," V"
error1=(e/Ae)*100
print "Error = ",error1," %"
A=1-abs(e/Ae)
print "Relative accuracy, A = ",A," %"
p_accuracy=A*100
print "% accuracy = ",p_accuracy," %"
error2=(e/fsd)*100
print "% error expressed as percentage of full scale reading = ",error2," %"
# limiting error
#given data :
fsd=100.0 # in V
A=1.0 # (+ve or -ve) in %
del_A=(A/100)*fsd
As=15.0 #in V
e1=del_A/As
e=e1*100
print "Limiting error, e = ",round(e,4)," %"
# limiting value of current and % limiting error
#given data :
As=2.5 # in A
fsd=10 #full scale reading in A
A=1.5/100
del_A=A*fsd
At1=As+del_A
At2=As-del_A
print "Limiting value of current, At1 = ",At1," A"
print "Limiting value of current, At2 = ",At2," A"
e=(del_A/As)*100
print "Percentage limiting error, e = ",e," %"
#ARITHEMATIC MEAN
import numpy
q=[49.7,50.1,50.2,49.6,49.7] #
AM= numpy.mean(q) #arithematic mean in mm
print "Arithematic mean is ",AM
#deviation
import numpy
q=[49.7,50.1,50.2,49.6,49.7] #
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM
print "Deviations of each value are : "
for dev in d:
print dev
#algebric sum of deviation
import numpy
q=[49.7,50.1,50.2,49.6,49.7] #
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM
dtotal=sum(d)
print "Algebric sum of deviation is", round(dtotal,4)
#standard deviation
import numpy
q=[49.7,50.1,50.2,49.6,49.7] #
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM
sigma=0
n=5 # no. of measurements
for dev in d:
sigma+=dev**2
sigma/=(n-1)
sigma**=(1.0/2)
print "Standard Deviation is ",round(sigma,2)
#ARITHEMATIC MEAN
import numpy
q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #
AM= numpy.mean(q) #arithematic mean in mm
print "Arithematic mean is ",AM," V"
#Deviation from mean
import numpy
q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM
print "Deviations of each value are : "
for dev in d:
print dev
#standard deviation
import numpy
q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1]
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM
sigma=0
n=10 # no. of measurements
for dev in d:
sigma+=dev**2
sigma/=(n-1)
sigma**=(1.0/2)
print "Standard Deviation is ",round(sigma,2)
#probable error
import numpy
q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1]
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM
sigma=0
n=10 # no. of measurements
for dev in d:
sigma+=dev**2
sigma/=(n-1)
sigma**=(1.0/2)
pe1=0.6745*sigma # Probable error of one reading
print "Probable error of one reading is ",pe1," V"
pm=pe1/(n-1)**(1.0/2)
print "Probable error of mean is ",round(pm,5)
#Arithmetic mean
#given data :
X1=147.2 # in nF
X2=147.4 # in nF
X3=147.9 # in nF
X4=148.1 # in nF
X5=148.1 # in nF
X6=147.5 # in nF
X7=147.6 # in nF
X8=147.4 # in nF
X9=147.6 # in nF
X10=147.5 # in nF
AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10
print "Arithmetic mean, AM = ",AM," nF"
# Average deviation
#given data :
n=10
X1=147.2 # in nF
X2=147.4 # in nF
X3=147.9 # in nF
X4=148.1 # in nF
X5=148.1 # in nF
X6=147.5 # in nF
X7=147.6 # in nF
X8=147.4 # in nF
X9=147.6 # in nF
X10=147.5 # in nF
AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n
d1=X1-AM
d2=X2-AM
d3=X3-AM
d4=X4-AM
d5=X5-AM
d6=X6-AM
d7=X7-AM
d8=X8-AM
d9=X9-AM
d10=X10-AM
Average_deviation=(abs(d1)+abs(d2)+abs(d3)+abs(d4)+abs(d5)+abs(d5)+abs(d6)+abs(d7)+abs(d8)+abs(d9)+abs(d10))/n
print "Average deviation = ",Average_deviation," nF"
# answer is wrong in book
#Standard deviation
#given data :
n=10
X1=147.2 # in nF
X2=147.4 # in nF
X3=147.9 # in nF
X4=148.1 # in nF
X5=148.1 # in nF
X6=147.5 # in nF
X7=147.6 # in nF
X8=147.4 # in nF
X9=147.6 # in nF
X10=147.5 # in nF
AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n
d1=X1-AM
d2=X2-AM
d3=X3-AM
d4=X4-AM
d5=X5-AM
d6=X6-AM
d7=X7-AM
d8=X8-AM
d9=X9-AM
d10=X10-AM
sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2)
print "Standard deviation = ",round(sigma,4)," nF"
#: Probable error
#given data :
n=10
X1=147.2 # in nF
X2=147.4 # in nF
X3=147.9 # in nF
X4=148.1 # in nF
X5=148.1 # in nF
X6=147.5 # in nF
X7=147.6 # in nF
X8=147.4 # in nF
X9=147.6 # in nF
X10=147.5 # in nF
AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n
d1=X1-AM
d2=X2-AM
d3=X3-AM
d4=X4-AM
d5=X5-AM
d6=X6-AM
d7=X7-AM
d8=X8-AM
d9=X9-AM
d10=X10-AM
sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2)
Pe1=0.6745*sigma # probable error of one reading
probable_error=Pe1/(n-1)**(1.0/2)
print "Probable error of one reading = ",round(Pe1,4)," nF"
print "Probable error of mean = ",round(probable_error,4)," nF"
#ARITHEMATIC MEAN
import numpy
q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #
AM= numpy.mean(q) #arithematic mean in mm
print "Arithematic mean is ",AM," kg/cm2"
#answer is wrong in textbook
#average deviation
import numpy
n=8 # NO. OF MEASUREMENTS
q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM # deviation
davg=sum(abs(d))/n # average deviation
print "Average deviation = ",round(davg,4)," kg/cm2"
#answer is wrong in textbook
#standard deviation
import numpy
q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM
sigma=0
n=8 # no. of measurements
for dev in d:
sigma+=dev**2
sigma/=(n-1)
sigma**=(1.0/2)
print "Standard Deviation is ",round(sigma,4)," kg/cm2"
#answer is wrong in textbook
#probable error
n=8 # no. of measurements
q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #
AM= numpy.mean(q) #arithematic mean in mm
d=q-AM
sigma=0
n=10 # no. of measurements
for dev in d:
sigma+=dev**2
sigma/=(n-1)
sigma**=(1.0/2)
pe1=0.6745*sigma # Probable error of one reading
print "Probable error of one reading is ",round(pe1,4)," kg/cm2"
pm=pe1/(n-1)**(1.0/2)
print "Probable error of mean is ",round(pm,4)," kg/cm2"
#answer is wrong in textbook
#ARITHEMATIC MEAN ,median value ,standard deviation and variance
q=[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] #
AM= numpy.mean(q) #arithematic mean in mm
n=len(q) # no. of measurements
Q=q-AM
mv=sorted(q)[n/2] # get the median value from sorted q
d=q-AM
sigma=0
for dev in d:
sigma+=dev**2
sigma/=(n-1)
sigma**=(1.0/2) #standard deviation
V=sigma**2 #variance
print "Arithematic mean is ",round(AM,4)," V"
print "Median value is",round(mv,1)
print "Standard Deviation is ",round(sigma,2)
print "Variance is ",round(V,0)
#ARITHEMATIC MEAN
#from __future__ import division
v=[10,11,12,13,14] #
f=[03,12,18,12,03] #
xn=[a*b for a,b in zip(v,f)]
am=sum(xn)/sum(f) # arithmetic mean
print "Arithematic mean is ",am," V"
dn=[x-am for x in v] # deviation
n_dn=[a*b for a,b in zip(f,dn)]
dn2=[a*b for a,b in zip(dn,dn)]
n_dn2=[a*b for a,b in zip(f,dn2)]
absn_dn=[abs(a) for a in n_dn]
mean_dev=sum(absn_dn)/sum(f)
print "Mean deviation = ",mean_dev
sigma=(sum(n_dn2)/sum(f))**(1.0/2)
print "Standard deviation is ", sigma
#ARITHEMATIC MEAN ,median value ,standard deviation
import numpy
q=[29.2,29.5,29.6,30.0,30.5,31.4,31.7,32.4,33.0,33.3,39.4,28.9] #
AM= numpy.mean(q)#arithematic mean in mm
print "Arithematic mean is ",round(AM,2)
mv=sorted(q)[int(len(q)/2-1)]
print "Median value = ",mv
d=[x-AM for x in q]
d2=[x**2 for x in d]
sigma=(sum(d2)/(len(q)-1))**(1.0/2)
print "Standard Deviation = ",round(sigma,3)
#Unknown resistor
#given data :
S=1000.0 # ohm/V
V=100.0 #in V
I=5*10**-3 # in A
# part (i)
R_app=(V/I)*10**-3
print "(i) Apparent Resistor, R_app = ",R_app, " kohm"
# part (ii)
V1=150 #in V
Rv=S*V1*10**-3
Rx=Rv/6.5 #actual resistance in kohm
print "(ii) Actual resistance is ",round(Rx,2)," kohm."
# part(iii)
per=(Rx-R_app)/Rx*100 # in %
print "(iii) Percentage error due to loading effect of voltmeter is ",round(per,1), " %"
# limiting error
#given data :
del_A=2.5 # may be +ve or-ve in %
As=400.0
FSD=600.0 # in V
del_A1=(del_A/100)*FSD
e=(del_A1/As)*100 # in %
print "Limiting error, e = ",e, " %"