1
$\begingroup$

The function that I want to plot is simple but somewhat long because it depends on variables which in turn also depends on another variables and so on. Although each cell does not take long, the plotting takes more than a day without giving results. My code is:

J = 1;
Jz = 0.2;
T = 0.2;
\[Beta] = 1/T;
B = Sqrt[Bx^2 + Bz^2];

\[Zeta] = 
  ArcCos[((J - Jz) (-9 B^2 + 4 (J - Jz)^2 - 27 (Bz^2 - Bx^2)))/(
   4 (Sqrt[3 B^2 + (J - Jz)^2])^3)];
\[Lambda]1 = -2 J - Jz;
\[Lambda]2 = 
  1/3 (2 J + Jz + 4 Sqrt[3 B^2 + (J - Jz)^2] Cos[1/3 \[Zeta]]);
\[Lambda]3 = 
  1/3 (2 J + Jz + 
     4 Sqrt[3 B^2 + (J - Jz)^2] Cos[1/3 \[Zeta] + 2/3 \[Pi]]);
\[Lambda]4 = 
  1/3 (2 J + Jz + 
     4 Sqrt[3 B^2 + (J - Jz)^2] Cos[1/3 \[Zeta] + 4/3 \[Pi]]);

M2 = \[Sqrt](4 Bx^4 + 
     2 Bx^2 (2 Bz - 
        Jz + \[Lambda]2)^2 + (2 Bx^2 + (2 J - Jz - \[Lambda]2) (2 Bz -
           Jz + \[Lambda]2))^2);
M3 = \[Sqrt](4 Bx^4 + 
     2 Bx^2 (2 Bz - 
        Jz + \[Lambda]3)^2 + (2 Bx^2 + (2 J - Jz - \[Lambda]3) (2 Bz -
           Jz + \[Lambda]3))^2);
M4 = \[Sqrt](4 Bx^4 + 
     2 Bx^2 (2 Bz - 
        Jz + \[Lambda]4)^2 + (2 Bx^2 + (2 J - Jz - \[Lambda]4) (2 Bz -
           Jz + \[Lambda]4))^2);

F\[Lambda]2 = -(2 Bx^2 + (2 J - Jz - \[Lambda]2) (2 Bz - 
        Jz + \[Lambda]2))/M2;
g\[Lambda]2 = (Bx (2 Bz - Jz + \[Lambda]2))/M2;
h\[Lambda]2 = (2 Bx^2)/M2;
F\[Lambda]3 = -(2 Bx^2 + (2 J - Jz - \[Lambda]3) (2 Bz - 
        Jz + \[Lambda]3))/M3;
g\[Lambda]3 = (Bx (2 Bz - Jz + \[Lambda]3))/M3;
h\[Lambda]3 = (2 Bx^2)/M3;
F\[Lambda]4 = -(2 Bx^2 + (2 J - Jz - \[Lambda]4) (2 Bz - 
        Jz + \[Lambda]4))/M4;
g\[Lambda]4 = (Bx (2 Bz - Jz + \[Lambda]4))/M4;
h\[Lambda]4 = (2 Bx^2)/M4;  

\[Rho]11 = 
  E^(-\[Beta] \[Lambda]2) F\[Lambda]2^2 + 
   E^(-\[Beta] \[Lambda]3) F\[Lambda]3^2 + 
   E^(-\[Beta] \[Lambda]4) F\[Lambda]4^2;
\[Rho]12 = 
  E^(-\[Beta] \[Lambda]2) F\[Lambda]2 g\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) F\[Lambda]3 g\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) F\[Lambda]4 g\[Lambda]4;
\[Rho]13 = 
  E^(-\[Beta] \[Lambda]2) F\[Lambda]2 g\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) F\[Lambda]3 g\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) F\[Lambda]4 g\[Lambda]4;
\[Rho]14 = 
  E^(-\[Beta] \[Lambda]2) F\[Lambda]2 h\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) F\[Lambda]3 h\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) F\[Lambda]4 h\[Lambda]4;
\[Rho]21 = 
  E^(-\[Beta] \[Lambda]2) F\[Lambda]2 g\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) F\[Lambda]3 g\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) F\[Lambda]4 g\[Lambda]4;
\[Rho]22 = 
  E^(-\[Beta] \[Lambda]1)/2 + E^(-\[Beta] \[Lambda]2) g\[Lambda]2^2 + 
   E^(-\[Beta] \[Lambda]3) g\[Lambda]3^2 + 
   E^(-\[Beta] \[Lambda]4) g\[Lambda]4^2;
