0
$\begingroup$

I want to simplify the arrays of a matrix, first I tried to define my constants then used "FullSimplify" but it does not work. Please see the screen shout.

SetAttributes[Subscript[u, 10], Constant]
SetAttributes[k, Constant]
SetAttributes[a, Constant]

FullSimplify [IndexedExpression[i_,j_,k_]:=HoldForm[Subscript[OverTilde["R"],i,k] TraditionalForm[D[Subscript[OverBar[u],j],Subscript[x,k]]]];

IndexedExpression[j,i,k];
Table[IndexedExpression[a,b,c],{b,1,3},{a,1,3},{c,1,3}];
IndexedExpression[j,i,k]==MatrixForm[Apply[Plus,Table[IndexedExpression[a,b,c],{b,1,3},{a,1,3},{c,1,3}],{2}]]/.{t->SuperStar[t]/(k*Subscript[u, 10]),
Subscript[x, 1]->Subscript[SuperStar[x], 1]/k,Subscript[x, 2]->Subscript[SuperStar[x], 2]/k,Subscript[x, 3]->a* Subscript[SuperStar[x], 3],
Subscript[\!\(\*OverscriptBox[\(u\), \(_\)]\), 1]->(Subscript[u, 10])*Subscript[SuperStar[\!\(\*OverscriptBox[\(u\), \(_\)]\)], 1],Subscript[\!\(\*OverscriptBox[\(u\), \(_\)]\), 2]->(Subscript[u, 10])*Subscript[SuperStar[\!\(\*OverscriptBox[\(u\), \(_\)]\)], 2],Subscript[\!\(\*OverscriptBox[\(u\), \(_\)]\), 3]->(a*k*Subscript[u, 10])*Subscript[SuperStar[\!\(\*OverscriptBox[\(u\), \(_\)]\)], 3],
Subscript[\!\(\*OverscriptBox[\(u\), \(~\)]\), 1]->(Subscript[u, 10])Subscript[SuperStar[\!\(\*OverscriptBox[\(u\), \(~\)]\)], 1],Subscript[\!\(\*OverscriptBox[\(u\), \(~\)]\), 2]->(Subscript[u, 10])Subscript[SuperStar[\!\(\*OverscriptBox[\(u\), \(~\)]\)], 2],Subscript[\!\(\*OverscriptBox[\(u\), \(~\)]\), 3]->(a*k*Subscript[u, 10])Subscript[SuperStar[\!\(\*OverscriptBox[\(u\), \(~\)]\)], 3],
\!\(\*OverscriptBox[\(p\), \(~\)]\)->(\[Rho]*(Subscript[u, 10])^2)* SuperStar[\!\(\*OverscriptBox[\(p\), \(~\)]\)],
Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 1,1]->((Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 1,1],Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 1,2]->((Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 1,2 ],Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 1,3]->(a*k*(Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 1,3],
Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 2,1]->((Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 2,1],Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 2,2]->((Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 2,2 ],Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 2,3]->(a*k*(Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 2,3],
 Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 3,1]->(a*k*(Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 3,1],Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 3,2]->(a*k*(Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 3,2 ],Subscript[\!\(\*OverscriptBox[\("\<R\>"\), \(~\)]\), 3,3]->((a*k*Subscript[u, 10])^2)Subscript[\!\(\*OverscriptBox[\("\<R*\>"\), \(~\)]\), 3,3]}]
 

enter image description here

$\endgroup$
4
  • $\begingroup$ It seems your equation is already simple. At which place, for instance, you expect simplification? $\endgroup$ Commented May 6, 2024 at 18:59
  • 1
    $\begingroup$ The error message is clear. It says "SetAttributes:sym Argument expected to be symbol". The problem is that subscript is not one symbol. That is why it is better to avoid using subscripts in Mathematica. I never use them myself. I assume this is the error you asking about. I did not run your code. $\endgroup$ Commented May 6, 2024 at 19:11
  • $\begingroup$ thank you for your comment . the problem is not only the subscript, the simplify does not work for 'a' and 'k' as well. $\endgroup$ Commented May 6, 2024 at 19:35
  • 1
    $\begingroup$ Recommendation: it is just not a good idea to use Subscripts, display-format functions (like TraditionalForm), special formatting and characters (SuperStar[ \!\(\*OverscriptBox[\(u\), \(~\)]\)]), etc., when doing calculations in Mathematica. You just need to change all of your variable names to things like u, u[2], u[1,2], uT[1,2] (for $\tilde{u}$), etc. It is likely that all the errors are due to these things. Especially don't use MatrixForm, because that is for display purposes only: it won't work for multiplying matrices. $\endgroup$ Commented May 7, 2024 at 6:16

1 Answer 1

0
$\begingroup$

This is too long for a comment and might be off the mark but the way I would handle this type of expression is I would use the symbols straight into the array definitions as dummy functions, do my manipulations and then at the end define a human readable rule to make it into something more palatable or something TeXFormable.

Here, it looks like you have a rank-2 Array[R, {3, 3}], and a Jacobian of a vector field Array[U[#][{x, y, z}] &, 3] which you can symbolically define as D[Array[U[#][{x, y, z}] &, 3], {{x, y, z}, 1}].

So all in all you can achieve the same matrix symbolically with something like:

With[{vars = {x, y, z}, headVar1 = R, headVar2 = U},
 Block[{rArray, uArray, difArray, humanReadableRule, expression},
  rArray = Array[headVar1, {3, 3}];
  uArray = Array[headVar2[#][Sequence @@ vars] &, 3];
  difArray = D[uArray, {vars, 1}];
  humanReadableRule = {headVar1[a_, b_] :> 
     Subscript[ToString@headVar1, ToString[a] <> "," <> ToString[b]], 
    headVar2[c_] :> Subscript[ToString@headVar2, ToString[c]]};
  expression  = difArray . Transpose@rArray;
  expression/. humanRadableRule // TableForm
  ]
 ]

expression is something Mathematica can manipulate, simplify etc but the need for human readable output(after manipulating the symbolic expressions) can be satisfied using the rule humanReadableRule, although I admit it will take a bit of work to get the derivative to look good.

$\endgroup$

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.