import numpy as np

print("VEKTORAUFGABEN")
print()
print("a) Betrag des Vektors [[-6]")
print("                       [7]]")
print()
print('=', np.linalg.norm(np.array([[-6], [7]])))
print()
print("b) [[2]    [[-4]")
print("    [3]  +  [5]")
print("    [4]]    [-7]]")
print()
print('=', np.array([[2], [3], [4]]) + np.array([[-4], [5], [-7]]))
print()
print("c)     [[6]")
print("   5 *  [-7]")
print("        [8]]")
print()
print('=', 5 * np.array([[6], [-7], [8]]))
print()
print("d) [[2]    [[8]")
print("    [3]  *  [-1]")
print("    [4]]    [4]]")
print()
print('=', np.array([[2], [3], [4]]) * np.array([[8], [-1], [4]]))
print()
print("MATRIXAUFGABEN")
print()
print("                      [[2    1.5]")
print("A = [[3  -4  5] , B =  [-1.5   2]  , C = [[-3  1]")
print("     [-5  4  3]]       [0     -1]]        [2  -4]]")
print()
a = np.array([[3, -4, 5], [-5, 4, 3]])
b = np.array([[2, 1.5], [-1.5, 2], [0, -1]])
c = np.array([[-3, 1], [2, -4]])
print("a) A + B[T]")
print('=', a + b.transpose())
print()
print("b) A * B")
print('=', np.dot(a, b))
print()
print("c) B * A")
print('=', np.dot(b, a))
print()
print("d) det(C)")
print('=', np.linalg.det(c))
print()
print("e) C ** -1")
print('=', np.linalg.inv(c))
print()
print("f) Gleichungssysteme mit inverser Matrix lösen:")
print("f1) -3x + y = 0, 2x - 4y = -20")
print('=', np.linalg.solve(c, np.array([0, -20])))
print()
print("f2) -3x + y = -2, 2x - 4y = 16")
print('=', np.linalg.solve(c, np.array([-2, 16])))
