1
$\begingroup$

I have a notebook running for more than five hours.

The question is if and how I can make it faster. If there is not a way please leave a comment, so that I know.

In the matrices with a final index $1$ or $2$ I have left arbitrary symbols denoting some things like derivatives, etc. At this point I just need Mathematica to spit the result, then make some manipulations, and at the very final stage make the terms functions and calculate their equations of motion.

The reason for making this choice is that in principle the expressions for the elements of the matrixes are inverse trig functions and their derivatives. Also, some of the terms combine and I can use eigenvalues to replace many terms and big structures.

The code is the following.

These are my $8 \times 8$ matrices

gp0 = {{(1 - z^2/(4 L^2))^2/z^2, 0, 0, 0, 0, 0, 0, 
    0}, {0, (1 - z^2/(4 L^2))^2/z^2, 0, 0, 0, 0, 0, 0}, {0, 
    0, (1 - z^2/(4 L^2))^2/z^2, 0, 0, 0, 0, 0}, {0, 0, 
    0, (1 - z^2/(4 L^2))^2/z^2, 0, 0, 0, 0}, {0, 0, 0, 0, (
    1 + z^2 qb'[z]^2)/z^2, 0, 0, 0}, {0, 0, 0, 0, 0, Sin[q[z]]^2, 0, 
    0}, {0, 0, 0, 0, 0, 0, Sin[qb[z]]^2 Sin[x1]^2, 0}, {0, 0, 0, 0, 0,
     0, 0, Sin[qb[z]]^2 Sin[x1]^2 Sin[x2]^2}};


gf0 = {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 
    0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, gfzc1, 
    gfzc2, gfzc3}, {0, 0, 0, 0, gfc1z, 0, gfc1c2, gfc1c3}, {0, 0, 0, 
    0, gfc2z, gfc2c1, 0, gfc2c3}, {0, 0, 0, 0, gfc3z, gfc3c1, gfc3c2, 
    0}};

gp1 = {{0, 0, 0, 0, qb'[z] q1t, 0, 0, 0}, {0, 0, 0, 0, qb'[z] q1x, 0, 
    0, 0}, {0, 0, 0, 0, qb'[z] q1y, 0, 0, 0}, {0, 0, 0, 0, qb'[z] q1r,
     0, 0, 0}, {qb'[z] q1t, qb'[z] q1x, qb'[z] q1y, qb'[z] q1r, 
    2 qb'[z] q1z, qb'[z] q1c1, qb'[z] q1c2, qb'[z] q1c3}, {0, 0, 0, 0,
     qb'[z] q1c1, q1 Sin[2 qb[z]], 0, 0}, {0, 0, 0, 0, qb'[z] q1c2, 0,
     q1 Sin[2 qb[z]] Sin[x1]^2, 0}, {0, 0, 0, 0, qb'[z] q1c3, 0, 0, 
    q1 Sin[2 qb[z]] Sin[x1]^2 Sin[x2]^2}};


gf1 = {{0, 0, 0, 0, 0, gf1tc1, gf1tc2, gf1tc3}, {0, 0, 0, 0, 0, 
    gf1xc1, gf1xc2, gf1xc3}, {0, 0, 0, 0, 0, gf1yc1, gf1yc2, 
    gf1yc3}, {0, 0, 0, 0, 0, gf1rc1, gf1rc2, gf1rc3}, {0, 0, 0, 0, 0, 
    gf1zc1, gf1zc2, gf1zc3}, {gf1c1t, gf1c1x, gf1c1y, gf1c1r, gf1c1z, 
    0, gf1c1c2, gf1c1c3}, {gf1c2t, gf1c2x, gf1c2y, gf1c2r, gf1c2z, 
    gf1c2c1, 0, gf1c2c3}, {gf1c3t, gf1c3x, gf1c3y, gf1c3r, gf1c3z, 
    gf1c3c1, gf1c3c2, 0}};


