Serie 8 LR Zerlegung

This commit is contained in:
Sandro Zimmermann 2026-04-29 21:36:26 +02:00
parent 600223305c
commit b2b8001d85

View File

@ -1,8 +1,11 @@
# %%
# Import
import numpy as np
import scipy as sp
# Parameter
PR = 3
matrizen = [
np.array([[3, 1], [6, 9]]),
np.array([[3, 2], [1, 4]]),
@ -11,3 +14,15 @@ matrizen = [
np.array([[3, 5, 0], [5, 8, -1], [1, 2, -1]]),
np.array([[2, 4, 6], [1, 2, 3], [3, 6, 9]]),
]
# Berechnung
for matrix in matrizen:
[P, L, R] = sp.linalg.lu(matrix)
# Ausgabe
with np.printoptions(precision=PR):
print(f"\nA = \n{matrix}\n\nP = \n{P}\n\nL = \n{L}\n\nR = \n{R}\n")
print(60 * "-")
# %%