import numpy as np
x = np.array([1, 4, 0], float)
y = np.array([2, 2, 1], float)
print("Matrices and vectors.")
print("x:")
print(x)
print("y:")
print(y)
print("Inner product of x and y:")
print(np.inner(x, y))
print("Outer product of x and y:")
print(np.outer(x, y))
print("Cross product of x and y:")
print(np.cross(x, y))
Sample Output:
Matrices and vectors.
x:
[ 1. 4. 0.]
y:
[ 2. 2. 1.]
Inner product of x and y:
10.0
Outer product of x and y:
[[ 2. 2. 1.]
[ 8. 8. 4.]
[ 0. 0. 0.]]
Cross product of x and y:
[ 4. -1. -6.]
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer