From c7563bbec8fd8d3b76fe0eb92bd1e72a2c6d386e Mon Sep 17 00:00:00 2001 From: dymik739 Date: Mon, 27 Feb 2023 14:58:23 +0200 Subject: [PATCH] modify formulas and fix sample_data.txt --- main.py | 12 ++++-------- sample_data.txt | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/main.py b/main.py index af07587..da55b42 100644 --- a/main.py +++ b/main.py @@ -24,19 +24,15 @@ def process_table(file): r = config["r"] for i in table[1:]: - # first table i.append(round(i[0] / i[2], r)) i.append(round(i[6]**2, r)) i.append(round((i[0]**2)/(2*(i[2]**2)*i[1]), r)) - # precalculations preset_L2 = table[1][0] 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 range(4): - for k in range(3): - table[1 + i*3 + k].append(round(preset_ai[i], r)) + + for i in table[1:]: + i.append(round((preset_L2**2) / (2 * (i[5]**2) * preset_L1), 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)] for i in range(4): @@ -45,7 +41,7 @@ def process_table(file): for i in table[1:]: 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]) print("\n".join([" | ".join(list(map(lambda x: str(x).center(w), i))) for i in table])) diff --git a/sample_data.txt b/sample_data.txt index b882a9d..1de0b1f 100644 --- a/sample_data.txt +++ b/sample_data.txt @@ -1,17 +1,17 @@ -# r 4 +# r 5 -0.020 0,227 0,269 49 20.2 0,275 -0.020 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,269 49 20.2 0,275 +0.2 0,227 0,265 49 20.2 0,299 +0.2 0,227 0,262 49 20.2 0,310 -0.020 0,207 0,287 49 16.1 0,333 -0.020 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,287 49 16.1 0,333 +0.2 0,207 0,271 49 16.1 0,327 +0.2 0,207 0,280 49 16.1 0,322 -0.020 0,187 0,337 49 10.2 0,373 -0.020 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,337 49 10.2 0,373 +0.2 0,187 0,311 49 10.2 0,365 +0.2 0,187 0,298 49 10.2 0,376 -0.020 0,157 0,321 49 28 0,265 -0.020 0,157 0,325 49 28 0,247 -0.020 0,157 0,325 49 28 0,288 +0.2 0,157 0,321 49 28 0,265 +0.2 0,157 0,325 49 28 0,247 +0.2 0,157 0,325 49 28 0,288