tabulate hinzugefügt

This commit is contained in:
AnnalenaTH committed 2026-10-15 13:42:04 +02:00
1 parent 81e8602a61
commit ba85e87473
2 files changed
+9 -4

No files matched your search

+2 -1
View File
@@ -1,3 +1,4 @@
[project] [project]
name = "matrixmania" name = "matrixmania"
version = "0.1.0" version = "0.1.0"
dependencies = ["tabulate", "ruff"]
+7 -3
View File
@@ -10,10 +10,12 @@ Functions:
""" """
from __future__ import annotations from __future__ import annotations
from typing import List
import math import math
Matrix = List[List[float]] from tabulate import tabulate
Matrix = list[list[float]]
def transpose(matrix: Matrix) -> Matrix: def transpose(matrix: Matrix) -> Matrix:
"""Return the transpose of *matrix*. """Return the transpose of *matrix*.
@@ -108,7 +110,7 @@ def matmul(A: Matrix, B: Matrix) -> Matrix:
result: Matrix = [] result: Matrix = []
for i in range(a_rows): for i in range(a_rows):
row: List[float] = [] row: list[float] = []
for j in range(b_cols): for j in range(b_cols):
s = 0.0 s = 0.0
for k in range(a_cols): for k in range(a_cols):
@@ -129,4 +131,6 @@ if __name__ == "__main__":
rotated_point = matmul(R, point) rotated_point = matmul(R, point)
print("Gedrehter Punkt (erwartet y=1, x=0):", rotated_point) print("Gedrehter Punkt (erwartet y=1, x=0):", rotated_point)
print(tabulate(rot_2D(1.0)))
#Dieser Kommentar ist ein Test #Dieser Kommentar ist ein Test