InvarWrapper

InvarWrapper[f, g][expr]
returns the result of f[g, expr] while temporarily configuring settings associated to the metric g to Invar compatible values.
InvarWrapper[f, g][expr, args]
returns f[g, expr, args] while temporarily configuring settings associated to the metric g to Invar compatible values.
  • InvarWrapper temporarily sets the option UseMetricOnVBundle of ToCanonical to All, the option AllowUpperDerivatives of ContractMetric to True, $CommuteCovDsOnScalars to True, and disables automatic curvature relations. It reverts these settings to their original value afterwards.
Using Invar functions directly usually fails or gives the wrong result, because some settings do not have compatible values:
Wrapping RiemannSimplify in InvarWrapper does work:
Writing the Invar function f as a pure function gives flexibility in the argument positions:
Using Invar functions directly usually fails or gives the wrong result, because some settings do not have compatible values:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Wrapping RiemannSimplify in InvarWrapper does work:
In[3]:=
Click for copyable input
Out[3]=
 
Writing the Invar function f as a pure function gives flexibility in the argument positions:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=