\[Rho]23 = -(1/2) E^(-\[Beta] \[Lambda]1) + 
   E^(-\[Beta] \[Lambda]2) g\[Lambda]2^2 + 
   E^(-\[Beta] \[Lambda]3) g\[Lambda]3^2 + 
   E^(-\[Beta] \[Lambda]4) g\[Lambda]4^2;
\[Rho]24 = 
  E^(-\[Beta] \[Lambda]2) g\[Lambda]2 h\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) g\[Lambda]3 h\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) g\[Lambda]4 h\[Lambda]4;
\[Rho]31 = 
  E^(-\[Beta] \[Lambda]2) F\[Lambda]2 g\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) F\[Lambda]3 g\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) F\[Lambda]4 g\[Lambda]4;
\[Rho]32 = -(1/2) E^(-\[Beta] \[Lambda]1) + 
   E^(-\[Beta] \[Lambda]2) g\[Lambda]2^2 + 
   E^(-\[Beta] \[Lambda]3) g\[Lambda]3^2 + 
   E^(-\[Beta] \[Lambda]4) g\[Lambda]4^2;
\[Rho]33 = 
  E^(-\[Beta] \[Lambda]1)/2 + E^(-\[Beta] \[Lambda]2) g\[Lambda]2^2 + 
   E^(-\[Beta] \[Lambda]3) g\[Lambda]3^2 + 
   E^(-\[Beta] \[Lambda]4) g\[Lambda]4^2;
\[Rho]34 = 
  E^(-\[Beta] \[Lambda]2) g\[Lambda]2 h\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) g\[Lambda]3 h\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) g\[Lambda]4 h\[Lambda]4;
\[Rho]41 = 
  E^(-\[Beta] \[Lambda]2) F\[Lambda]2 h\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) F\[Lambda]3 h\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) F\[Lambda]4 h\[Lambda]4;
\[Rho]42 = 
  E^(-\[Beta] \[Lambda]2) g\[Lambda]2 h\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) g\[Lambda]3 h\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) g\[Lambda]4 h\[Lambda]4;
\[Rho]43 = 
  E^(-\[Beta] \[Lambda]2) g\[Lambda]2 h\[Lambda]2 + 
   E^(-\[Beta] \[Lambda]3) g\[Lambda]3 h\[Lambda]3 + 
   E^(-\[Beta] \[Lambda]4) g\[Lambda]4 h\[Lambda]4;
\[Rho]44 = 
  E^(-\[Beta] \[Lambda]2) h\[Lambda]2^2 + 
   E^(-\[Beta] \[Lambda]3) h\[Lambda]3^2 + 
   E^(-\[Beta] \[Lambda]4) h\[Lambda]4^2;

Z = E^(-\[Beta] (\[Lambda]1 + \[Lambda]2 + \[Lambda]3 + \[Lambda]4)) \
(E^(\[Beta] (\[Lambda]2 + \[Lambda]3 + \[Lambda]4)) + 
     E^(\[Beta] (\[Lambda]1 + \[Lambda]3 + \[Lambda]4)) \
(F\[Lambda]2^2 + 2 g\[Lambda]2^2 + h\[Lambda]2^2) + 
     E^(\[Beta] (\[Lambda]1 + \[Lambda]2 + \[Lambda]4)) \
(F\[Lambda]3^2 + 2 g\[Lambda]3^2 + h\[Lambda]3^2) + 
     E^(\[Beta] (\[Lambda]1 + \[Lambda]2 + \[Lambda]3)) \
(F\[Lambda]4^2 + 2 g\[Lambda]4^2 + h\[Lambda]4^2));

