Message Boards Message Boards

0
|
2758 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

BUG (or misunderstanding): tensor simplification

Posted 10 years ago

I'm using Mathematica 9, so tell me if this is fixed in 10.

Steps to reproduce:

Enter and Evaluate:

Assuming[Element[M , Matrices[{2, 2}]] && Element[Z , Matrices[{2, 2}] ], Simplify[M == M Z]]

False

This returns "False". However, this is not correct. Consider:

Assuming[Element[M , Matrices[{2, 2}]] && Element[Z , Matrices[{2, 2}] ], Simplify[M == M Z /. Z -> {{1, 1}, {1, 1}}]]

True

Obviously, {{1,1},{1,1}} is n element of the domain, which Mathematica knows:

Element[{{1,1},{1,1}}, Matrices[{2,2}]

3 Replies

Yes, I think we agree.

Yes

I hope it was obvious that I was saying it should return "M == M Z", rather than "False"

Yes

There are solutions where M is not all zeros and Z is not all ones.

True - and that means, that the mentioned result is not almost always correct (as I said), because there is not a finite set of exceptions, but an infinite set of exceptions.

POSTED BY: Udo Krause

First

In[2]:= $Version
Out[2]= "10.0 for Microsoft Windows (64-bit) (June 29, 2014)"

In[6]:= Assuming[Element[M, Matrices[{2, 2}]] && Element[Z, Matrices[{2, 2}]], Simplify[M == M Z]]
Out[6]= False

With this elementwise multiplication has been ordered. The result is almost always correct, with the exception of Z = {{1,1},{1,1}} or M = {{0,0},{0,0}} - over the complex numbers (which is the default field in Mathematica), so, with other words, the result is itself false. If matrix multiplication is ordered, the outcome is

In[9]:= Assuming[Element[M, Matrices[{2, 2}]] && Element[Z, Matrices[{2, 2}]], Simplify[M == M . Z]]
Out[9]= M == M.Z

In[10]:= Assuming[Element[M, Matrices[{2, 2}]], Simplify[M == M . IdentityMatrix[2]]]
Out[10]= M == M.{{1, 0}, {0, 1}}

Here Mathematica in fact states I don't know, which is the usual outcome for unspecified symbols:

In[11]:= a == b + c
Out[11]= a == b + c

In[12]:= a == b + c /. {a -> 7, b -> -1, c -> 8}
Out[12]= True

Equal[] returns True if lhs and rhs are identical. For M = M Z or M = M . Z this is unkown, because they do not evaluate to something.

You mean a check if assuming Element[M, Matrices[{2, 2}]] && Element[Z, Matrices[{2, 2}]] is then Element[M Z, Matrices[{2,2}]] or Element[M . Z, Matrices[{2,2}]] true? You cannot test this with Equal[]. A way is In[16]

$Assumptions = {M \[Element] Matrices[{2, 2}],  Z \[Element] Matrices[{2, 2}]};

Out[14]= {M \[Element] Matrices[{2, 2}, Complexes, {}], 
 Z \[Element] Matrices[{2, 2}, Complexes, {}]}

In[33]:= M Z // TensorDimensions
During evaluation of In[33]:= TensorDimensions::ttimes: Product of nonscalar expressions encountered in M Z. >>
Out[33]= TensorDimensions[M Z]

In[36]:= {{x1, x2}, {x3, x4}} {{y1, y2}, {y3, y4}} // TensorDimensions
Out[36]= {2, 2}

In[16]:= M. Z // TensorDimensions
Out[16]= {2, 2}

In[34]:= $Assumptions = {A \[Element] Arrays[{2, d, 4}],  B \[Element] Arrays[{d, d}]};
In[35]:= TensorDimensions[A\[TensorProduct]B]
Out[35]= {2, d, 4, d, d}

elementwise multiplication is not recognized assumptions-symbolically under Mathematica 10 ...

POSTED BY: Udo Krause

Yes, I think we agree. I hope it was obvious that I was saying it should return "M == M Z", rather than "False"

There are solutions where M is not all zeros and Z is not all ones. Consider:

M = {{0,2},{0,3}} and Z = {{4,1},{5,1}}

The fact that TensorDimensions[M Z] fails is probably a clue to where the problems lie.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract