0
$\begingroup$

I have implemented the following two matrices in Mathematica in order to compute s, but I don't know how I can further simplify the resulting expressions, e.g., Mathematica seems to not perform the trace in the denominator for s. Applying Simplify with the assumption that the $3$ variables are positive does not seem to matter much. Below is my attempt:


Q = {{x^2, 0., 0.}, {0., y^2, 0.}, {0., 0., z^2}};
Qhat = Table[
   Part[Q, i, j] - KroneckerDelta[i, j]*Tr[Q/3], {i, 3}, {j, 3}] // 
  MatrixForm
s = (4*Det[Qhat])/(2/3. *(Tr[Qhat^2]))^(3/2)
Simplify[s, x^2 > 0 && y^2 > 0 && z^2 > 0]

Output:

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Don't use MatrixForm to define matrices. It is only a display wrapper and interferes with evaluation. $\endgroup$ – Roman Apr 30 at 9:04
  • $\begingroup$ @Roman Ah nice spot! that has already made a huge difference, now it evaluates s normally, thanks! Please feel free to post as an answer so I can accept, may be useful for future readers, and in case you also wanted to add something about the simplification. $\endgroup$ – user929304 Apr 30 at 9:08
  • $\begingroup$ @Roman you should be able to get around that (albeit not producing cleaner or more efficient code) with an Evaluate[] wrapper, yeah? If I am mostly understanding most things, anyways. $\endgroup$ – CA Trevillian Apr 30 at 9:10
2
$\begingroup$

Don't use MatrixForm to define matrices. It is only a display wrapper and interferes with evaluation. See, for example, https://mathematica.stackexchange.com/a/18395/26598

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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