gp2 = {{q1t^2, q1t q1x, q1t q1y, q1t q1r, q1t q1z, q1t q1c1 , 
    q1t q1c2, q1t q1c3 }, {q1x q1t, q1x^2, q1x q1y, q1x q1r, q1x q1z, 
    q1x q1c1 , q1x q1c2, q1x q1c3}, {q1y q1t, q1y q1x, q1y^2, q1y q1r,
     q1y q1z, q1y q1c1, q1y q1c2, q1y q1c3}, {q1r q1t, q1r q1x, 
    q1r q1y, q1r^2, q1r q1z, q1r q1c1, q1r q1c2, q1r q1c3}, {q1z q1t, 
    q1z q1x, q1z q1y, q1z q1r, q1z^2, q1z q1c1, q1z q1c2, 
    q1z q1c3}, {q1c1 q1t, q1c1 q1x, q1c1 q1y, q1c1 q1r, q1c1 q1z, 
    q1c1^2 + q1^2 Cos[2 qb[z]], q1c1 q1c2, q1c1 q1c3}, {q1c2 q1t, 
    q1c2 q1x, q1c2 q1y, q1c2 q1r, q1c2 q1z, q1c1 q1c2, 
    q1c2^2 + q1^2 Cos[2 qb[z]] Sin[x1]^2, q1c2 q1c3}, {q1c3 q1t, 
    q1c3 q1x, q1c3 q1y, q1c3 q1r, q1c3 q1z, q1c1 q1c3, q1c2 q1c3, 
    q1c3^2 + q1^2 Cos[2 qb[z]] Sin[x1]^2 Sin[x2]^2}};


gf2 = {{0, 0, 0, 0, 0, gf2tc1, gf2tc2, gf2tc3}, {0, 0, 0, 0, 0, 
    gf2xc1, gf2xc2, gf2xc3}, {0, 0, 0, 0, 0, gf2yc1, gf2yc2, 
    gf2yc3}, {0, 0, 0, 0, 0, gf2rc1, gf2rc2, gf2rc3}, {0, 0, 0, 0, 0, 
    gf2zc1, gf2zc2, gf2zc3}, {gf2c1t, gf2c1x, gf2c1y, gf2c1r, gf2c1z, 
    0, gf2c1c2, gf1c1c3}, {gf2c2t, gf2c2x, gf2c2y, gf2c2r, gf2c2z, 
    gf2c2c1, 0, gf2c2c3}, {gf2c3t, gf2c3x, gf2c3y, gf2c3r, gf2c3z, 
    gf2c3c1, gf2c3c2, 0}};

And then what I want to calculate is the following, which is the square root of the determinant of the sum of all of the above and take the Taylor series when $L$ goes to infinity and $\delta$ goes to zero.

