Wiki给出了列向量$ a $和$ b $的外积 $$ 一个= \ BEGIN {bmatrix} A_ {1} \\ a2} \\ a_ {3} \ {端} bmatrix, B = \ BEGIN {bmatrix} B_ {1} \\ b_ {2} \\ b_ {3} \ {端} bmatrix $$ $$ a⊗b= ab ^ {T} = \ begin {bmatrix} a_ {1} b_ {1} \ space \ space a_ {1} b_ {2} \ space \ space a_ {1} b_ {3} \\ a_ {2} b_ {1} \ space \ space a_ {2} b_ {2} \ space \ space a_ {2} b_ {3} \\ a_ {3} b_ {1} \ space \ space a_ {3} b_ {2} \ space \ space a_ {3} b_ {3} \ {端} bmatrix $$ 如果$ a $和$ b $是行向量, 根据{{3}},外部产品应该是这样的 $$ a = \ begin {bmatrix} a_ {1} \ space \ space a_ {2} \ space \ space a_ {3} \ end {bmatrix}, b = \ begin {bmatrix} b_ {1} \ space \ space b_ {2} \ space \ space b_ {3} \ end {bmatrix} $$ $$ a⊗b=a⊗_{K} b ^ {T} = \ begin {bmatrix} a_ {1} b_ {1} \ space \ space a_ {2} b_ {1} \ space \ space a_ {3} b_ {1} \\ a_ {1} b_ {2} \ space \ space a_ {2} b_ {2} \ space \ space a_ {3} b_ {2} \\ a_ {1} b_ {3} \ space \ space a_ {2} b_ {3} \ space \ space a_ {3} b_ {3} \ {端} bmatrix $$ 但是当我在python this中执行此操作时,它会给出相同的答案。
import numpy as np a = np.array([[1], [2], [3]]) b = np.array([[4], [5], [6]]) col_result=np.outer(a, b) row_result=np.outer(a.T, b.T) print(col_result) print(row_result)
答案是这样的:
[[ 4 5 6] [ 8 10 12] [12 15 18]] [[ 4 5 6] [ 8 10 12] [12 15 18]]
那么,我写错了方程式还是python做错了?