3
$\begingroup$

I am trying to perform some symbolic calculus with tensors and matrices. I have recently noticed that one can set assumptions on variables by using the command $Assumptions$ as described here. However, when I make

$Assumptions$ = U ∈ Matrices[{d, m}, Reals];
$Assumptions$ = P ∈ Matrices[{d, t}, Reals];


Y = Transpose[U].P;
Dimensions[Y]

I get

(* {2} *)

Using TensorDimensions doesn't return a useful result either, as

TensorDimensions[Y]

(* TensorDimensions[Transpose[U].Phi] *)

If I am assuming $U$ to be a $d\times m$ matrix and $P$ to be a $d\times t$ matrix, then the product between $U^{\intercal}P$ should be an $m\times t$ matrix. I am sure I am probably misunderstanding either the usage of $Assumptions$ or the usage of the command Dimensions[] regarding this particular case. But if that is so, why is it not working this way?

$\endgroup$
2
  • $\begingroup$ You have syntax errors: it's $Assumptions, not $Assumptions$. Second, when you run $Assumptions twice, you override the first cases with U. You can make either a List of assumptions or connect them with &&. Then you'll get {m,t} as TensorDimensions[Y]. $\endgroup$
    – corey979
    Commented Nov 22, 2016 at 16:12
  • 2
    $\begingroup$ $Assumptions, per documentation, is only meaningful when used in functions that take the Assumptions option. Dimensions is not such a function but TensorDimensions is. $\endgroup$ Commented Nov 22, 2016 at 21:48

1 Answer 1

4
$\begingroup$

You just have a small typo in $Assumptions and this works only with TensorDimensions

$Assumptions = {U ∈ Matrices[{d, m}, Reals], 
   P ∈ Matrices[{d, t}, Reals]};
Y = Transpose[U].P;
Y // Dimensions
Y // TensorDimensions

{2}

{m, t}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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