【数理化】直积的运算示例

分类: 数理化和工程 |
数量、向量、矩阵、张量直接可以作直积,直积最后要穷举到数量与数量的乘积,简单示例如下:
from sympy.tensor.array import tensorproduct, Array
a = Matrix([1,2])
b = Matrix([[5,6],[7,8]])
c = tensorproduct(a,b)
c
a = Matrix([1,2])
b = Matrix([[5,6],[7,8]])
c = tensorproduct(a,b)
c
c = tensorproduct(b,a)
c
c
d = tensorproduct(a,c)
d
d
from sympy import symbols
L = symbols('x0:14')
a1= Array([ L[0],L[1] ])
a2= Array([L[2],L[3],L[4] ])
a3= Array([L[5],L[6],L[7],L[8] ])
a4= Array([L[9],L[10],L[11],L[12],L[13] ])
tensorproduct(a1,a2,a3,a4)
L = symbols('x0:14')
a1= Array([ L[0],L[1] ])
a2= Array([L[2],L[3],L[4] ])
a3= Array([L[5],L[6],L[7],L[8] ])
a4= Array([L[9],L[10],L[11],L[12],L[13] ])
tensorproduct(a1,a2,a3,a4)