Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have some problems.

First of all, I declare matrices like below

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

and I want to apply

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

so I tried

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

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

But I can not multiply the two above expressions.

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

because I get errors. Could you help me?

share|improve this question

1 Answer 1

Works perfectly well for me. The only thing I see that is wrong is that you forgot the braces for Transpose[Y], so the code should look like this:

Inner[NonCommutativeMultiply, 
Inner[Times, {X\[Transpose]}, {T\[Transpose]}, Plus] - {Transpose[Y]}, 
Inner[NonCommutativeMultiply, {X}, {T}] - {Y}]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.