在矩阵上执行符号操作的麻烦


1

我有一些问题。

首先,我声明基质如下面

$Assumptions = { 
  Element[X, Matrices[{m, n}]], 
  Element[T, Matrices[{n, k}]], 
  Element[Y, Matrices[{m, k}]]}; 

,我想申请

transpose(X T - Y).(X T - Y) = 
  transpose[T].transpose[X].X.T - transpose[T].transpose[X].Y - 
  transpose[Y].X.T + transpose[Y].Y 

所以我试图

  1. Inner[Times, {X \[Transpose]}, {T \[Transpose]}, Plus] - \[Transpose][Y]

  2. Inner[NonCommutativeMultiply, {X}, {T}] - {Y} = {-Y + X ** T} ...

但我不能乘上述两个表达式。

Inner[NonCommutativeMultiply, 
  Inner[Times, {X\[Transpose]}, {T\[Transpose]}, Plus] - Transpose[Y], 
  Inner[NonCommutativeMultiply, {X}, {T}] - {Y}] 

因为我得到错误。你可以帮帮我吗?

1

适用于我。我唯一看到的是错误的是,您忘记了Transpose[Y]的大括号,因此代码应如下所示:

Inner[NonCommutativeMultiply, 
Inner[Times, {X\[Transpose]}, {T\[Transpose]}, Plus] - {Transpose[Y]}, 
Inner[NonCommutativeMultiply, {X}, {T}] - {Y}]