Series[Normal[
    Series[Sqrt[
      Det[(gp0 + 
          1/L^2 gf0) + δ (gp1 + 1/L^2 gf1) + δ^2 (gp2 + 
           1/L^2 gf2)]], {L, Infinity, 2}]], {δ, 0, 2}] // 
  Coefficient[#, δ^2] & // AbsoluteTiming

Some more comments:

When I take the following case -just considering the $gp0, gp1,gp2$ matrices- the situation is not bad actually. The calculation is done in a minute and a half.

Series[Normal[
    Series[Sqrt[Det[gp0 + δ gp1 + δ^2 gp2]], {L, 
      Infinity, 2}]], {δ, 0, 2}] // 
  Coefficient[#, δ^2] & // AbsoluteTiming

{67.5812, -1/(8 L^2 (1 + z^2 Derivative[1][qb][z]^2)^2)
    Sqrt[(Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
      qb[z]]^4 (1 + z^2 Derivative[1][qb][z]^2))/
    z^10] (-4 L^2 q1r^2 z^2 - 4 L^2 q1t^2 z^2 - 4 L^2 q1x^2 z^2 - 
      4 L^2 q1y^2 z^2 - 4 L^2 q1z^2 z^2 + 2 q1r^2 z^4 + 2 q1t^2 z^4 + 
      2 q1x^2 z^4 + 2 q1y^2 z^4 + 4 q1z^2 z^4 - 
      4 L^2 q1c1^2 Csc[q[z]]^2 + 4 q1c1^2 z^2 Csc[q[z]]^2 - 
      4 L^2 q1^2 Cos[2 qb[z]] Csc[q[z]]^2 + 
      4 q1^2 z^2 Cos[2 qb[z]] Csc[q[z]]^2 - 
      8 L^2 q1^2 Cos[2 qb[z]] Csc[qb[z]]^2 + 
      8 q1^2 z^2 Cos[2 qb[z]] Csc[qb[z]]^2 - 
      4 L^2 q1c2^2 Csc[x1]^2 Csc[qb[z]]^2 + 
      4 q1c2^2 z^2 Csc[x1]^2 Csc[qb[z]]^2 - 
      4 L^2 q1c3^2 Csc[x1]^2 Csc[x2]^2 Csc[qb[z]]^2 + 
      4 q1c3^2 z^2 Csc[x1]^2 Csc[x2]^2 Csc[qb[z]]^2 + 
      L^2 q1^2 Csc[q[z]]^4 Sin[2 qb[z]]^2 - 
      q1^2 z^2 Csc[q[z]]^4 Sin[2 qb[z]]^2 - 
      4 L^2 q1^2 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[2 qb[z]]^2 + 
      4 q1^2 z^2 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[2 qb[z]]^2 - 
      4 L^2 q1 q1z z^2 Csc[q[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
        z] + 
      4 q1 q1z z^4 Csc[q[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z] - 
      8 L^2 q1 q1z z^2 Csc[qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
        z] + 8 q1 q1z z^4 Csc[qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
        z] - 4 L^2 q1r^2 z^4 Derivative[1][qb][z]^2 - 
      4 L^2 q1t^2 z^4 Derivative[1][qb][z]^2 - 
      4 L^2 q1x^2 z^4 Derivative[1][qb][z]^2 - 
      4 L^2 q1y^2 z^4 Derivative[1][qb][z]^2 + 
      2 q1r^2 z^6 Derivative[1][qb][z]^2 + 
      2 q1t^2 z^6 Derivative[1][qb][z]^2 + 
      2 q1x^2 z^6 Derivative[1][qb][z]^2 + 
      2 q1y^2 z^6 Derivative[1][qb][z]^2 - 
      4 L^2 q1c1^2 z^2 Csc[q[z]]^2 Derivative[1][qb][z]^2 + 
      4 q1c1^2 z^4 Csc[q[z]]^2 Derivative[1][qb][z]^2 - 
      8 L^2 q1^2 z^2 Cos[2 qb[z]] Csc[q[z]]^2 Derivative[1][qb][
        z]^2 + 8 q1^2 z^4 Cos[2 qb[z]] Csc[q[z]]^2 Derivative[1][qb][
        z]^2 - 16 L^2 q1^2 z^2 Cos[2 qb[z]] Csc[qb[z]]^2 Derivative[
        1][qb][z]^2 + 
      16 q1^2 z^4 Cos[2 qb[z]] Csc[qb[z]]^2 Derivative[1][qb][z]^2 - 
      4 L^2 q1c2^2 z^2 Csc[x1]^2 Csc[qb[z]]^2 Derivative[1][qb][
        z]^2 + 
      4 q1c2^2 z^4 Csc[x1]^2 Csc[qb[z]]^2 Derivative[1][qb][z]^2 - 
      4 L^2 q1c3^2 z^2 Csc[x1]^2 Csc[x2]^2 Csc[qb[z]]^2 Derivative[1][
        qb][z]^2 + 
      4 q1c3^2 z^4 Csc[x1]^2 Csc[x2]^2 Csc[qb[z]]^2 Derivative[1][qb][
        z]^2 + 2 L^2 q1^2 z^2 Csc[q[z]]^4 Sin[2 qb[z]]^2 Derivative[
        1][qb][z]^2 - 
      2 q1^2 z^4 Csc[q[z]]^4 Sin[2 qb[z]]^2 Derivative[1][qb][z]^2 - 
      8 L^2 q1^2 z^2 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[
        2 qb[z]]^2 Derivative[1][qb][z]^2 + 
      8 q1^2 z^4 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[2 qb[z]]^2 Derivative[
        1][qb][z]^2 - 
      4 L^2 q1 q1z z^4 Csc[q[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
        z]^3 + 4 q1 q1z z^6 Csc[q[z]]^2 Sin[2 qb[z]] Derivative[1][
        qb][z]^3 - 
      8 L^2 q1 q1z z^4 Csc[qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
        z]^3 + 8 q1 q1z z^6 Csc[qb[z]]^2 Sin[2 qb[z]] Derivative[1][
        qb][z]^3 - 
      4 L^2 q1^2 z^4 Cos[2 qb[z]] Csc[q[z]]^2 Derivative[1][qb][
        z]^4 + 4 q1^2 z^6 Cos[2 qb[z]] Csc[q[z]]^2 Derivative[1][qb][
        z]^4 - 8 L^2 q1^2 z^4 Cos[2 qb[z]] Csc[qb[z]]^2 Derivative[1][
        qb][z]^4 + 
      8 q1^2 z^6 Cos[2 qb[z]] Csc[qb[z]]^2 Derivative[1][qb][z]^4 + 
      L^2 q1^2 z^4 Csc[q[z]]^4 Sin[2 qb[z]]^2 Derivative[1][qb][z]^4 -
       q1^2 z^6 Csc[q[z]]^4 Sin[2 qb[z]]^2 Derivative[1][qb][z]^4 - 
      4 L^2 q1^2 z^4 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[
        2 qb[z]]^2 Derivative[1][qb][z]^4 + 
      4 q1^2 z^6 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[2 qb[z]]^2 Derivative[
        1][qb][z]^4)}

When I include the first gf matrix -the $gf0$- the code needs 50 minutes.

Series[Normal[
    Series[Sqrt[
      Det[(gp0 + 1/L^2 gf0) + δ gp1 + δ^2 gp2]], {L, 
      Infinity, 2}]], {δ, 0, 2}] // 
  Coefficient[#, δ^2] & // AbsoluteTiming

{2817.16, 
 1/2 Sqrt[(
   Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
    z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 Derivative[1][
      qb][z]^2)/
   z^10] (-((2 q1 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Sin[
            2 qb[z]] + 
          q1 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[2 qb[z]] + 
          2 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
            qb[z]]^4 Derivative[1][qb][z] + 
          2 q1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Sin[
            2 qb[z]] Derivative[1][qb][z]^2 + 
          q1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[
            2 qb[z]] Derivative[1][qb][
            z]^2)^2/(4 (Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 +
             z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^4 Derivative[1][qb][z]^2)^2)) + (q1c3^2 Sin[
          x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 + 
        q1c2^2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^2 + 
        2 q1^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
          qb[z]]^2 + q1c1^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 + 
        q1^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 + 
        q1r^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
        q1t^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
        q1x^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
        q1y^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
        q1z^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
        q1^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[2 qb[z]]^2 + 
        2 q1^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^2 Sin[2 qb[z]]^2 + 
        4 q1 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Sin[
          2 qb[z]] Derivative[1][qb][z] + 
        2 q1 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[
          2 qb[z]] Derivative[1][qb][z] + 
        2 q1^2 z^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
          qb[z]]^2 Derivative[1][qb][z]^2 + 
        q1^2 z^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[
          qb[z]]^4 Derivative[1][qb][z]^2 + 
        q1^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
          2 qb[z]]^2 Derivative[1][qb][z]^2 + 
        2 q1^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^2 Sin[
          2 qb[z]]^2 Derivative[1][qb][z]^2)/(Sin[x1]^4 Sin[x2]^2 Sin[
          q[z]]^2 Sin[qb[z]]^4 + 
        z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 Derivative[
          1][qb][z]^2)) + 
  1/(2 L^2) (1/(2 (1 + z^2 Derivative[1][qb][z]^2))
       Csc[q[z]]^2 Csc[qb[z]]^2 Sqrt[(
       Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
         qb[z]]^4 (1 + z^2 Derivative[1][qb][z]^2))/
       z^10] (2 q1 Sin[q[z]]^2 Sin[2 qb[z]] + 
         q1 Sin[qb[z]]^2 Sin[2 qb[z]] + 
         2 q1z z^2 Sin[q[z]]^2 Sin[qb[z]]^2 Derivative[1][qb][z] + 
         2 q1 z^2 Sin[q[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z]^2 + 
         q1 z^2 Sin[qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z]^2) ((
         1/(1 + z^2 Derivative[1][qb][z]^2))
         2 z^2 (q1 Csc[q[z]]^2 Sin[2 qb[z]] + 
            2 q1 Csc[qb[z]]^2 Sin[2 qb[z]] + 
            2 q1z z^2 Derivative[1][qb][z] + 
            q1 z^2 Csc[q[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z]^2 + 
            2 q1 z^2 Csc[qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
              z]^2) - 
         1/(1 + z^2 Derivative[1][qb][z]^2)
           z^2 Csc[x1]^4 Csc[x2]^2 Csc[q[z]]^2 Csc[
            qb[z]]^4 (4 q1 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
               qb[z]]^2 Sin[2 qb[z]] + 
             2 q1 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[2 qb[z]] + 
             gfc3z q1c3 Sin[x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Derivative[
               1][qb][z] + 
             gfzc3 q1c3 Sin[x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Derivative[
               1][qb][z] + 
             gfc2z q1c2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
               qb[z]]^2 Derivative[1][qb][z] + 
             gfzc2 q1c2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
               qb[z]]^2 Derivative[1][qb][z] + 
             gfc1z q1c1 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Derivative[
               1][qb][z] + 
             gfzc1 q1c1 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Derivative[
               1][qb][z] + 
             4 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
               qb[z]]^4 Derivative[1][qb][z] + 
             4 q1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
               qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z]^2 + 
             2 q1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[
               2 qb[z]] Derivative[1][qb][z]^2)) - 
     z^2 Sqrt[(
      Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
       z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 Derivative[1][
         qb][z]^2)/
      z^10] (-((2 q1 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Sin[
               2 qb[z]] + 
             q1 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[2 qb[z]] + 
             2 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
               qb[z]]^4 Derivative[1][qb][z] + 
             2 q1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
               qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z]^2 + 
             q1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[
               2 qb[z]] Derivative[1][qb][
               z]^2)^2/(4 (Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
                 qb[z]]^4 + 
               z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
                 qb[z]]^4 Derivative[1][qb][z]^2)^2)) + (q1c3^2 Sin[
             x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 + 
           q1c2^2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^2 + 
           2 q1^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
             qb[z]]^2 + q1c1^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 + 
           q1^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 + 
           q1r^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
           q1t^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
           q1x^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
           q1y^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
           q1z^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
           q1^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[2 qb[z]]^2 + 
           2 q1^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^2 Sin[2 qb[z]]^2 + 
           4 q1 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
             qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z] + 
           2 q1 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[
             2 qb[z]] Derivative[1][qb][z] + 
           2 q1^2 z^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[
             q[z]]^2 Sin[qb[z]]^2 Derivative[1][qb][z]^2 + 
           q1^2 z^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[
             qb[z]]^4 Derivative[1][qb][z]^2 + 
           q1^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
             2 qb[z]]^2 Derivative[1][qb][z]^2 + 
           2 q1^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^2 Sin[
             2 qb[z]]^2 Derivative[1][qb][z]^2)/(Sin[x1]^4 Sin[
             x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 

           z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
             qb[z]]^4 Derivative[1][qb][z]^2)) + 
     Sqrt[(Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 + 
       z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^4 Derivative[1][
         qb][z]^2)/
      z^10] (1/(1 + z^2 Derivative[1][qb][z]^2)^2 z^2 Csc[x1]^4 Csc[
           x2]^2 Csc[q[z]]^2 Csc[
           qb[z]]^4 (q1 Csc[q[z]]^2 Sin[2 qb[z]] + 
            2 q1 Csc[qb[z]]^2 Sin[2 qb[z]] + 
            2 q1z z^2 Derivative[1][qb][z] + 
            q1 z^2 Csc[q[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z]^2 + 
            2 q1 z^2 Csc[qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
              z]^2) (4 q1 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^2 Sin[2 qb[z]] + 
            2 q1 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[2 qb[z]] + 
            gfc3z q1c3 Sin[x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Derivative[
              1][qb][z] + 
            gfzc3 q1c3 Sin[x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Derivative[
              1][qb][z] + 
            gfc2z q1c2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^2 Derivative[1][qb][z] + 
            gfzc2 q1c2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^2 Derivative[1][qb][z] + 

            gfc1z q1c1 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Derivative[1][
              qb][z] + 
            gfzc1 q1c1 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Derivative[1][
              qb][z] + 
            4 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^4 Derivative[1][qb][z] + 
            4 q1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z]^2 + 
            2 q1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[
              2 qb[z]] Derivative[1][qb][z]^2) - 
        1/(2 (1 + z^2 Derivative[1][qb][z]^2))
          Csc[x1]^4 Csc[x2]^2 Csc[q[z]]^2 Csc[
           qb[z]]^4 (2 gfc2c3 q1c2 q1c3 Sin[q[z]]^2 + 
            2 gfc3c2 q1c2 q1c3 Sin[q[z]]^2 + 
            2 gfc1c3 q1c1 q1c3 Sin[x1]^2 Sin[qb[z]]^2 + 
            2 gfc3c1 q1c1 q1c3 Sin[x1]^2 Sin[qb[z]]^2 + 
            2 gfc1c2 q1c1 q1c2 Sin[x1]^2 Sin[x2]^2 Sin[qb[z]]^2 + 
            2 gfc2c1 q1c1 q1c2 Sin[x1]^2 Sin[x2]^2 Sin[qb[z]]^2 + 
            4 q1c3^2 z^2 Sin[x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 + 
            2 gfc3z q1c3 q1z z^2 Sin[x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 + 
            2 gfzc3 q1c3 q1z z^2 Sin[x1]^2 Sin[q[z]]^2 Sin[qb[z]]^2 + 

            4 q1c2^2 z^2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^2 + 
            2 gfc2z q1c2 q1z z^2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^2 + 
            2 gfzc2 q1c2 q1z z^2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^2 + 
            8 q1^2 z^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[
              q[z]]^2 Sin[qb[z]]^2 + 
            4 q1c1^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 + 
            2 gfc1z q1c1 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 + 
            2 gfzc1 q1c1 q1z z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 + 
            4 q1^2 z^2 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[
              qb[z]]^4 + 
            3 q1r^2 z^4 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^4 + 
            3 q1t^2 z^4 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^4 + 
            3 q1x^2 z^4 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^4 + 
            3 q1y^2 z^4 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^4 + 
            4 q1z^2 z^4 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^4 + 
            4 q1^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              2 qb[z]]^2 + 
            8 q1^2 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]]^2 + 

            2 gfc3z q1 q1c3 z^2 Sin[x1]^2 Sin[q[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            2 gfzc3 q1 q1c3 z^2 Sin[x1]^2 Sin[q[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            2 gfc2z q1 q1c2 z^2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            2 gfzc2 q1 q1c2 z^2 Sin[x1]^2 Sin[x2]^2 Sin[q[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            2 gfc3z q1 q1c3 z^2 Sin[x1]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            2 gfzc3 q1 q1c3 z^2 Sin[x1]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            2 gfc2z q1 q1c2 z^2 Sin[x1]^2 Sin[x2]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            2 gfzc2 q1 q1c2 z^2 Sin[x1]^2 Sin[x2]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            4 gfc1z q1 q1c1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            4 gfzc1 q1 q1c1 z^2 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            16 q1 q1z z^4 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][z] + 
            8 q1 q1z z^4 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^4 Sin[
              2 qb[z]] Derivative[1][qb][z] + 
            8 q1^2 z^4 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[
              q[z]]^2 Sin[qb[z]]^2 Derivative[1][qb][z]^2 + 
            4 q1^2 z^4 Cos[2 qb[z]] Sin[x1]^4 Sin[x2]^2 Sin[
              qb[z]]^4 Derivative[1][qb][z]^2 + 
            4 q1^2 z^4 Sin[x1]^4 Sin[x2]^2 Sin[q[z]]^2 Sin[
              2 qb[z]]^2 Derivative[1][qb][z]^2 + 
            8 q1^2 z^4 Sin[x1]^4 Sin[x2]^2 Sin[qb[z]]^2 Sin[
              2 qb[z]]^2 Derivative[1][qb][z]^2) - 
        1/(1 + z^2 Derivative[1][qb][z]^2)^2 2 z^2 (-q1r^2 z^2 - 
            q1t^2 z^2 - q1x^2 z^2 - q1y^2 z^2 - q1z^2 z^2 - 
            q1c1^2 Csc[q[z]]^2 - q1^2 Cos[2 qb[z]] Csc[q[z]]^2 - 
            2 q1^2 Cos[2 qb[z]] Csc[qb[z]]^2 - 
            q1c2^2 Csc[x1]^2 Csc[qb[z]]^2 - 
            q1c3^2 Csc[x1]^2 Csc[x2]^2 Csc[qb[z]]^2 + 
            q1^2 Csc[q[z]]^4 Sin[2 qb[z]]^2 + 
            2 q1^2 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[2 qb[z]]^2 + 
            3 q1^2 Csc[qb[z]]^4 Sin[2 qb[z]]^2 + 
            2 q1 q1z z^2 Csc[q[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
              z] + 
            4 q1 q1z z^2 Csc[qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
              z] - q1r^2 z^4 Derivative[1][qb][z]^2 - 
            q1t^2 z^4 Derivative[1][qb][z]^2 - 
            q1x^2 z^4 Derivative[1][qb][z]^2 - 
            q1y^2 z^4 Derivative[1][qb][z]^2 + 
            3 q1z^2 z^4 Derivative[1][qb][z]^2 - 
            q1c1^2 z^2 Csc[q[z]]^2 Derivative[1][qb][z]^2 - 
            2 q1^2 z^2 Cos[2 qb[z]] Csc[q[z]]^2 Derivative[1][qb][
              z]^2 - 4 q1^2 z^2 Cos[2 qb[z]] Csc[qb[z]]^2 Derivative[
              1][qb][z]^2 - 
            q1c2^2 z^2 Csc[x1]^2 Csc[qb[z]]^2 Derivative[1][qb][z]^2 -
             q1c3^2 z^2 Csc[x1]^2 Csc[x2]^2 Csc[qb[z]]^2 Derivative[
              1][qb][z]^2 + 
            2 q1^2 z^2 Csc[q[z]]^4 Sin[2 qb[z]]^2 Derivative[1][qb][
              z]^2 + 4 q1^2 z^2 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[
              2 qb[z]]^2 Derivative[1][qb][z]^2 + 
            6 q1^2 z^2 Csc[qb[z]]^4 Sin[2 qb[z]]^2 Derivative[1][qb][
              z]^2 + 2 q1 q1z z^4 Csc[q[z]]^2 Sin[2 qb[z]] Derivative[
              1][qb][z]^3 + 
            4 q1 q1z z^4 Csc[qb[z]]^2 Sin[2 qb[z]] Derivative[1][qb][
              z]^3 - q1^2 z^4 Cos[2 qb[z]] Csc[q[z]]^2 Derivative[1][
              qb][z]^4 - 
            2 q1^2 z^4 Cos[2 qb[z]] Csc[qb[z]]^2 Derivative[1][qb][
              z]^4 + q1^2 z^4 Csc[q[z]]^4 Sin[2 qb[z]]^2 Derivative[
              1][qb][z]^4 + 
            2 q1^2 z^4 Csc[q[z]]^2 Csc[qb[z]]^2 Sin[
              2 qb[z]]^2 Derivative[1][qb][z]^4 + 
            3 q1^2 z^4 Csc[qb[z]]^4 Sin[2 qb[z]]^2 Derivative[1][qb][
              z]^4)))}

Thanks in advance.

$\endgroup$

1 Answer 1

2
$\begingroup$

Seemingly, you need only the second derivative of the expression for $\delta = 0$ and $L \to \infty$.

First, I replace L by λ^-1:

A = (gp0 + 1/L^2 gf0) + δ (gp1 + 1/L^2 gf1) + δ^2 (gp2 + 1/L^2 gf2) /. L -> λ^-1; // AbsoluteTiming
det = Sqrt[Det[A]]; // AbsoluteTiming

{0.000957, Null}

{0.392288, Null}

Now, let's take the derivative with respect to δ twice and let us substitute δ -> 0 and λ -> 0:

a2 = D[det, δ, δ]; // AbsoluteTiming
a2at0 = a2 /. δ -> 0; // AbsoluteTiming
a2at00 = a2at0 /. λ -> 0; // AbsoluteTiming

{2.00551, Null}

{13.2472, Null}

{0.020978, Null}

$\endgroup$
2
  • $\begingroup$ Please, forget the previous comment. Very elegant and effective approach. Thank you. $\endgroup$
    – user49048
    Commented Mar 8, 2018 at 23:34
  • $\begingroup$ Glad to hear that. You're welcome! $\endgroup$ Commented Mar 9, 2018 at 0:03

Your Answer

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