0
$\begingroup$

I am new to Mathematica, and was trying to find the eigenvalues of an 8x8 matrix using Mathematica. I have fairly simplifies the matrix A into a mathematical expression and I know the final expressions of my eigenvalues should look like as well. However, I keep getting this HUGE expression that makes no sense to me and would love some guidance here.

My flux Jacobian (A) is: enter image description here

The last row is simplified to: enter image description here

The code is:

KE = 1/2*(Q2^2/Q1 + Q3^2/Q1 + Q4^2/Q1)
Btsq = Q5^2 + Q6^2 + Q7^2
P = (gamma - 1)*(Q5 - KE - Btsq/(2*mu0))
F1 = Q2
F2 = Q2^2/Q1 - (Q5^2/mu0) + P + Btsq/(2*mu0)
F3 = (Q2*Q3)/Q1 - (Q5*Q5)/Q1
F4 = (Q2*Q4)/Q1 - (Q5*Q7)/mu0
F5 = 0
F6 = (Q2*Q6)/Q1 - (Q3*Q5)/Q1
F7 = (Q2*Q7)/Q1 - (Q4*Q5)/Q1
F8 = (Q8 + P + (Btsq/(2*mu0)))*Q2/Q1 - 
  Q5*(Q5*Q2/Q1 + (Q6*Q3)/Q1 + (Q7*Q4)/Q1)/mu0
A = ({
    {D[F1, Q1], D[F1, Q2], D[F1, Q3], D[F1, Q4], D[F1, Q5], D[F1, Q6],
      D[F1, Q7], D[F1, Q8]},
    {D[F2, Q1], D[F2, Q2], D[F2, Q3], D[F2, Q4], D[F2, Q5], D[F2, Q6],
      D[F2, Q7], D[F2, Q8]},
    {D[F3, Q1], D[F3, Q2], D[F3, Q3], D[F3, Q4], D[F3, Q5], D[F3, Q6],
      D[F3, Q7], D[F3, Q8]},
    {D[F4, Q1], D[F4, Q2], D[F4, Q3], D[F4, Q4], D[F4, Q5], D[F4, Q6],
      D[F4, Q7], D[F4, Q8]},
    {D[F5, Q1], D[F5, Q2], D[F5, Q3], D[F5, Q4], D[F5, Q5], D[F5, Q6],
      D[F5, Q7], D[F5, Q8]},
    {D[F6, Q1], D[F6, Q2], D[F6, Q3], D[F6, Q4], D[F6, Q5], D[F6, Q6],
      D[F6, Q7], D[F6, Q8]},
    {D[F7, Q1], D[F7, Q2], D[F7, Q3], D[F7, Q4], D[F7, Q5], D[F7, Q6],
      D[F7, Q7], D[F7, Q8]},
    {D[F8, Q1], D[F8, Q2], D[F8, Q3], D[F8, Q4], D[F8, Q5], D[F8, Q6],
      D[F8, Q7], D[F8, Q8]}
   });
A = ({
   {D[F1, Q1], D[F1, Q2], D[F1, Q3], D[F1, Q4], D[F1, Q5], D[F1, Q6], 
    D[F1, Q7], D[F1, Q8]},
   {D[F2, Q1], D[F2, Q2], D[F2, Q3], D[F2, Q4], D[F2, Q5], D[F2, Q6], 
    D[F2, Q7], D[F2, Q8]},
   {D[F3, Q1], D[F3, Q2], D[F3, Q3], D[F3, Q4], D[F3, Q5], D[F3, Q6], 
    D[F3, Q7], D[F3, Q8]},
   {D[F4, Q1], D[F4, Q2], D[F4, Q3], D[F4, Q4], D[F4, Q5], D[F4, Q6], 
    D[F4, Q7], D[F4, Q8]},
   {D[F5, Q1], D[F5, Q2], D[F5, Q3], D[F5, Q4], D[F5, Q5], D[F5, Q6], 
    D[F5, Q7], D[F5, Q8]},
   {D[F6, Q1], D[F6, Q2], D[F6, Q3], D[F6, Q4], D[F6, Q5], D[F6, Q6], 
    D[F6, Q7], D[F6, Q8]},
   {D[F7, Q1], D[F7, Q2], D[F7, Q3], D[F7, Q4], D[F7, Q5], D[F7, Q6], 
    D[F7, Q7], D[F7, Q8]},
   {D[F8, Q1], D[F8, Q2], D[F8, Q3], D[F8, Q4], D[F8, Q5], D[F8, Q6], 
    D[F8, Q7], D[F8, Q8]}
  })
Eigenvalues[A];
A1 = Simplify[
  A, {Q1 == \[Rho], Q2 == \[Rho]*u, Q3 == \[Rho]*v, Q4 == \[Rho]*w, 
   Q5 == \[CurlyEpsilon], Q6 == Bx, Q7 == By, Q8 == Bz}]
B = Bx^2 + By^2 + Bz^2 == Bt^2
U = u^2 + v^2 + w^2 == ut^2
A2 = Simplify[Simplify[A1, {B, U}]]
Eigenvalues[A2]

For some reason, I am getting completely meaningless output.

New contributor
user79317 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
7
  • $\begingroup$ What do you mean by "meaningless output". If you are not familiar with Root expressions see the documentation. Note that if you used indexed variables (F[1]...F[8], Q[1]...Q[8]) the definition of A would be just A = D[Array[F, 8], {Array[Q, 8]}] // Simplify; $\endgroup$ – Bob Hanlon Apr 8 at 7:12
  • $\begingroup$ To make replacements it is more efficient to use replacement rules rather than doing it by simplification, e.g., A1 = Simplify[A /. {Q1 -> \[Rho], Q2 -> \[Rho]*u, Q3 -> \[Rho]*v, Q4 -> \[Rho]*w, Q5 -> \[CurlyEpsilon], Q6 -> Bx, Q7 -> By, Q8 -> Bz}] $\endgroup$ – Bob Hanlon Apr 8 at 7:17
  • $\begingroup$ I mean I get tens of lines of output that I cannot make sense of really. $\endgroup$ – user79317 Apr 8 at 15:40
  • $\begingroup$ We cannot know why you cannot make sense of the result unless you tell us. If you have some reason to believe the the result is incorrect, state that reason. Perhaps you should try working with numeric examples rather than purely symbolic. $\endgroup$ – Bob Hanlon Apr 8 at 15:49
  • $\begingroup$ Now, if I use your suggestions above my entire solution is just zeros. I have no exact reason why is incorrect, but previously I was getting hundreds of lines of output (too difficult to interpret or read) and I know how my final solution looks like. Unfortunately, I have no numeric examples to try, this was supposed to be solved symbolically. $\endgroup$ – user79317 Apr 8 at 16:33

Your Answer

user79317 is a new contributor. Be nice, and check out our Code of Conduct.

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

Browse other questions tagged or ask your own question.