a11 = (\[Rho]14^2 - \[Rho]13 \[Rho]24 - \[Rho]12 \[Rho]34 + \[Rho]11 \
\[Rho]44)/Z^2;
a12 = (\[Rho]13 (-\[Rho]14 + \[Rho]23) + \[Rho]12 \[Rho]33 - \[Rho]11 \
\[Rho]43)/Z^2;
a13 = (\[Rho]13 \[Rho]22 + \[Rho]12 (-\[Rho]14 + \[Rho]32) - \[Rho]11 \
\[Rho]42)/Z^2;
a14 = (-\[Rho]13 \[Rho]21 - \[Rho]12 \[Rho]31 + \[Rho]11 (\[Rho]14 + \
\[Rho]41))/Z^2;
a21 = (\[Rho]14 \[Rho]24 - \[Rho]23 \[Rho]24 - \[Rho]22 \[Rho]34 + \
\[Rho]21 \[Rho]44)/Z^2;
a22 = (\[Rho]23^2 - \[Rho]13 \[Rho]24 + \[Rho]22 \[Rho]33 - \[Rho]21 \
\[Rho]43)/Z^2;
a23 = (-\[Rho]12 \[Rho]24 + \[Rho]22 (\[Rho]23 + \[Rho]32) - \[Rho]21 \
\[Rho]42)/Z^2;
a24 = (\[Rho]11 \[Rho]24 - \[Rho]22 \[Rho]31 + \[Rho]21 (-\[Rho]23 + \
\[Rho]41))/Z^2;
a31 = (-\[Rho]24 \[Rho]33 + \[Rho]14 \[Rho]34 - \[Rho]32 \[Rho]34 + \
\[Rho]31 \[Rho]44)/Z^2;
a32 = (\[Rho]23 \[Rho]33 + \[Rho]32 \[Rho]33 - \[Rho]13 \[Rho]34 - \
\[Rho]31 \[Rho]43)/Z^2;
a33 = (\[Rho]32^2 + \[Rho]22 \[Rho]33 - \[Rho]12 \[Rho]34 - \[Rho]31 \
\[Rho]42)/Z^2;
a34 = (-\[Rho]21 \[Rho]33 + \[Rho]11 \[Rho]34 + \[Rho]31 (-\[Rho]32 + \
\[Rho]41))/Z^2;
a41 = (-\[Rho]34 \[Rho]42 - \[Rho]24 \[Rho]43 + (\[Rho]14 + \[Rho]41) \
\[Rho]44)/Z^2;
a42 = (\[Rho]33 \[Rho]42 + \[Rho]23 \[Rho]43 - \[Rho]41 \[Rho]43 - \
\[Rho]13 \[Rho]44)/Z^2;
a43 = (\[Rho]32 \[Rho]42 - \[Rho]41 \[Rho]42 + \[Rho]22 \[Rho]43 - \
\[Rho]12 \[Rho]44)/Z^2;
a44 = (\[Rho]41^2 - \[Rho]31 \[Rho]42 - \[Rho]21 \[Rho]43 + \[Rho]11 \
\[Rho]44)/Z^2;

\[Alpha]0 = 
  a14 a23 a32 a41 - a13 a24 a32 a41 - a14 a22 a33 a41 + 
   a12 a24 a33 a41 + a13 a22 a34 a41 - a12 a23 a34 a41 - 
   a14 a23 a31 a42 + a13 a24 a31 a42 + a14 a21 a33 a42 - 
   a11 a24 a33 a42 - a13 a21 a34 a42 + a11 a23 a34 a42 + 
   a14 a22 a31 a43 - a12 a24 a31 a43 - a14 a21 a32 a43 + 
   a11 a24 a32 a43 + a12 a21 a34 a43 - a11 a22 a34 a43 - 
   a13 a22 a31 a44 + a12 a23 a31 a44 + a13 a21 a32 a44 - 
   a11 a23 a32 a44 - a12 a21 a33 a44 + a11 a22 a33 a44;
\[Alpha]1 = (a13 a22 a31 - a12 a23 a31 - a13 a21 a32 + a11 a23 a32 + 
    a12 a21 a33 - a11 a22 a33 + a14 a22 a41 - a12 a24 a41 + 
    a14 a33 a41 - a13 a34 a41 - a14 a21 a42 + a11 a24 a42 + 
    a24 a33 a42 - a23 a34 a42 - a14 a31 a43 - a24 a32 a43 + 
    a11 a34 a43 + a22 a34 a43 + a12 a21 a44 - a11 a22 a44 + 
    a13 a31 a44 + a23 a32 a44 - a11 a33 a44 - a22 a33 a44);
\[Alpha]2 = (-a12 a21 + a11 a22 - a13 a31 - a23 a32 + a11 a33 + 
    a22 a33 - a14 a41 - a24 a42 - a34 a43 + a11 a44 + a22 a44 + 
    a33 a44);
\[Alpha]3 = (-a11 - a22 - a33 - a44);

