fix formulas and sample data

This commit is contained in:
dymik739 2023-03-26 11:38:51 +03:00
parent d024b6d38d
commit 27e706a757
2 changed files with 22 additions and 7 deletions

View File

@ -1,3 +1,4 @@
import math
import sys
import os
@ -19,6 +20,7 @@ if not os.path.exists(sys.argv[1]):
# defining functions
def avg(a):
#print(a)
return sum(a) / len(a)
def get_max_len(a):
@ -66,11 +68,11 @@ for i in tables:
new_line = []
new_line.append(round(j[0]*tables[i]['r1']*9.81, r))
new_line.append(round(avg(j[1:4]), r))
new_line.append(round(2/(tables[i]['r1']*new_line[1]), r))
new_line.append(round(2/(tables[i]['r1']*(new_line[1]**2)), r))
new_line.append(round(j[0]*tables[i]['r2']*9.81, r))
new_line.append(round(avg(j[4:8]), r))
new_line.append(round(2/(tables[i]['r2']*new_line[4]), r))
new_line.append(round(avg(j[4:7]), r))
new_line.append(round(2/(tables[i]['r2']*(new_line[4]**2)), r))
required_data[i]["stats"].append(new_line)
@ -136,3 +138,16 @@ for i in tables:
tables[i]['stats'][j][6],
required_data[i]['stats'][j][4],
required_data[i]['stats'][j][5]])) ))
sigma_beta1 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["1"]['stats']))[2]))) + avg(list(zip(*required_data["1"]['stats']))[2])**2), r)
sigma_beta2 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["1"]['stats']))[5]))) + avg(list(zip(*required_data["1"]['stats']))[5])**2), r)
sigma_beta3 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["2"]['stats']))[2]))) + avg(list(zip(*required_data["2"]['stats']))[2])**2), r)
sigma_beta4 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["2"]['stats']))[5]))) + avg(list(zip(*required_data["2"]['stats']))[5])**2), r)
sigma_t1 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["1"]['stats']))[1]))) + avg(list(zip(*required_data["1"]['stats']))[1])**2), r)
sigma_t2 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["1"]['stats']))[3]))) + avg(list(zip(*required_data["1"]['stats']))[3])**2), r)
sigma_t3 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["2"]['stats']))[1]))) + avg(list(zip(*required_data["2"]['stats']))[1])**2), r)
sigma_t4 = round(math.sqrt(avg(list(map(lambda x: x**2, list(zip(*required_data["2"]['stats']))[3]))) + avg(list(zip(*required_data["2"]['stats']))[3])**2), r)
print("σβ (1-4) (DO NOT USE):", sigma_beta1/avg(list(zip(*required_data["1"]['stats']))[2]), sigma_beta2/avg(list(zip(*required_data["1"]['stats']))[5]), sigma_beta3/avg(list(zip(*required_data["2"]['stats']))[2]), sigma_beta4/avg(list(zip(*required_data["2"]['stats']))[5]))
print("σt (1-4) (DO NOT USE):", sigma_t1/avg(list(zip(*required_data["1"]['stats']))[1]), sigma_t2/avg(list(zip(*required_data["1"]['stats']))[3]), sigma_t3/avg(list(zip(*required_data["2"]['stats']))[1]), sigma_t4/avg(list(zip(*required_data["2"]['stats']))[3]))

View File

@ -2,8 +2,8 @@
# table 1
# set_unit mass kilogram
# r2 0.02
# r1 0.035
# r1 0.02
# r2 0.035
0.0852 15.91 16.57 16.62 8.11 8.09 8.00
0.11602 11.63 11.47 11.49 6.68 6.6 6.95
@ -15,8 +15,8 @@
# table 2
# set_unit mass gram
# r2 0.02
# r1 0.035
# r1 0.02
# r2 0.035
85.2 6.51 6.3 6.61 3.6 3.8 3.93
116.02 5.27 5.25 5.47 2.86 3.02 2.99