[Raspberry Pi] Vektoren und Matrizen verarbeiten

import numpy as np
from numpy.random import rand
from numpy.linalg import solve, inv

# Vektor
a = np.array([1, 2, 3, 5])
# Vektor mit äquidistanten Werte erzeugen
b = np.linspace(0, 2, 4)

print(a)
print(b)

# Vektor generieren
v = np.linspace(-np.pi, np.pi, 10)
vs = np.sin(v)
vc = np.cos(v)

print(v)
print(vs)
print(vc)

# Matrix
c = np.array([[1, 2, 3], [3, 4, 5], [6, 7, 8]])
# transponieren
d = c.transpose()
# invertieren
e = inv(c)

print(d)
print(e)

Links