r = 12 \[Alpha]0 + \[Alpha]2^2 - 3 \[Alpha]1 \[Alpha]3;
s = -8 \[Alpha]1 + 4 \[Alpha]2 \[Alpha]3 - \[Alpha]3^3;
t = (27 \[Alpha]1^2 - 72 \[Alpha]0 \[Alpha]2 + 2 \[Alpha]2^3 - 
    9 \[Alpha]1 \[Alpha]2 \[Alpha]3 + 27 \[Alpha]0 \[Alpha]3^2 + 
    Sqrt[-4 r^3 + (27 \[Alpha]1^2 - 72 \[Alpha]0 \[Alpha]2 + 
       2 \[Alpha]2^3 - 9 \[Alpha]1 \[Alpha]2 \[Alpha]3 + 
       27 \[Alpha]0 \[Alpha]3^2)^2])^(1/3);

\[Omega]1 = -(\[Alpha]3/4) - 
   1/2 Sqrt[(2^(1/3) r)/(3 t) + t/(3 2^(1/3)) - (2 \[Alpha]2)/
     3 + \[Alpha]3^2/4] - 
   1/2 Sqrt[-((2^(1/3) r)/(3 t)) - t/(3 2^(1/3)) - (4 \[Alpha]2)/
     3 + \[Alpha]3^2/2 - s/(
     4 Sqrt[(2^(1/3) r)/(3 t) + t/(3 2^(1/3)) - (2 \[Alpha]2)/
       3 + \[Alpha]3^2/4])];
\[Omega]2 = -(\[Alpha]3/4) - 
   1/2 Sqrt[(2^(1/3) r)/(3 t) + t/(3 2^(1/3)) - (2 \[Alpha]2)/
     3 + \[Alpha]3^2/4] + 
   1/2 Sqrt[-((2^(1/3) r)/(3 t)) - t/(3 2^(1/3)) - (4 \[Alpha]2)/
     3 + \[Alpha]3^2/2 - s/(
     4 Sqrt[(2^(1/3) r)/(3 t) + t/(3 2^(1/3)) - (2 \[Alpha]2)/
       3 + \[Alpha]3^2/4])];
\[Omega]3 = -(\[Alpha]3/4) + 
   1/2 Sqrt[(2^(1/3) r)/(3 t) + t/(3 2^(1/3)) - (2 \[Alpha]2)/
     3 + \[Alpha]3^2/4] - 
   1/2 Sqrt[-((2^(1/3) r)/(3 t)) - t/(3 2^(1/3)) - (4 \[Alpha]2)/
     3 + \[Alpha]3^2/2 + s/(
     4 Sqrt[(2^(1/3) r)/(3 t) + t/(3 2^(1/3)) - (2 \[Alpha]2)/
       3 + \[Alpha]3^2/4])];
\[Omega]4 = -(\[Alpha]3/4) + 
   1/2 Sqrt[(2^(1/3) r)/(3 t) + t/(3 2^(1/3)) - (2 \[Alpha]2)/
     3 + \[Alpha]3^2/4] + 
   1/2 Sqrt[-((2^(1/3) r)/(3 t)) - t/(3 2^(1/3)) - (4 \[Alpha]2)/
     3 + \[Alpha]3^2/2 + s/(
     4 Sqrt[(2^(1/3) r)/(3 t) + t/(3 2^(1/3)) - (2 \[Alpha]2)/
       3 + \[Alpha]3^2/4])];

\[Omega]Sqr1a = Sqrt[\[Omega]1];
\[Omega]Sqr2a = Sqrt[\[Omega]2];
\[Omega]Sqr3a = Sqrt[\[Omega]3];
\[Omega]Sqr4a = Sqrt[\[Omega]4];

\[Omega]Sqr1 = Abs[\[Omega]Sqr1a];
\[Omega]Sqr2 = Abs[\[Omega]Sqr2a];
\[Omega]Sqr3 = Abs[\[Omega]Sqr3a];
\[Omega]Sqr4 = Abs[\[Omega]Sqr4a];

\[Omega]Max = 
  Max[\[Omega]Sqr1, \[Omega]Sqr2, \[Omega]Sqr3, \[Omega]Sqr4];
ConcT = Max[0, 
   2  \[Omega]Max - \[Omega]Sqr1 - \[Omega]Sqr2 - \[Omega]Sqr3 - \
\[Omega]Sqr4];

Plot3D[ConcT, {Bx, -3, 3}, {Bz, -3, 3}]

"The function that I want to plot is simple but somewhat long because it depends on variables which in turn also depends on another variables and so on. Although each cell does not take long, the plotting takes more than a day without giving results. My Code is: "

| improve this question | | | | |
$\endgroup$
2
$\begingroup$

One time use and forget solution:

