Metric Variations

xTras automatically defines 'proper' variations with respect to the metric via VarD and VarL whenever you define a metric.
VarD[g[-a,-b],cd][L]returns while integrating by parts with respect to the covariant derivative cd.
VarL[g[-a,-b],cd][L]returns while integrating by parts with respect to the covariant derivative cd.

Computing variations w.r.t. the metric.

Let's begin with defining a manifold.
DefMetric has a new option, DefMetricPerturbation. It defaults to True, and so by default a metric perturbation is defined whenever you define a metric.
In[10]:=
Click for copyable input
Out[10]=
In xTras, defining a metric perturbation automatically defines proper metric variations. All in all, defining a metric automatically defines proper metric variations.
We can now perform variations with respect to the metric:
In[13]:=
Click for copyable input
Out[13]=
Using VarL automatically takes care of factors of :
In[15]:=
Click for copyable input
Out[15]=
Varying with respect to the inverse metric gives an overall minus sign:
In[16]:=
Click for copyable input
Out[16]=
In[17]:=
Click for copyable input
Out[17]=
More complicated expressions can also be varied easily:
In[18]:=
Click for copyable input
Out[18]=
In[23]:=
Click for copyable input
Out[23]=
This can be simplified further with the help of FullSimplification:
In[24]:=
Click for copyable input
Out[24]=