modify formulas and fix sample_data.txt
This commit is contained in:
parent
c87ebc833b
commit
c7563bbec8
12
main.py
12
main.py
|
@ -24,19 +24,15 @@ def process_table(file):
|
||||||
|
|
||||||
r = config["r"]
|
r = config["r"]
|
||||||
for i in table[1:]:
|
for i in table[1:]:
|
||||||
# first table
|
|
||||||
i.append(round(i[0] / i[2], r))
|
i.append(round(i[0] / i[2], r))
|
||||||
i.append(round(i[6]**2, r))
|
i.append(round(i[6]**2, r))
|
||||||
i.append(round((i[0]**2)/(2*(i[2]**2)*i[1]), r))
|
i.append(round((i[0]**2)/(2*(i[2]**2)*i[1]), r))
|
||||||
|
|
||||||
# precalculations
|
|
||||||
preset_L2 = table[1][0]
|
preset_L2 = table[1][0]
|
||||||
preset_L1 = table[1][1]
|
preset_L1 = table[1][1]
|
||||||
|
|
||||||
preset_ai = [(preset_L2**2) / (2 * (avg(list(zip(*table[1:][i:i+3]))[5])**2) * preset_L1) for i in range(0, 12, 3)]
|
for i in table[1:]:
|
||||||
for i in range(4):
|
i.append(round((preset_L2**2) / (2 * (i[5]**2) * preset_L1), r))
|
||||||
for k in range(3):
|
|
||||||
table[1 + i*3 + k].append(round(preset_ai[i], r))
|
|
||||||
|
|
||||||
preset_avg_a = [(preset_L2**2) / (2 * (avg(list(zip(*table[1:][i:i+3]))[9])**2) * preset_L1) for i in range(0, 12, 3)]
|
preset_avg_a = [(preset_L2**2) / (2 * (avg(list(zip(*table[1:][i:i+3]))[9])**2) * preset_L1) for i in range(0, 12, 3)]
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
|
@ -45,7 +41,7 @@ def process_table(file):
|
||||||
|
|
||||||
for i in table[1:]:
|
for i in table[1:]:
|
||||||
i.append(round(i[4]/(2*i[3]), r))
|
i.append(round(i[4]/(2*i[3]), r))
|
||||||
i.append(round(i[10]/(9.81-i[10]), r))
|
i.append(round(i[10]/(9.8-i[10]), r))
|
||||||
|
|
||||||
w = max([max(list(map(lambda x: len(str(x)), i))) for i in table])
|
w = max([max(list(map(lambda x: len(str(x)), i))) for i in table])
|
||||||
print("\n".join([" | ".join(list(map(lambda x: str(x).center(w), i))) for i in table]))
|
print("\n".join([" | ".join(list(map(lambda x: str(x).center(w), i))) for i in table]))
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
# r 4
|
# r 5
|
||||||
|
|
||||||
0.020 0,227 0,269 49 20.2 0,275
|
0.2 0,227 0,269 49 20.2 0,275
|
||||||
0.020 0,227 0,265 49 20.2 0,299
|
0.2 0,227 0,265 49 20.2 0,299
|
||||||
0.020 0,227 0,262 49 20.2 0,310
|
0.2 0,227 0,262 49 20.2 0,310
|
||||||
|
|
||||||
0.020 0,207 0,287 49 16.1 0,333
|
0.2 0,207 0,287 49 16.1 0,333
|
||||||
0.020 0,207 0,271 49 16.1 0,327
|
0.2 0,207 0,271 49 16.1 0,327
|
||||||
0.020 0,207 0,280 49 16.1 0,322
|
0.2 0,207 0,280 49 16.1 0,322
|
||||||
|
|
||||||
0.020 0,187 0,337 49 10.2 0,373
|
0.2 0,187 0,337 49 10.2 0,373
|
||||||
0.020 0,187 0,311 49 10.2 0,365
|
0.2 0,187 0,311 49 10.2 0,365
|
||||||
0.020 0,187 0,298 49 10.2 0,376
|
0.2 0,187 0,298 49 10.2 0,376
|
||||||
|
|
||||||
0.020 0,157 0,321 49 28 0,265
|
0.2 0,157 0,321 49 28 0,265
|
||||||
0.020 0,157 0,325 49 28 0,247
|
0.2 0,157 0,325 49 28 0,247
|
||||||
0.020 0,157 0,325 49 28 0,288
|
0.2 0,157 0,325 49 28 0,288
|
||||||
|
|
Loading…
Reference in New Issue