LR-Zerlegung

This commit is contained in:
Sandro Zimmermann 2026-06-02 21:34:56 +02:00
parent fbd6476bad
commit 92e2f991e3

View File

@ -0,0 +1,37 @@
"""
LR-Zerlegung
Matrix A:
[3, 2]
[1, 4]
"""
import numpy as np
import scipy as sc
# Parameter
A = np.array([[3, 2], [1, 4]])
pr = 3
[P, L, R] = sc.linalg.lu(A)
with np.printoptions(precision=pr):
print(f"P = \n{P}\n\nL = \n{L}\n\nR = \n{R}")
"""
Ausgabe:
P =
[[1. 0.]
[0. 1.]]
L =
[[1. 0. ]
[0.333 1. ]]
R =
[[3. 2. ]
[0. 3.333]]
"""