>>> a = np.array( [47, 11, 42, 7] )
>>> b = np.random.randint(3, size=4)
>>> b
array([2, 2, 1, 1])
>>>
>>> a + b
array([49, 13, 43, 8])
>>> a - b
array([45, 9, 41, 6])
>>>
>>> a ** 2
array([2209, 121, 1764, 49])
>>>
>>> np.sin(a)
array([ 0.12357312, -0.99999021, -0.91652155, 0.6569866 ])
>>>
>>> a * b
array([94, 22, 42, 7])
>>>
>>> a @ b # scalar product
165
>>> np.dot(a, b)
165
Basis-Operatoren
und
Skalarprodukt
a⃗ ⋅ b⃗ = |a⃗| |b⃗| cos∡(a⃗, b⃗)
|a⃗|, |b⃗| denote the lengths of the vectors.
∡(a⃗, b⃗) denotes the cosinus of the angle between the two vectors.
a⃗ ⋅ b⃗ = a1b1 + a2b2 + a3c3