Write a NumPy program to compute the outer product of two given vectors
- برمجة بايثون
- 2021-09-13
- mhanasmh00489829403
الأجوبة
import numpy as np
p = [[1, 0], [0, 1]]
q = [[1, 2], [3, 4]]
print("original matrix:")
print(p)
print(q)
result = np.outer(p, q)
print("Outer product of the said two vectors:")
print(result)
Sample Output:
original matrix: [[1, 0], [0, 1]] [[1, 2], [3, 4]] Outer product of the said two vectors: [[1 2 3 4] [0 0 0 0] [0 0 0 0] [1 2 3 4]]
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال