3
$\begingroup$

I need to compute a variation of the 4th rang symmetric tensor. I've written a code that successfully computes it, but when I use the resulting tensor to compute the second variation the Simplification process takes ages to finish. Here is my code

DefManifold[M4, 4, {a, b, c, d, e, f, i, j, k, l, m, n, o, p}];
DefMetric[-1, g[-a, -b], CD, {"|", "\[Del]"}, FlatMetric -> True];
DefTensor[\[Epsilon][a], M4];
DefTensor[\[Omega][a], M4];
DefTensor[h[a, b, c, d], M4, Symmetric[{a, b, c, d}]];

getDelta1[\[Epsilon]_, h_] := 
 Module[{C, C1, SC1, C2, SC2, C3, SC3, C4, SC4}, 
  C1[i_, j_, k_, l_] := Module[{a, b, c},
    \[Epsilon][a, b, c]*CD[-a][CD[-b][CD[-c][h[i, j, k, l]]]] // 
     Simplification
    ] ;
  C2[i_, j_, k_, l_] := Module[{a, b, c, exp},
    exp = 
     g[d, i]*CD[-d][\[Epsilon][a, b, -c]] * 
      CD[-a][CD[-b][h[j, k, l, c]]] ;
    Symmetrize[exp, {i, j, k, l}] // SortCovDs[#, CD] & // 
     Simplification
    ] ;
  C3[i_, j_, k_, l_] := Module[{a, b, c, exp},
    exp = 
     g[d, i] g[f, j] CD[-d][CD[-f][\[Epsilon][a, -b, -c]]] CD[-a][
       h[k, l, b, c]];
    Symmetrize[exp, {i, j, k, l}] // SortCovDs[#, CD] & // 
     Simplification
    ];
  C4[i_, j_, k_, l_] := Module[{a, b, c, m, exp}, 
    exp =  
     g[d, i] g[f, j] g[m, k] CD[-d][
       CD[-f][CD[-m][ \[Epsilon][-a, -b, -c]]]] *h[l, a, b, c];
    Symmetrize[exp, {i, j, k, l}] // SortCovDs[#, CD] & // 
     Simplification
    ];


  C[i_, j_, k_, l_] := Module[{},
    C1[i, j, k, l]  + C2[i, j, k, l] + C3[i, j, k, l]  + 
       C4[i, j, k, l]  // 
      ContractMetric[#, AllowUpperDerivatives -> True] & // 
     Simplification
    ];
  C
  ]

when computing the first variation ie

d1 = getDelta1[\[Epsilon], h];
d1[i,j,k,l]

it successfully returns the correct expression Result

But when I pass the result to another getDelta1 function it hangs

d2=getDelta1[\[Omega], d1];
d2[i,j,k,l]

Any ideas how to improve code?

$\endgroup$

Your Answer

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.