Clear@ConcT; ConcT[Bx_, Bz_] := (
  J = 1;
  Jz = 0.2;
  T = 0.2;
  \[Beta] = 1/T;
  B = Sqrt[Bx^2 + Bz^2];

  \[Zeta] = 
   ArcCos[((J - Jz) (-9 B^2 + 4 (J - Jz)^2 - 
         27 (Bz^2 - Bx^2)))/(4 (Sqrt[3 B^2 + (J - Jz)^2])^3)];
  \[Lambda]1 = -2 J - Jz;
  \[Lambda]2 = 
   1/3 (2 J + Jz + 4 Sqrt[3 B^2 + (J - Jz)^2] Cos[1/3 \[Zeta]]);
  \[Lambda]3 = 
   1/3 (2 J + Jz + 
      4 Sqrt[3 B^2 + (J - Jz)^2] Cos[1/3 \[Zeta] + 2/3 \[Pi]]);
  \[Lambda]4 = 
   1/3 (2 J + Jz + 
      4 Sqrt[3 B^2 + (J - Jz)^2] Cos[1/3 \[Zeta] + 4/3 \[Pi]]);

  M2 = \[Sqrt](4 Bx^4 + 
      2 Bx^2 (2 Bz - 
          Jz + \[Lambda]2)^2 + (2 Bx^2 + (2 J - 
            Jz - \[Lambda]2) (2 Bz - Jz + \[Lambda]2))^2);
  M3 = \[Sqrt](4 Bx^4 + 
      2 Bx^2 (2 Bz - 
          Jz + \[Lambda]3)^2 + (2 Bx^2 + (2 J - 
            Jz - \[Lambda]3) (2 Bz - Jz + \[Lambda]3))^2);
  M4 = \[Sqrt](4 Bx^4 + 
      2 Bx^2 (2 Bz - 
          Jz + \[Lambda]4)^2 + (2 Bx^2 + (2 J - 
            Jz - \[Lambda]4) (2 Bz - Jz + \[Lambda]4))^2);

  F\[Lambda]2 = -(2 Bx^2 + (2 J - Jz - \[Lambda]2) (2 Bz - 
          Jz + \[Lambda]2))/M2;
  g\[Lambda]2 = (Bx (2 Bz - Jz + \[Lambda]2))/M2;
  h\[Lambda]2 = (2 Bx^2)/M2;
  F\[Lambda]3 = -(2 Bx^2 + (2 J - Jz - \[Lambda]3) (2 Bz - 
          Jz + \[Lambda]3))/M3;
  g\[Lambda]3 = (Bx (2 Bz - Jz + \[Lambda]3))/M3;
  h\[Lambda]3 = (2 Bx^2)/M3;
  F\[Lambda]4 = -(2 Bx^2 + (2 J - Jz - \[Lambda]4) (2 Bz - 
          Jz + \[Lambda]4))/M4;
  g\[Lambda]4 = (Bx (2 Bz - Jz + \[Lambda]4))/M4;
  h\[Lambda]4 = (2 Bx^2)/M4;

  \[Rho]11 = 
   E^(-\[Beta] \[Lambda]2) F\[Lambda]2^2 + 
    E^(-\[Beta] \[Lambda]3) F\[Lambda]3^2 + 
    E^(-\[Beta] \[Lambda]4) F\[Lambda]4^2;
  \[Rho]12 = 
   E^(-\[Beta] \[Lambda]2) F\[Lambda]2 g\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) F\[Lambda]3 g\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) F\[Lambda]4 g\[Lambda]4;
  \[Rho]13 = 
   E^(-\[Beta] \[Lambda]2) F\[Lambda]2 g\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) F\[Lambda]3 g\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) F\[Lambda]4 g\[Lambda]4;
  \[Rho]14 = 
   E^(-\[Beta] \[Lambda]2) F\[Lambda]2 h\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) F\[Lambda]3 h\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) F\[Lambda]4 h\[Lambda]4;
  \[Rho]21 = 
   E^(-\[Beta] \[Lambda]2) F\[Lambda]2 g\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) F\[Lambda]3 g\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) F\[Lambda]4 g\[Lambda]4;
  \[Rho]22 = 
   E^(-\[Beta] \[Lambda]1)/2 + E^(-\[Beta] \[Lambda]2) g\[Lambda]2^2 +
     E^(-\[Beta] \[Lambda]3) g\[Lambda]3^2 + 
    E^(-\[Beta] \[Lambda]4) g\[Lambda]4^2;
  \[Rho]23 = -(1/2) E^(-\[Beta] \[Lambda]1) + 
    E^(-\[Beta] \[Lambda]2) g\[Lambda]2^2 + 
    E^(-\[Beta] \[Lambda]3) g\[Lambda]3^2 + 
    E^(-\[Beta] \[Lambda]4) g\[Lambda]4^2;
  \[Rho]24 = 
   E^(-\[Beta] \[Lambda]2) g\[Lambda]2 h\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) g\[Lambda]3 h\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) g\[Lambda]4 h\[Lambda]4;
  \[Rho]31 = 
   E^(-\[Beta] \[Lambda]2) F\[Lambda]2 g\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) F\[Lambda]3 g\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) F\[Lambda]4 g\[Lambda]4;
  \[Rho]32 = -(1/2) E^(-\[Beta] \[Lambda]1) + 
    E^(-\[Beta] \[Lambda]2) g\[Lambda]2^2 + 
    E^(-\[Beta] \[Lambda]3) g\[Lambda]3^2 + 
    E^(-\[Beta] \[Lambda]4) g\[Lambda]4^2;
  \[Rho]33 = 
   E^(-\[Beta] \[Lambda]1)/2 + E^(-\[Beta] \[Lambda]2) g\[Lambda]2^2 +
     E^(-\[Beta] \[Lambda]3) g\[Lambda]3^2 + 
    E^(-\[Beta] \[Lambda]4) g\[Lambda]4^2;
  \[Rho]34 = 
   E^(-\[Beta] \[Lambda]2) g\[Lambda]2 h\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) g\[Lambda]3 h\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) g\[Lambda]4 h\[Lambda]4;
  \[Rho]41 = 
   E^(-\[Beta] \[Lambda]2) F\[Lambda]2 h\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) F\[Lambda]3 h\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) F\[Lambda]4 h\[Lambda]4;
  \[Rho]42 = 
   E^(-\[Beta] \[Lambda]2) g\[Lambda]2 h\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) g\[Lambda]3 h\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) g\[Lambda]4 h\[Lambda]4;
  \[Rho]43 = 
   E^(-\[Beta] \[Lambda]2) g\[Lambda]2 h\[Lambda]2 + 
    E^(-\[Beta] \[Lambda]3) g\[Lambda]3 h\[Lambda]3 + 
    E^(-\[Beta] \[Lambda]4) g\[Lambda]4 h\[Lambda]4;
  \[Rho]44 = 
   E^(-\[Beta] \[Lambda]2) h\[Lambda]2^2 + 
    E^(-\[Beta] \[Lambda]3) h\[Lambda]3^2 + 
    E^(-\[Beta] \[Lambda]4) h\[Lambda]4^2;

  Z = E^(-\[Beta] (\[Lambda]1 + \[Lambda]2 + \[Lambda]3 + \
\[Lambda]4)) (E^(\[Beta] (\[Lambda]2 + \[Lambda]3 + \[Lambda]4)) + 
      E^(\[Beta] (\[Lambda]1 + \[Lambda]3 + \[Lambda]4)) \
(F\[Lambda]2^2 + 2 g\[Lambda]2^2 + h\[Lambda]2^2) + 
      E^(\[Beta] (\[Lambda]1 + \[Lambda]2 + \[Lambda]4)) \
(F\[Lambda]3^2 + 2 g\[Lambda]3^2 + h\[Lambda]3^2) + 
      E^(\[Beta] (\[Lambda]1 + \[Lambda]2 + \[Lambda]3)) \
(F\[Lambda]4^2 + 2 g\[Lambda]4^2 + h\[Lambda]4^2));

  a11 = (\[Rho]14^2 - \[Rho]13 \[Rho]24 - \[Rho]12 \[Rho]34 + \
\[Rho]11 \[Rho]44)/Z^2;
  a12 = (\[Rho]13 (-\[Rho]14 + \[Rho]23) + \[Rho]12 \[Rho]33 - \
\[Rho]11 \[Rho]43)/Z^2;
  a13 = (\[Rho]13 \[Rho]22 + \[Rho]12 (-\[Rho]14 + \[Rho]32) - \
\[Rho]11 \[Rho]42)/Z^2;
  a14 = (-\[Rho]13 \[Rho]21 - \[Rho]12 \[Rho]31 + \[Rho]11 (\[Rho]14 \
+ \[Rho]41))/Z^2;
  a21 = (\[Rho]14 \[Rho]24 - \[Rho]23 \[Rho]24 - \[Rho]22 \[Rho]34 + \
\[Rho]21 \[Rho]44)/Z^2;
  a22 = (\[Rho]23^2 - \[Rho]13 \[Rho]24 + \[Rho]22 \[Rho]33 - \
\[Rho]21 \[Rho]43)/Z^2;
  a23 = (-\[Rho]12 \[Rho]24 + \[Rho]22 (\[Rho]23 + \[Rho]32) - \
\[Rho]21 \[Rho]42)/Z^2;
  a24 = (\[Rho]11 \[Rho]24 - \[Rho]22 \[Rho]31 + \[Rho]21 (-\[Rho]23 \
+ \[Rho]41))/Z^2;
  a31 = (-\[Rho]24 \[Rho]33 + \[Rho]14 \[Rho]34 - \[Rho]32 \[Rho]34 + \
\[Rho]31 \[Rho]44)/Z^2;
  a32 = (\[Rho]23 \[Rho]33 + \[Rho]32 \[Rho]33 - \[Rho]13 \[Rho]34 - \
\[Rho]31 \[Rho]43)/Z^2;
  a33 = (\[Rho]32^2 + \[Rho]22 \[Rho]33 - \[Rho]12 \[Rho]34 - \
\[Rho]31 \[Rho]42)/Z^2;
  a34 = (-\[Rho]21 \[Rho]33 + \[Rho]11 \[Rho]34 + \[Rho]31 (-\[Rho]32 \
+ \[Rho]41))/Z^2;
  a41 = (-\[Rho]34 \[Rho]42 - \[Rho]24 \[Rho]43 + (\[Rho]14 + \
\[Rho]41) \[Rho]44)/Z^2;
  a42 = (\[Rho]33 \[Rho]42 + \[Rho]23 \[Rho]43 - \[Rho]41 \[Rho]43 - \
\[Rho]13 \[Rho]44)/Z^2;
  a43 = (\[Rho]32 \[Rho]42 - \[Rho]41 \[Rho]42 + \[Rho]22 \[Rho]43 - \
\[Rho]12 \[Rho]44)/Z^2;
  a44 = (\[Rho]41^2 - \[Rho]31 \[Rho]42 - \[Rho]21 \[Rho]43 + \
\[Rho]11 \[Rho]44)/Z^2;

  \[Alpha]0 = 
   a14 a23 a32 a41 - a13 a24 a32 a41 - a14 a22 a33 a41 + 
    a12 a24 a33 a41 + a13 a22 a34 a41 - a12 a23 a34 a41 - 
    a14 a23 a31 a42 + a13 a24 a31 a42 + a14 a21 a33 a42 - 
    a11 a24 a33 a42 - a13 a21 a34 a42 + a11 a23 a34 a42 + 
    a14 a22 a31 a43 - a12 a24 a31 a43 - a14 a21 a32 a43 + 
    a11 a24 a32 a43 + a12 a21 a34 a43 - a11 a22 a34 a43 - 
    a13 a22 a31 a44 + a12 a23 a31 a44 + a13 a21 a32 a44 - 
    a11 a23 a32 a44 - a12 a21 a33 a44 + a11 a22 a33 a44;
  \[Alpha]1 = (a13 a22 a31 - a12 a23 a31 - a13 a21 a32 + a11 a23 a32 +
      a12 a21 a33 - a11 a22 a33 + a14 a22 a41 - a12 a24 a41 + 
     a14 a33 a41 - a13 a34 a41 - a14 a21 a42 + a11 a24 a42 + 
     a24 a33 a42 - a23 a34 a42 - a14 a31 a43 - a24 a32 a43 + 
     a11 a34 a43 + a22 a34 a43 + a12 a21 a44 - a11 a22 a44 + 
     a13 a31 a44 + a23 a32 a44 - a11 a33 a44 - a22 a33 a44);
  \[Alpha]2 = (-a12 a21 + a11 a22 - a13 a31 - a23 a32 + a11 a33 + 
     a22 a33 - a14 a41 - a24 a42 - a34 a43 + a11 a44 + a22 a44 + 
     a33 a44);
  \[Alpha]3 = (-a11 - a22 - a33 - a44);

  r = 12 \[Alpha]0 + \[Alpha]2^2 - 3 \[Alpha]1 \[Alpha]3;
  s = -8 \[Alpha]1 + 4 \[Alpha]2 \[Alpha]3 - \[Alpha]3^3;
  t = (27 \[Alpha]1^2 - 72 \[Alpha]0 \[Alpha]2 + 2 \[Alpha]2^3 - 
      9 \[Alpha]1 \[Alpha]2 \[Alpha]3 + 27 \[Alpha]0 \[Alpha]3^2 + 
      Sqrt[-4 r^3 + (27 \[Alpha]1^2 - 72 \[Alpha]0 \[Alpha]2 + 
           2 \[Alpha]2^3 - 9 \[Alpha]1 \[Alpha]2 \[Alpha]3 + 
           27 \[Alpha]0 \[Alpha]3^2)^2])^(1/3);

  \[Omega]1 = -(\[Alpha]3/4) - 
    1/2 Sqrt[(2^(1/3) r)/(3 t) + 
       t/(3 2^(1/3)) - (2 \[Alpha]2)/3 + \[Alpha]3^2/4] - 
    1/2 Sqrt[-((2^(1/3) r)/(3 t)) - 
       t/(3 2^(1/3)) - (4 \[Alpha]2)/3 + \[Alpha]3^2/2 - 
       s/(4 Sqrt[(2^(1/3) r)/(3 t) + 
            t/(3 2^(1/3)) - (2 \[Alpha]2)/3 + \[Alpha]3^2/4])];
  \[Omega]2 = -(\[Alpha]3/4) - 
    1/2 Sqrt[(2^(1/3) r)/(3 t) + 
       t/(3 2^(1/3)) - (2 \[Alpha]2)/3 + \[Alpha]3^2/4] + 
    1/2 Sqrt[-((2^(1/3) r)/(3 t)) - 
       t/(3 2^(1/3)) - (4 \[Alpha]2)/3 + \[Alpha]3^2/2 - 
       s/(4 Sqrt[(2^(1/3) r)/(3 t) + 
            t/(3 2^(1/3)) - (2 \[Alpha]2)/3 + \[Alpha]3^2/4])];
  \[Omega]3 = -(\[Alpha]3/4) + 
    1/2 Sqrt[(2^(1/3) r)/(3 t) + 
       t/(3 2^(1/3)) - (2 \[Alpha]2)/3 + \[Alpha]3^2/4] - 
    1/2 Sqrt[-((2^(1/3) r)/(3 t)) - 
       t/(3 2^(1/3)) - (4 \[Alpha]2)/3 + \[Alpha]3^2/2 + 
       s/(4 Sqrt[(2^(1/3) r)/(3 t) + 
            t/(3 2^(1/3)) - (2 \[Alpha]2)/3 + \[Alpha]3^2/4])];
  \[Omega]4 = -(\[Alpha]3/4) + 
    1/2 Sqrt[(2^(1/3) r)/(3 t) + 
       t/(3 2^(1/3)) - (2 \[Alpha]2)/3 + \[Alpha]3^2/4] + 
    1/2 Sqrt[-((2^(1/3) r)/(3 t)) - 
       t/(3 2^(1/3)) - (4 \[Alpha]2)/3 + \[Alpha]3^2/2 + 
       s/(4 Sqrt[(2^(1/3) r)/(3 t) + 
            t/(3 2^(1/3)) - (2 \[Alpha]2)/3 + \[Alpha]3^2/4])];

  \[Omega]Sqr1a = Sqrt[\[Omega]1];
  \[Omega]Sqr2a = Sqrt[\[Omega]2];
  \[Omega]Sqr3a = Sqrt[\[Omega]3];
  \[Omega]Sqr4a = Sqrt[\[Omega]4];

  \[Omega]Sqr1 = Abs[\[Omega]Sqr1a];
  \[Omega]Sqr2 = Abs[\[Omega]Sqr2a];
  \[Omega]Sqr3 = Abs[\[Omega]Sqr3a];
  \[Omega]Sqr4 = Abs[\[Omega]Sqr4a];

  \[Omega]Max = 
   Max[\[Omega]Sqr1, \[Omega]Sqr2, \[Omega]Sqr3, \[Omega]Sqr4];
  Max[0, 2 \[Omega]Max - \[Omega]Sqr1 - \[Omega]Sqr2 - \[Omega]Sqr3 - \
\[Omega]Sqr4]
  )
Plot3D[ConcT[Bx, Bz], {Bx, -3, 3}, {Bz, -3, 3}] // AbsoluteTiming

Those calculations looks like some evaluations on matrices. Mathematica supports those, you can check out in-built documentation and a lot of similar questions on SE, for example this and this.

| improve this answer | | | | |
$\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.