Compare commits

...

2 Commits

4 changed files with 42 additions and 1 deletions

View File

@ -2,4 +2,5 @@ numpy==2.4.3
matplotlib==3.10.8
ipykernel==7.2.0
scipy==1.17.1
black==26.3.1
black==26.3.1
sympy==1.14.0

View File

@ -0,0 +1,12 @@
import numpy as np
P = [[0, 0, 1], [0, 1, 0], [1, 0, 0]]
L = [[1, 0, 0], [1, 1, 0], [1, 1, 1]]
R = [[3, 1, 1], [0, 3, 1], [0, 0, 0]]
PL = np.dot(P, L)
A = np.dot(PL, R)
print(A.trace())
Q = [[0, -1], [1, 0]]
R = [[1, 2], [0, 3]]
A = np.dot(Q, R)
print(A.trace())

View File

@ -0,0 +1,23 @@
import numpy as np
import sympy as sp
Q = [[0, 1, 0], [1, 0, 0], [0, 0, 1]] # Q Matrix
R = [[3, 1, 1], [0, 3, 1], [0, 0, 3]] # R Matrix
A = np.dot(Q, R) # Matrix multiplikation
print(np.linalg.det(A)) # Determinante
AT = np.transpose(A) # A transponiert
AI = np.linalg.inv(A) # A Inverse
print(AT == AI) # Orthogonal wenn True
print(A.trace()) # Spur von A
# Eigenwerte berechnen
M = sp.Matrix(A) # Sympy Matrix erstellen
spektrum = M.eigenvals() # Eigenwerte berechnen
print(list(spektrum.keys())) # Eigenwerte anzeigen
QA = np.dot(Q, A) # QR Zerlegung Gleichung umstellen
print(QA == R) # True wenn's stimmt

View File

@ -0,0 +1,5 @@
import sympy as sp
x = sp.symbols("x")
eq = sp.Eq(x**2 - 2 * x + 3, 0)
solution = sp.solve(eq, x)
print(solution)