Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.2K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

ArrayFlatten::intnm: Non-negative machine-sized integer expected

Posted 3 years ago

See my following code snippet:

In[122]:= AA = {Inverse[R1] . R . R1, -Inverse[R1] . s1 + 
   Inverse[R1] . (t + R . s1)}
AA /. {Dot -> Times, R1 -> {{1}}} // ArrayFlatten[#, {2}] &

Out[122]= {Inverse[R1] . R . R1, -Inverse[R1] . s1 + 
  Inverse[R1] . (t + R . s1)}

During evaluation of In[122]:= ArrayFlatten::intnm: Non-negative machine-sized integer expected at position 2 in ArrayFlatten[{{{R}},{{-s1+R s1+t}}},{2}].

Out[123]= ArrayFlatten[{{{R}}, {{-s1 + R s1 + t}}}, {2}]

I want to obtain the following form:

{R, (-1 + R) s + t}

Any hints will be appreciated.

Regards, Zhao

POSTED BY: Hongyi Zhao
2 Replies
Posted 3 years ago

Thank you. It works.

If, here, R is a 3 by 3 invertible matrix, s1 and t are 3 by 1 column vectors. I want to do the following rule replace:

AA/. {R1 -> IdentityMatrix[3]} // Flatten // Simplify

What I want to get is the following:

{R, (-IdentityMatrix[3] + R) . s1 + t}

But the following result is returned:

{{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} . 
  R . {{1, 0, 0}, {0, 1, 0}, {0, 0, 
    1}}, -{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} . 
    s1 + {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} . (t + R . s1)}

Is there any way to solve this problem?

Regards, Zhao

POSTED BY: Hongyi Zhao
Posted 3 years ago

A simple Flatten will give what you want

AA = {Inverse[R1] . R . R1, -Inverse[R1] . s1 + Inverse[R1] . (t + R . s1)}
AA /. {Dot -> Times, R1 -> {{1}}} // Flatten // Simplify
POSTED BY: Hans Milton
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard