Files
Masterprojekt_V3/Proben.py
2026-01-22 08:51:18 +01:00

28 lines
785 B
Python

import numpy as np
# d
def atpv_probe(A, P, v, tol=1e-7):
A = np.asarray(A, float)
P = np.asarray(P, float)
v = np.asarray(v, float).reshape(-1, 1)
ATPV = A.T @ P @ v
if np.allclose(ATPV, 0, atol=tol):
print("ATPv-Probe erfolgreich")
else:
print("ATPv-Probe nicht erfolgreich. Fehler bei der Lösung des Normalgleichungssystems")
def hauptprobe(A, x, l, v, tol=1e-7):
A = np.asarray(A, float)
x = np.asarray(x, float).reshape(-1, 1)
l = np.asarray(l, float).reshape(-1, 1)
v = np.asarray(v, float).reshape(-1, 1)
v_test = A @ x - l
if np.allclose(v, v_test, atol=tol):
print("Hauptprobe erfolgreich")
else:
diff = v - v_test
print("Hauptprobe nicht erfolgreich. Abweichung zu v: ", diff)