# calculating guarantee value of capacitance
# Variables
As = 1;
Er = 0.05;
# Calculations and Results
Aau = As*(1+Er);
print "Upper limit(micro F) = ", Aau
Aal = As*(1-Er);
print "Lower limit(micro F) = ", Aal
# calculating percentage limiting error
# Variables
As = 150.;
Er = 0.01;
# Calculations
dA = As*Er;
As1 = 75.;
Er = (dA/As1)*100;
# Results
print "Percentage limiting error = ", Er
# Calculate the range of readings
# Variables
fsd = 1000.;
TP = 100.;
# Calculations and Results
Efsd = (1./100)*1000;
print "magnitude of Error when specified in terms of full scale deflection (w) = ", Efsd
print "Thus the meter will read between 90W and 110W"
Etv = (1./100)*100;
print "magnitude of Error when specified in terms of true value (w) = ", Etv
print "Thus the meter will read between 99W and 101W"
# Calculate the limiting error in percent
# Variables
dA = 0.05*5*10**-6;
As = 2.5*10**-6;
# Calculations
Er = (dA/As)*100;
# Results
print "percemtage limiting error = +/-", Er
# Calculate the range of readings specified interms of f.s.d. and true value
print "Range when specified interms of f.s.d."
# Calculations and Results
Error_fsd = 1.*1000./100
Range_lower_value = 100-Error_fsd;
print "Lower value of range (kN/m2)", Range_lower_value
Range_upper_value = 100+Error_fsd;
print "Upper value of range (kN/m2)", Range_upper_value
print "Range when specified interms of True value",
Error_true = 1*100/100.
Range_lower_value = 100-Error_true;
print "Lower value of range (kN/m2)", Range_lower_value
Range_upper_value = 100+Error_true;
print "Upper value of range (kN/m2)", Range_upper_value
# Calculate the magnitude and limiting error in ohm and in percentage of the resistance
# Variables
R1 = 37.;
R1_le = 5.*R1/100;
R2 = 75.;
R2_le = 5.*R2/100;
R3 = 50.;
R3_le = 5.*R3/100;
# Calculations and Results
R = R1+R2+R3;
print "Value of resistance (ohm) = ", R
R_le = R1_le+R2_le+R3_le;
print "Limiting Value of resistance (ohm) = ", R_le
Limiting_error_percentage = R_le*100/R;
print "Limiting Value of resistance (percentage) = +/-", Limiting_error_percentage
# calculate the value of relative limiting error in resistance
# Variables
Re_P = 1.5;
Re_I = 1;
# Calculations
Re_resistance = (Re_P+2*Re_I);
# Results
print "the value of relative limiting error of resistance in percentage(+/-) = ", Re_resistance
# Calculate the guaranteed values of the resistance
# Variables
R1 = 100.;
R1_le_perunit = 0.5; # R1_le_perunit indicates dR1/R1 = 0.5%
R2 = 1000.;
R2_le_perunit = 0.5;
R3 = 842.;
R3_le_perunit = 0.5;
# Calculations and Results
Rx = R2*R3/R1;
print "Value of resistance (ohm) = ", Rx
Rx_le_perunit = R1_le_perunit+R2_le_perunit+R3_le_perunit;
print "Limiting Value of resistance per unit (dRx/Rx) = ", Rx_le_perunit
Er_Le = Rx_le_perunit*Rx/100;
print "Limiting Value of resistance (ohm) = +/-", Er_Le
print "Guarantee value of the resistance (ohm) = ",
G1 = Rx+Er_Le;
G2 = Rx-Er_Le;
print G1,G2
# Calculate the percentage limiting error and range of resistance values
print "error in decade a = so, decade a is set at 4000 ohm",
Er_a = 4000.*0.1/100;
print Er_a
print "error in decade b = so, decade b is set at 600 ohm",
Er_b = 600*0.1/100.;
print Er_b
print "error in decade c = so, decade c is set at 30 ohm",
Er_c = 30*0.1/100.;
print Er_c
print "error in decade d = so, decade d is set at 9 ohm",
Er_d = 9*0.1/100;
print Er_d
Er_total = Er_a+Er_b+Er_c+Er_d;
Re_le_percentage = Er_total*100./4639;
print "Percentage Relative limiting error = ", Re_le_percentage
Range_lower = 4639-Er_total;
print "Lower value of range (ohm) = ", Range_lower
Range_upper = 4639+Er_total;
print "upper value of range (ohm) = ", Range_upper
import math
# Calculate the magnitude of power and limiting error
# Variables
F = 4.58;
L = 397.;
R = 1202.*10**-9;
t = 60.;
# Calculations and Results
P = (2*math.pi*9.81*F*L*R)/(t*10**6);
print "Magnitude of power (W) = ", P
dF_pu = 0.02/F; # per unit error in force
dL_pu = 1.3/L; # per unit error in Length
dR_pu = 1/R; # per unit error in revolution
dt_pu = 0.5/t; # per unit error in time
dP_pu = dF_pu+dL_pu+dR_pu+dt_pu;
dP_le = dP_pu*P;
print "Magnitude of limiting error in power (W)", dP_le
# Calculate the magnitude of Force and limiting error
# Variables
E = 200.*10**9;
L = 25.*10**-3;
b = 4.75*10**-3;
d = 0.9*10**-3;
# Calculations and Results
I = (b*d**3)/12;
x = 2.5*10**-3;
F = (3*E*I*x)/(L**3);
print "Magnitude of Force (N) = ", F
dE_pu = 0./E; # per unit error in E
db_pu = 0.0075/b;
dd_pu = 0.0075/d;
dx_pu = 0.025/x;
dL_pu = 0.025/L;
dF_pu = (dE_pu+db_pu+3*dd_pu+dx_pu+3*dL_pu)*10**-3;
print "limiting error in force (N) = +/-", dF_pu
# calculate the power loss and relative error
# Variables
I = 64.*10**-3;
R = 3200.;
# Calculations and Results
P = (I**2)*R;
print "Power(W) = ", P
Re = 2*0.75+0.2;
print "Relative error (%) = ", Re
# Calculate the true power as a percentage of measured power
# Variables
I = 30.4;
R = 0.015;
# Calculations
I_true = I*(1+0.012);
R_true = R*(1-0.003);
P_true = (I_true**2)*R_true;
P_measured = (I**2)*R;
R = P_true*100/P_measured;
# Results
print "true power as a percentage of measured power(%) = ", R
#calculate the total resistance, error of each register and fractional error of total resistance
# Variables
R1 = 250.;
R2 = 500.;
R3 = 375.;
# Calculations and Results
R_true = 1/((1/R1)+(1/R2)+(1/R3));
print " True value of resistance(ohm) = ", R_true
dR1 = 0.025*R1;
dR2 = -0.36*R2;
dR3 = 0.014*R3;
R1_effective = R1+dR1;
R2_effective = R2+dR2;
R3_effective = R3+dR3;
R_effective = 1/((1/R1_effective)+(1/R2_effective)+(1/R3_effective));
print " Effective value of resistance(ohm) = ", R_effective
Fractional_error = (R_true-R_effective)/R_true;
print "Fractional_error", Fractional_error
import math
#
print "When all the components have 0% error then resonant frequency (Hz)",
# Variables
L = 160.*10**-6;
C = 160.*10**-12;
fr = (1./(2*math.pi))*(1/(L*C))**0.5;
print fr
# Calculations and Results
print "When all the components have +10% error then resonant frequency (Hz)",
L_new = (160.*10**-6)+0.1*L;
C_new = (160.*10**-12)+0.1*C;
fr_new = (1./(2*math.pi))*(1/(L_new*C_new))**0.5;
print fr_new
error = (fr_new-fr)/fr;
print "error = ", error
print "When all the components have -10% error then resonant frequency (Hz)",
L_new = (160.*10**-6)-0.1*L;
C_new = (160.*10**-12)-0.1*C;
fr_new = (1./(2*math.pi))*(1/(L_new*C_new))**0.5;
print fr_new
error = (fr_new-fr)/fr;
print "error = ", error
import math
# calculate the Volume and relative error
# Variables
L = 250.;
d = 50.;
# Calculations and Results
V = ((math.pi/4)*d**2)*L;
print "Volume(mm3) = ", V
Re = 2*0.2-0.5;
print "Relative error (%) = ", Re
# calculate the per unit change in the value of spring for different temperature ranges
# Variables
dG_pu = -240*10**-6;
dD_pu = 11.8*10**-6;
# Calculations and Results
print "for temperature change of 20 degree C to 50 degree C (%) = ",
d_th = 30;
dK_pu = (dG_pu+dD_pu)*d_th*100;
print dK_pu
print "for temperature change of 20 degree C to -50 degree C (%) = ",
d_th = -70;
dK_pu = (dG_pu+dD_pu)*d_th*100;
print dK_pu
# Calculate apparent resistance, actual resistance and error
# Variables
Et = 100.;
It = 5.*10**-3;
# Calculations and Results
Rt = Et/It;
print "apparent value of resistance (ohm) = ", Rt
Rv = 1000.*150;
Rx = Rt*Rv/(Rv-Rt);
print "true value of resistance(ohm)", Rx
Er_percentage = (Rt-Rx)/Rx*100;
print "percentage error = ", Er_percentage
# Calculate apparent resistance, actual resistance and error
# Variables
Et = 40.;
It = 800.*10**-3;
# Calculations and Results
Rt = Et/It;
print "apparent value of resistance (ohm) = ", Rt
Rv = 1000.*150;
Rx = Rt*Rv/(Rv-Rt);
print "true value of resistance(ohm)", Rx
Er_percentage = ((Rt-Rx)/Rx)*100;
print "percentage error = ", Er_percentage
#Calculate the error and percentage error in the measurement of deflection
# Variables
l = 0.2;
E = 200*10**9;
b = 20.*10**-3;
d = 5.*10**-3;
D = (4.*l**3)/(E*b*d**3);
F = 1*9.81;
# Calculations and Results
x_true = D*F;
print "True value of deflection", x_true
x_indicated = D*10.31/(1+.1*D);
print "Indicated value of deflection", x_indicated
Er = x_indicated-x_true;
print "error = ", Er
Er_percentage = Er*100/x_true;
print "Percentage error = ", Er_percentage
import math
from numpy import array
#to find the mean,deviations from the mean, Average deviation, standard deviation and variance
x = [532. ,548, 543, 535, 546, 531, 543, 536];
X = sum(x);
n = 8;
a = 0.;
# Calculations and Results
Mean = X/n;
print "mean (kHZ)", X/n
d = []
for i in range(n):
d.append(x[i]-Mean)
print "deviations = ", d[i]
a = a+(abs(d[i]))
d_average = a/n;
print "Average deviation (kHz) = ", d_average
d_2 = sum(array(d)**2);
s = math.sqrt(d_2/(n-1))
print "standard deviation(kHz)", s
V = s**2;
print "varaince (kHZ)2 = ", V
import math
from numpy import array
#to find the mean,standard deviation, probable error and range
# Variables
x = [41.7, 42, 41.8, 42, 42.1, 41.9, 42, 41.9, 42.5, 41.8];
X = sum(x)
print X
d = [-.27, .03, -.17, .03, .13, -.07, .03, -.07, .53, -.17];
# Calculations and Results
d_2 = sum(array(d)**2);
n = 10.;
print "mean length(deg C)", X/n
print "standard deviation(if data is infinite)(deg C)", math.sqrt(d_2/n)
print "standard deviation(deg C)", math.sqrt(d_2/(n-1))
r1 = .6745*math.sqrt(d_2/(n-1));
print "probable error of 1 reading(deg C)", r1
print "probable error of mean(deg C)", r1/math.sqrt(n-1)
print "range(deg C)", max(x)-min(x)
import math
from numpy import array
#to find the arithematic mean, maen deviation,standard deviation, prpobable error of 1 reading, standard deviation and probable error of mean, standard deviation of standard deviation
# Variables
T = [397, 398, 399, 400, 401, 402, 403, 404, 405];
f = [1, 3, 12, 23, 37, 16, 4, 2, 2];
# Calculations and Results
Tf = sum(abs(array(T).transpose()*f));
print "mean temp(deg C)", Tf/sum(f)
d = [-3.78, -2.78, -1.78, -.78, .22, 1.22, 2.22, 3.22, 4.22];
d = array(d)
print "mean deviation(deg C)", sum(array(f).transpose()*d)/sum(f)
print "standard deviation(deg C)", math.sqrt(sum(array(f).transpose()*d**2)/sum(f))
print "probable error of 1 reading(deg C)", .6745*math.sqrt(sum(array(f).transpose()*d**2)/sum(f))
print "probable error of mean(deg C)", (.6745*math.sqrt(sum(array(f).transpose()*d**2)/sum(f)))/math.sqrt(sum(f))
print "standard deviation of mean(deg C)", (math.sqrt(sum(array(f).transpose()*d**2)/sum(f)))/math.sqrt(sum(f))
print "standard deviation of standard deviation(deg C)", (math.sqrt(sum(array(f).transpose()*d**2)/sum(f)))/math.sqrt(sum(f)*2)
import math
#to find probable no of resistors
# Variables
x = .15; #deviation
o = .1; #standard deviation
t = x/o;
A = .4432 #area under gaussian curve corresponding to t
# Calculations
n = 2*A*1000;
# Results
print "no of resistors", math.floor(n)
import math
#to find no of 100 rsding exceed 30mm
# Variables
x = 30-26.3; #mean value 26.3
r = 2.5;
o = r/.6745;
t = x/o;
A = .3413;#area under gaussian curve corresponding to t
# Calculations
n = 2*A*100;
nn = 100-math.floor(n);
# Results
print "no of readings exceed", nn/2
import math
#to find no of rods of desired length
# Variables
n = 25000.; #no of rods
n1 = 12500.; #length>10mm
n2 = 2000.; #length>10.25
a = n1-n2; #10<length<10.25
p = a/n;
t = 1.41; #umath.sing p
# Calculations
t1 = t*2;
p1 = .4975;
b = p1*n; #9.5<length<10
# Results
print "total no of rods", a+math.floor(b)
import math
#to find standard deviation and probability of error
# Variables
p = .2;
x = .8;
t = .5025;
# Calculations and Results
sd = x/t;
print "stndard deviation", sd
x = 1.2;
t = x/sd;
p = 2*.2743;
print "probability of error", p
import math
#to find no of expected readings
# Variables
x = 20;
h = 0.04;
# Calculations
sd = 1/(math.sqrt(2)*h);
t = x/sd;
P = .3708;
# Results
print "no of expected readings", math.ceil(2*P*x)
import math
#to calculate precision index of instrument
# Variables
t = .675;
x = 2.4;
# Calculations and Results
sd = x/t;
h = 1/(math.sqrt(2)*sd);
print "precision index", h
t = (50-44)/sd;
p = .45;
n = 8*30; #sept month no of measurements
a = ((.5-p)*n);
print "no of false alarms", a
rn = a/2; #reduced no of false alarms
p1 = rn/n;
P = .5-p1;
t = 1.96;
sd = (50-44)/t;
h = 1/(math.sqrt(2)*sd);
print "precision index", h
#to find confidence interval for given confidence levels
# Variables
cl = [.5, .9, .95, .99];
s = .22;
d = [.7, 1.83, 2.26, 3.25];
def ci(b):
return s*b;
# Calculations
CI = [0,0,0,0]
CI[0] = ci(d[0]);
CI[1] = ci(d[1]);
CI[2] = ci(d[2]);
CI[3] = ci(d[3]);
# Results
print "confidence interval", CI
import math
from numpy import array
#to point out the reading that can be rejected by chavenets criterion
# Variables
x = array([5.3, 5.73, 6.77, 5.26, 4.33, 5.45, 6.09, 5.64, 5.81, 5.75])*10**-3;
d = array([-.313, .117, 1.157, -.353, -1.283, -.163, .477, .027, .197, .137])*10**-3;
n = 10.;
# Calculations
X = sum(x)/n;
s = math.sqrt(sum(d**2)/(n-1));
a = abs(d)/s
print a
for i in range(10):
if a[i]>1.96:
print "rejected value", x[i]
import math
from numpy import array
#calculate standard deviation
# Variables
x = array([.9 ,2.3, 3.3, 4.5, 5.7, 6.7]);
y = array([1.1, 1.6, 2.6, 3.2, 4 ,5]);
n = 6.;
# Calculations
a = ((n*sum(x*y)-(sum(x)*sum(y)))/((sum(x**2)*n)-sum(x)**2));
b = ((sum(y)*sum(x**2)-(sum(x)*sum(x*y)))/((sum(x**2)*n)-sum(x)**2));
sdy = math.sqrt((1/n)*sum((a*x+b-y)**2));
sdx = sdy/a;
sa = math.sqrt(n/(n*sum(x**2)-sum(x)**2))*sdy;
sb = math.sqrt(sum(x**2)/(n*sum(x**2)-sum(x)**2))*sdy;
# Results
print "s_a", sa
print "s_b", sb
import math
#determine value of total current considering errors as limiting errors ans as smath.radians(numpy.arcmath.tan(rd deviations
# Variables
I1 = 200.;
I2 = 100.;
dI1 = 2.;
dI2 = 5.;
# Calculations and Results
I = I1+I2;
dI = ((I1/I)*(dI1/I1)+(I2/I)*(dI2/I2));
print "error considered as limiting errors"
print "I", I
print "dI", dI*I
sdI = math.sqrt(dI1**2+dI2**2);
print "error considered as standard deviations"
print "I", I
print "sdI", sdI
#determine probable error in the computed value of resistnce
# Variables
r_V = 12.;
I = 10.;
r_Rv = r_V/I;
V = 100.;
r1 = 2.;
# Calculations
r_Ri = V*r1/I**2;
r_R = math.sqrt(r_Rv**2+r_Ri**2);
# Results
print "r_R", r_R
import math
#to find Cq and its possible errors
# Variables
d = 12.5;
A = (math.pi/4)*d**2*10**-6;
W = 392.;
t = 600.;
p = 1000.;
g = 9.81;
h = 3.66;
# Calculations and Results
Cq = W/(t*p*A*math.sqrt(2*g*h));
print "Cq", Cq
dW = .23/W;
dt = 2/t;
dp = .1/100;
dA = 2*.002;
dg = .1/100;
dh = .003/h;
dd = .002;
dCq = Cq*(dW+dt+dp+dA+dg/2+dh/2);
print "%age absolute error", dCq*100/Cq
sdCq = Cq*math.sqrt(dW**2+dt**2+dp**2+4*dd**2+.25*(dg**2+dh**2));
print "%age standard deviation error", sdCq*100/Cq
import math
# Variables
V = 110.2;
I = 5.3;
# Calculations and Results
P = V*I
print "power(W) dissipated", P
w_v = .2;
w_i = 0.06;
dp = math.sqrt((w_v*I)**2+(w_i*V)**2);
print "uncertainity in power(%)", dp*100/P
import math
#to find uncertainity in combined resistance in both series and in parrallel
# Variables
R1 = 100.;
R2 = 50.;
wR1 = .1;
wR2 = 0.03;
# Calculations and Results
print "series conn"
R = R1+R2
print "resistance(ohm)", R
dR1 = 1;
dR2 = 1;
wR = math.sqrt((dR1*wR1)**2+(dR2*wR2)**2)
print "uncertainity in resistance(ohm)", wR
print "parrallel conn"
R = R1*R2*(R1+R2)**-1
print "resistance(ohm)", R
dR1 = (R2/(R1+R2))-((R1*R2)/(R1+R2)**2);
dR2 = (R1/(R1+R2))-((R1*R2)/(R1+R2)**2);
wR = math.sqrt((dR1*wR1)**2+(dR2*wR2)**2)
print "uncertainity in resistance(ohm)", wR
import math
#to calculate uncertainity in measurement
# Variables
l = 150;
dl = 0.01;
b = 50;
# Calculations and Results
wA = l*dl;
print "when no uncertainity in measurement of length"
print "uncertainity in measurement of area(m*m)", wA
print "when no certainity in measurement of length"
wA = 1.5*1.5;
wB = 0.01;
wL = math.sqrt((wA**2-(l*wB)**2)/b**2);
print "uncertainity in measurement of length(m)", wL
import math
#to calculate uncertainity in power
# Variables
E = 100.;
dE = .01;
I = 10.;
dI = 0.01;
R = 10.;
dR = .01;
# Calculations and Results
dP = math.sqrt(4*dE**2+dR**2)*100; #P = E**2/R
print "%age uncertainity in power measurement", dP
dP = math.sqrt(dE**2+dI**2)*100; #P = E*I
print "%age uncertainity in power measurement", dP