1
$\begingroup$

Let A,Band C be three 4x4 matrices defined as A=x*P+y*Q-R, C=x^(-s)(L0+sL1+s^(2)L2+s^(3)L3). Assuming the actual form of P, Q, R,L0,L1,L2,L3 are not known. Can we compute symbolically, while preserving the order of multiplication (as matrices do not commute in general), the following quantity in Mathematica:$ABA C^TA^TB^TA^T$ (T=Transpose)?

Edit: $x,y,s$ are scalars and not matrices.

$\endgroup$
2
  • $\begingroup$ I assume s,x,y scalars and everything else is 4 by 4 matrices? $\endgroup$
    – Nasser
    Commented Dec 17, 2021 at 12:04
  • $\begingroup$ Yes, they are scalars. Just made an edit. $\endgroup$
    – User101
    Commented Dec 17, 2021 at 12:06

2 Answers 2

2
$\begingroup$

You could use TensorExpand:

r = TensorExpand[
    A . B . A . Transpose[C0] . Transpose[A] . Transpose[B] . Transpose[A],
    Assumptions -> (x|y|s) ∈ Reals
] /. Transpose[a_, {2, 1}] :> Transpose[a];
Short[r, 10]

x^(4-s) P.B.P.Transpose[L0].Transpose[P].Transpose[B].Transpose[P]+x^(3-s) y P.B.P.Transpose[L0].Transpose[P].Transpose[B].Transpose[Q]-x^(3-s) P.B.P.Transpose[L0].Transpose[P].Transpose[B].Transpose[R]+x^(3-s) y P.B.P.Transpose[L0].Transpose[Q].Transpose[B].Transpose[P]+<<478>>+s^3 x^-s R.B.R.Transpose[L3].Transpose[R].Transpose[B].Transpose[R]

$\endgroup$
1
  • $\begingroup$ thanks! What is the meaning of <<478>> in the output? $\endgroup$
    – User101
    Commented Dec 19, 2021 at 18:48
1
$\begingroup$

How about

Q = Array[q, {4, 4}];
R = Array[r, {4, 4}];
B = Array[b, {4, 4}];
P = Array[p, {4, 4}];
A = x*P + y*Q - R
L0 = Array[l0, {4, 4}];
L1 = Array[l1, {4, 4}];
L2 = Array[l2, {4, 4}];
L3 = Array[l3, {4, 4}];
C0 = x^(-s)*(L0 + s*L1 + s^(2)*L2 + s^(3)*L3);
res=A . B . A . Transpose@C0 . Transpose@A . Transpose@B . Transpose@A;
  
Dimensions[res]
  (* {4,4} *)

Result is too large to display fully

$\endgroup$
2
  • $\begingroup$ Syntax::bktmop: Expression "{4,4}*}" has no opening "{". $\endgroup$
    – User101
    Commented Dec 17, 2021 at 13:56
  • 2
    $\begingroup$ @User101 that is just a way to show output of the code for your convenience; that is, it is a commented out portion that is not essential to the code. Just don’t copy and paste the very last line with that in it & the code will work... $\endgroup$ Commented Dec 17, 2021 at 16:10

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.