I want to compute the functional derivative against vectors.
For example, I have an object that looks like this $R = h_{ijkl}a^i a^j a^k a^l$
I need to compute $\frac{\delta R}{\delta a^p}= 4 h_{pjkl} a^j a^k a^l $
The VarD
method in xTensor is able to compute this with the following code
VarD[A[p]][H[-i, -j, -k, -l]*A[i]*A[j]*A[k]*A[l]] // CollectTensors
But when I want to compute the second-order derivate it gives me an error because the argument is not a scalar.
$\frac{\delta}{\delta a^m} \frac{\delta R}{\delta a^p}= 12 h_{pmkl} a^k a^l $
Here is my setup for the following problem. Thank you in advance.
<< xAct`xTras`;
DefManifold[M, dim, IndexRange[a, m]];
DefMetric[-1, metric[-a, -b], PD, PrintAs -> "\[Eta]",
FlatMetric -> True, SymbolOfCovD -> {",", "\[PartialD]"}];
SetOptions[SymmetryOf, ConstantMetric -> True];
DefTensor[H[-a, -b, -c, -d], M, Symmetric[{-a, -b, -c, -d}], PrintAs -> "h"]
DefTensor[A[a], M , PrintAs -> "a"]