from numpy import *
#initialisation of variables
y_bar = 19.5 #in
x = 396.8 #in
n = 6 #in
y1 = 2.20 #in
x1 = 51.14 #in
p = 5.64 #in
ob_y = array([44,20,24,14,12,3])
ob_x = array([5.3,3.5,3.,1.2,0.48,-0.26])
#CALCULATIONS
Beta = round((x-n*(y_bar)*(y1))/(x1-n*(y1)**2),2)
y = around(y_bar + Beta*(ob_x - 2.2),decimals=1)
Ri = ob_y - y
sumRi = sum(Ri)
#RESULTS
print "Beta B = %.2f"%Beta
print "residuals Ri are : " ,Ri
print 'the method of leate squares = %.2f minimum'%(sumRi)
# note : answer is slighty different because of rounding off error.
from numpy import *
#initialisation of variables
a = 12. #in
h = 121. #in
p = 11. #in
s = 220. #in
observed_time = array([11,12,13,14,15,16,17,18,19,20,21])
i = array([1,2,3,4,5,6,7,8,9,10,11])
observed_magnitude = array([2,4,6,8,10,12,14,16,18,20,22])
y_uy = array([-10,-8,-6,-4,-2,0,2,4,6,8,10])
#CALCULATIONS
B = a/p*(h-1)*s #per unit
n = len(i)
i_6 = i - (n+1)/2
i_6_y_uy = (i - (n+1)/2)*y_uy
#RESULTS
print "Observed Time ", observed_time
print "Order,i ", i
print "[i-(n+1)/2] ", i_6
print "Observed magnitude ", observed_magnitude
print "Deviation from mean ", y_uy
print "[i-(n+1)/2](y-uy) ", i_6_y_uy
import math
#initialisation of variables
a = 4404. #ft
q = 9. #ft
mu = 12. #ft
#CALCULATIONS
F = math.sqrt(a/q) #ft
CF = F/mu*100 #percent
#RESULTS
print 'the coefficient of fluctuation is = %.0f percent'%(CF)
import math
#initialisation of variables
h2 = 5 #in
x = 3.72 #in
x1 = 1.28 #in
#CALCULATIONS
H = h2*x1/x #in
#RESULTS
print 'the either side of the center of the scale = %.2f in'%(H)
#initialisation of variables
p = 80 #in
q = 20 #in
#CALCULATIONS
K = p+q #ft
#RESULTS
print 'the moments of the arithmetically normal frequency curve = %.0f ft'%(K)
import math
#initialisation of variables
g = 3.2541 #in
g1 = 3.46 #in
m = 0.5390 #ft
h = 2./99 #ft
p = 1.52 #ft
#CALCULATIONS
L = math.sqrt(g*h) #in
mu = g1*p #in
M = g1/p #percent
#RESULTS
print 'the points necessary to plot the straigt line of fit on math.log probability = %.2f percent'%(M)