Example #1
0
def theor_F_boy(diameter, er_diam, height, er_height, density, density_er, submerged_percent):  # submerged percent should be decimal ex. 40% would be 0.40
    
    volume, er_volume = calc_V(diameter, er_diam, height, er_height)
    volume = volume * submerged_percent
    
    F_boy = g * density * volume
    er_F_boy = er.rule_4(Q=F_boy, values=[density, volume], uncertainties=[density_er, er_volume], exponents=[1, 1])
    
    return F_boy, er_F_boy
Example #2
0
def calc_V(d, er_d, h, er_h):  # returns volume, uncertainty
    
    V = (math.pi / 4) * (d ** 2) * h
    er_V = er.rule_4(V, [d, h], [er_d, er_h], [2, 1])
    
    return V, er_V
Example #3
0
def calc_density(V, unc_V, kg, unc_kg):
    density = kg / V
    density_er = er.rule_4(Q=density, values=[V, kg], uncertainties=[unc_V, unc_kg], exponents=[1, -1])
    return density, density_er
Example #4
0
#Calculate the "goodness of fit" from the linear least squares fitting document
def LLSFD2(x, y, dy):
    N = sum(((y - b - m * x) / dy)**2)
    return N


N = LLSFD2(x, y, dy)

#NEW METHOD
Q = f_centripital
values = [m, m_hooks]
uncertainties = [dm, unc_m_hooks]
exponents = [-1, 1]

new_f_unc = er.rule_4(Q, values, uncertainties, exponents)

#old method
unc_f_centripital = f_centripital * math.sqrt(((unc_m_hooks / m_hooks)**2) +
                                              ((dm / m)**2))

print("Uncertainty using old method: {:.4f}".format(unc_f_centripital))

print("Uncertainty using new method: {:.4f}\n".format(new_f_unc))
"""
--------------------- Python for Caclulations ----------------------------
"""

dataset = [1.1, 1.3, 1.4, 0.9, 0.95, 1.05]
mean = np.average(dataset)
Example #5
0
    alphas.append(float((sum(accels[idx]) / len(accels[idx])) / r))
    
"""
-------------------------- Error Calc ------------------------
"""

unc_torqs = []

for (idx, torq) in enumerate(torqs):
    a = (sum(accels[idx]) / len(accels[idx]))
    unc_a = np.std(accels[idx]) / math.sqrt(len(accels[idx]))
    values = [masses[idx], r, a]
    uncs = [unc_mass, unc_r, unc_a]
    exps = [1, 1, 1]
    
    unc_torqs.append(er.rule_4(torq, values, uncs, exps))
    

"""
--------------------------Plotting Code ------------------------
"""
#Physics 
#-------------------------------------------#
#Data Section - Create Arrays for data. Perform necessary calculations
#CHANGE THE VARIABLE NAMES and numbers to match your data
xvariable_changeme = np.array(alphas) #what are units?
yvariable_changeme = np.array(torqs) #what are units?


#--------------------------------------------#
#Create arrays for uncertainties