From ce9b3f4a40089b6ad5a2bb391ddd8c46c18c9068 Mon Sep 17 00:00:00 2001 From: hamx01 Date: Sat, 16 Nov 2024 22:24:43 +0100 Subject: [PATCH] init aproksymacja --- aproksymacja/main.py | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 aproksymacja/main.py diff --git a/aproksymacja/main.py b/aproksymacja/main.py new file mode 100644 index 0000000..f934171 --- /dev/null +++ b/aproksymacja/main.py @@ -0,0 +1,63 @@ +from sympy import symbols, Eq, solve + +x = [1,2,4,5] +y = [3,4,6,7] + +x0 = [1,1,1,1] +x1 = x[:] +x2 = [] +xy = [] + +for number in x: + x2.append(number*number) + +x0y = y[:] + +for i in range(0,len(x)): + xy.append(x1[i] * x0y[i]) + +s0 = 0 + +for x in x0: + s0=s0+x + +s1 = 0 + +for x in x1: + s1=s1+x + +s2 = 0 + +for x in x2: + s2=s2+x + +t0 = 0 + +for x in x0y: + t0=t0+x + +t1 = 0 + +for x in xy: + t1=t1+x + +print(f"{s0} {s1} {s2} {t0} {t1}") + +# Definiujemy zmienne +a0, a1 = symbols('a0 a1') + +# Tworzymy równania +eq1 = Eq(4 * a0 + 12 * a1, 20) +eq2 = Eq(12 * a0 + 46 * a1, 70) + +# Rozwiązujemy układ równań +solution = solve((eq1, eq2), (a0, a1)) + +# Wyświetlamy wynik +print(solution) + + + + + +