tensor(deprecated)/invars - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Home : Support : Online Help : tensor(deprecated)/invars

tensor

 invars
 compute the scalar invariants of the Riemann tensor of a space-time, based on the Newman-Penrose curvature components

 Calling Sequence invars( 'flag', Curve, conj_pairs)

Parameters

 flag - one of the following ten values: 'r1', 'r2', 'r3', 'w1', 'w2', 'm1', 'm2', 'm3', 'm4', or 'm5' Curve - curve component table holding the Newman-Penrose curvature components conj_pairs - optional parameter of a list of pairs (pair: list of two elements) of names that holds the variable names to be treated as complex conjugates in the calculations.

Description

Important: The tensor package has been deprecated. Use the superseding commands DifferentialGeometry[Tensor][RiemannInvariants] and Physics[Riemann] instead.

 • This function calculates any of the ten invariants listed above of the Riemann tensor, as designated by their corresponding flags.  For detailed definitions and descriptions of these invariants, refer to the paper listed in the References section of this page.
 • Simplification :
 – tensor[invars] has two simplifiers, tensor/invars/simp and tensor/invars/Msimp.
 – tensor/invars/simp is applied once after the invariant has been formally constructed.
 – Due to lengths of the actual formulas for the invariants, when calculating r3, m2, m3, m4, and m5, an extra simplifier, tensor/invars/Msimp, is employed.  tensor/invars/Msimp is used to simplify the sum of every 15 terms in the formulas for the five invariants mentioned above.  And then tensor/invars/simp is applied on top of tensor/invars/Msimp to put the 15-term segments together.
 – Note: that if the user finds it unnecessary, one of these simplifiers can actually be defined to perform no action.
 • This function is part of the tensor package, and can be used in the form invars(..) only after performing the command with(tensor), or with(tensor, invars).  The function can always be accessed in the long form tensor[invars].

Examples

Important: The tensor package has been deprecated. Use the superseding commands DifferentialGeometry[Tensor][RiemannInvariants] and Physics[Riemann] instead.

 > $\mathrm{with}\left(\mathrm{tensor}\right):$

Define the coordinate variables and the covariant natural basis metric :

 > $\mathrm{coord}≔\left[t,r,\mathrm{\theta },\mathrm{\phi }\right]:$
 > $\mathrm{g_compts}≔\mathrm{array}\left(\mathrm{symmetric},1..4,1..4\right):$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}4\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}j\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{from}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i+1\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}4\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{g_compts}\left[i,j\right]≔0\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}:$$\mathrm{g_compts}\left[1,1\right]≔a\left(r\right):$$\mathrm{g_compts}\left[2,2\right]≔-b\left(r\right):$$\mathrm{g_compts}\left[3,3\right]≔-{r}^{2}:$$\mathrm{g_compts}\left[4,4\right]≔-{r}^{2}{\mathrm{sin}\left(\mathrm{\theta }\right)}^{2}:$$g≔\mathrm{table}\left(\left['\mathrm{index_char}'=\left[-1,-1\right],'\mathrm{compts}'=\mathrm{op}\left(\mathrm{g_compts}\right)\right]\right)$
 ${g}{≔}{table}{}\left(\left[{\mathrm{index_char}}{=}\left[{-1}{,}{-1}\right]{,}{\mathrm{compts}}{=}\left[\begin{array}{cccc}{a}{}\left({r}\right)& {0}& {0}& {0}\\ {0}& {-}{b}{}\left({r}\right)& {0}& {0}\\ {0}& {0}& {-}{{r}}^{{2}}& {0}\\ {0}& {0}& {0}& {-}{{r}}^{{2}}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}\end{array}\right]\right]\right)$ (1)

Now give a tetrad that transforms the above metric into the one in Debever's formalism :

 > $\mathrm{h_compts}≔\mathrm{array}\left(\mathrm{sparse},1..4,1..4\right):$
 > $\mathrm{h_compts}\left[1,1\right]≔\frac{1}{2}{2}^{\frac{1}{2}}{a\left(r\right)}^{\frac{1}{2}}:$
 > $\mathrm{h_compts}\left[1,2\right]≔\frac{1}{2}{2}^{\frac{1}{2}}{b\left(r\right)}^{\frac{1}{2}}:$
 > $\mathrm{h_compts}\left[2,1\right]≔\frac{1}{2}{2}^{\frac{1}{2}}{a\left(r\right)}^{\frac{1}{2}}:$
 > $\mathrm{h_compts}\left[2,2\right]≔-\frac{1}{2}{2}^{\frac{1}{2}}{b\left(r\right)}^{\frac{1}{2}}:$
 > $\mathrm{h_compts}\left[3,3\right]≔\frac{1}{2}{2}^{\frac{1}{2}}r:$
 > $\mathrm{h_compts}\left[3,4\right]≔\frac{1}{2}I{2}^{\frac{1}{2}}r\mathrm{sin}\left(\mathrm{\theta }\right):$
 > $\mathrm{h_compts}\left[4,3\right]≔\frac{1}{2}{2}^{\frac{1}{2}}r:$
 > $\mathrm{h_compts}\left[4,4\right]≔-\frac{1}{2}I{2}^{\frac{1}{2}}r\mathrm{sin}\left(\mathrm{\theta }\right):$
 > $h≔\mathrm{create}\left(\left[1,-1\right],\mathrm{op}\left(\mathrm{h_compts}\right)\right)$
 ${h}{≔}{table}{}\left(\left[{\mathrm{index_char}}{=}\left[{1}{,}{-1}\right]{,}{\mathrm{compts}}{=}\left[\begin{array}{cccc}\frac{\sqrt{{2}}{}\sqrt{{a}{}\left({r}\right)}}{{2}}& \frac{\sqrt{{2}}{}\sqrt{{b}{}\left({r}\right)}}{{2}}& {0}& {0}\\ \frac{\sqrt{{2}}{}\sqrt{{a}{}\left({r}\right)}}{{2}}& {-}\frac{\sqrt{{2}}{}\sqrt{{b}{}\left({r}\right)}}{{2}}& {0}& {0}\\ {0}& {0}& \frac{\sqrt{{2}}{}{r}}{{2}}& \frac{{I}}{{2}}{}\sqrt{{2}}{}{r}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)\\ {0}& {0}& \frac{\sqrt{{2}}{}{r}}{{2}}& {-}\frac{{I}}{{2}}{}\sqrt{{2}}{}{r}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)\end{array}\right]\right]\right)$ (2)

Obtain the curvature components.

 > $\mathrm{SPN}≔\mathrm{npspin}\left(\mathrm{coord},h,'G','\mathrm{any}'\right):$
 > $\mathrm{Curve}≔\mathrm{npcurve}\left(\mathrm{SPN},\mathrm{any}\right):$

Specify the simplification wanted :

 > tensor/invars/simp:=proc(x) x end proc:

Now you are ready to compute any of the ten invariants.  For example,

 > $\mathrm{R1}≔\mathrm{invars}\left('\mathrm{r1}',\mathrm{Curve}\right)$
 ${\mathrm{R1}}{≔}\frac{{\left(\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){+}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right)\right)}^{{2}}}{{8}{}{{b}{}\left({r}\right)}^{{4}}{}{{r}}^{{2}}{}{{a}{}\left({r}\right)}^{{2}}}{+}\frac{{\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){}{a}{}\left({r}\right){}{{r}}^{{2}}{-}{b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{+}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right)\right)}^{{2}}}{{64}{}{{a}{}\left({r}\right)}^{{4}}{}{{b}{}\left({r}\right)}^{{4}}{}{{r}}^{{4}}}$ (3)

Repeat with a different simplification :

 > tensor/invars/simp:=proc(x) simplify(factor(x)) end proc:
 > $\mathrm{R1_}≔\mathrm{invars}\left('\mathrm{r1}',\mathrm{Curve}\right)$
 ${\mathrm{R1_}}{≔}\frac{{4}{}{\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{}{{a}{}\left({r}\right)}^{{2}}{}{{r}}^{{4}}{-}{4}{}\left({b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{+}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right){}\left({b}{}\left({r}\right){-}{1}\right)\right){}{{r}}^{{2}}{}{b}{}\left({r}\right){}{a}{}\left({r}\right){}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){+}{{b}{}\left({r}\right)}^{{2}}{}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{4}}{}{{r}}^{{4}}{+}{2}{}{b}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{3}}{}{{r}}^{{4}}{+}{{r}}^{{2}}{}{{a}{}\left({r}\right)}^{{2}}{}\left({{r}}^{{2}}{}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right)}^{{2}}{-}{8}{}{{b}{}\left({r}\right)}^{{3}}{+}{16}{}{{b}{}\left({r}\right)}^{{2}}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{-}{8}{}{{r}}^{{2}}{}{{a}{}\left({r}\right)}^{{3}}{}{b}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}\left({b}{}\left({r}\right){-}{3}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){+}{8}{}{{a}{}\left({r}\right)}^{{4}}{}\left({{r}}^{{2}}{}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right)}^{{2}}{+}{2}{}{{b}{}\left({r}\right)}^{{2}}{}{\left({b}{}\left({r}\right){-}{1}\right)}^{{2}}\right)}{{64}{}{{a}{}\left({r}\right)}^{{4}}{}{{b}{}\left({r}\right)}^{{4}}{}{{r}}^{{4}}}$ (4)

Verify the two results are identical :

 > $\mathrm{simplify}\left(\mathrm{R1}-\mathrm{R1_}\right)$
 ${0}$ (5)

Specify the "inner" simplification, namely tensor/invars/Msimp:

 > tensor/invars/Msimp:=proc(x) x end proc:
 > $\mathrm{M3}≔\mathrm{invars}\left('\mathrm{m3}',\mathrm{Curve}\right)$
 ${\mathrm{M3}}{≔}\frac{{\left(\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){}{a}{}\left({r}\right){}{{r}}^{{2}}{-}\frac{{b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}}{{2}}{-}\frac{{r}{}{a}{}\left({r}\right){}\left({r}{}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){+}{2}{}{b}{}\left({r}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}{{2}}{+}{{a}{}\left({r}\right)}^{{2}}{}\left({r}{}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){-}{2}{}{{b}{}\left({r}\right)}^{{2}}{+}{2}{}{b}{}\left({r}\right)\right)\right)}^{{2}}{}\left({\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{}{{a}{}\left({r}\right)}^{{2}}{}{{r}}^{{4}}{-}\left({b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{+}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right){}\left({b}{}\left({r}\right){-}{1}\right)\right){}{{r}}^{{2}}{}{b}{}\left({r}\right){}{a}{}\left({r}\right){}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){+}\frac{{{b}{}\left({r}\right)}^{{2}}{}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{4}}{}{{r}}^{{4}}}{{4}}{+}\frac{{b}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{3}}{}{{r}}^{{4}}}{{2}}{+}\frac{{{r}}^{{2}}{}{{a}{}\left({r}\right)}^{{2}}{}\left({{r}}^{{2}}{}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right)}^{{2}}{-}{8}{}{{b}{}\left({r}\right)}^{{3}}{+}{10}{}{{b}{}\left({r}\right)}^{{2}}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}}{{4}}{-}{2}{}\left({b}{}\left({r}\right){-}\frac{{3}}{{2}}\right){}{{r}}^{{2}}{}{b}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{{a}{}\left({r}\right)}^{{3}}{}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){+}\frac{{{a}{}\left({r}\right)}^{{4}}{}\left({{r}}^{{2}}{}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right)}^{{2}}{+}{8}{}{{b}{}\left({r}\right)}^{{2}}{}{\left({b}{}\left({r}\right){-}{1}\right)}^{{2}}\right)}{{2}}\right)}{{576}{}{{a}{}\left({r}\right)}^{{8}}{}{{b}{}\left({r}\right)}^{{8}}{}{{r}}^{{8}}}$ (6)

Repeat with a different "outer" simplifier :

 > tensor/invars/simp:=proc(x) x end proc:
 > $\mathrm{M3_}≔\mathrm{invars}\left('\mathrm{m3}',\mathrm{Curve}\right)$
 ${\mathrm{M3_}}{≔}\frac{{\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){}{a}{}\left({r}\right){}{{r}}^{{2}}{-}{b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{-}{2}{}{b}{}\left({r}\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{r}{+}{2}{}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{{a}{}\left({r}\right)}^{{2}}{}{r}{+}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right)\right)}^{{2}}{}{\left(\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){+}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right)\right)}^{{2}}}{{4608}{}{{a}{}\left({r}\right)}^{{6}}{}{{b}{}\left({r}\right)}^{{8}}{}{{r}}^{{6}}}{+}\frac{{\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){}{a}{}\left({r}\right){}{{r}}^{{2}}{-}{b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{-}{2}{}{b}{}\left({r}\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{r}{+}{2}{}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{{a}{}\left({r}\right)}^{{2}}{}{r}{+}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right)\right)}^{{2}}{}{\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){}{a}{}\left({r}\right){}{{r}}^{{2}}{-}{b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{+}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right)\right)}^{{2}}}{{9216}{}{{a}{}\left({r}\right)}^{{8}}{}{{b}{}\left({r}\right)}^{{8}}{}{{r}}^{{8}}}$ (7)

Verify the two results are identical :

 > $\mathrm{simplify}\left(\mathrm{M3}-\mathrm{M3_}\right)$
 ${0}$ (8)

Demonstrate the use of the conj_pairs parameter :

 > $\mathrm{M3__}≔\mathrm{invars}\left('\mathrm{m3}',\mathrm{Curve},\left[\left[r,\mathrm{rBAR}\right],\left[\mathrm{\theta },\mathrm{thetaBAR}\right]\right]\right)$
 ${\mathrm{M3__}}{≔}\frac{\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){}{a}{}\left({r}\right){}{{r}}^{{2}}{-}{b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{-}{2}{}{b}{}\left({r}\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{r}{+}{2}{}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{{a}{}\left({r}\right)}^{{2}}{}{r}{+}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right)\right){}\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{\mathrm{rBAR}}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({\mathrm{rBAR}}\right)\right){}{b}{}\left({\mathrm{rBAR}}\right){}{a}{}\left({\mathrm{rBAR}}\right){}{{\mathrm{rBAR}}}^{{2}}{-}{b}{}\left({\mathrm{rBAR}}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({\mathrm{rBAR}}\right)\right)}^{{2}}{}{{\mathrm{rBAR}}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({\mathrm{rBAR}}\right)\right){}{a}{}\left({\mathrm{rBAR}}\right){}\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({\mathrm{rBAR}}\right)\right){}{{\mathrm{rBAR}}}^{{2}}{-}{4}{}{{a}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{{b}{}\left({\mathrm{rBAR}}\right)}^{{2}}{-}{2}{}{b}{}\left({\mathrm{rBAR}}\right){}{a}{}\left({\mathrm{rBAR}}\right){}\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({\mathrm{rBAR}}\right)\right){}{\mathrm{rBAR}}{+}{2}{}\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({\mathrm{rBAR}}\right)\right){}{{a}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{\mathrm{rBAR}}{+}{4}{}{{a}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{b}{}\left({\mathrm{rBAR}}\right)\right){}{\left(\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){+}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right)\right)}^{{2}}}{{4608}{}{{a}{}\left({r}\right)}^{{4}}{}{{b}{}\left({r}\right)}^{{6}}{}{{r}}^{{4}}{}{{a}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{{b}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{{\mathrm{rBAR}}}^{{2}}}{+}\frac{\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){}{a}{}\left({r}\right){}{{r}}^{{2}}{-}{b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{-}{2}{}{b}{}\left({r}\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{r}{+}{2}{}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{{a}{}\left({r}\right)}^{{2}}{}{r}{+}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right)\right){}\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{\mathrm{rBAR}}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({\mathrm{rBAR}}\right)\right){}{b}{}\left({\mathrm{rBAR}}\right){}{a}{}\left({\mathrm{rBAR}}\right){}{{\mathrm{rBAR}}}^{{2}}{-}{b}{}\left({\mathrm{rBAR}}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({\mathrm{rBAR}}\right)\right)}^{{2}}{}{{\mathrm{rBAR}}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({\mathrm{rBAR}}\right)\right){}{a}{}\left({\mathrm{rBAR}}\right){}\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({\mathrm{rBAR}}\right)\right){}{{\mathrm{rBAR}}}^{{2}}{-}{4}{}{{a}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{{b}{}\left({\mathrm{rBAR}}\right)}^{{2}}{-}{2}{}{b}{}\left({\mathrm{rBAR}}\right){}{a}{}\left({\mathrm{rBAR}}\right){}\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({\mathrm{rBAR}}\right)\right){}{\mathrm{rBAR}}{+}{2}{}\left(\frac{{ⅆ}}{{ⅆ}{\mathrm{rBAR}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({\mathrm{rBAR}}\right)\right){}{{a}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{\mathrm{rBAR}}{+}{4}{}{{a}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{b}{}\left({\mathrm{rBAR}}\right)\right){}{\left({2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{r}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{b}{}\left({r}\right){}{a}{}\left({r}\right){}{{r}}^{{2}}{-}{b}{}\left({r}\right){}{\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{b}{}\left({r}\right)\right){}{a}{}\left({r}\right){}\left(\frac{{ⅆ}}{{ⅆ}{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{a}{}\left({r}\right)\right){}{{r}}^{{2}}{+}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{{b}{}\left({r}\right)}^{{2}}{-}{4}{}{{a}{}\left({r}\right)}^{{2}}{}{b}{}\left({r}\right)\right)}^{{2}}}{{9216}{}{{a}{}\left({r}\right)}^{{6}}{}{{b}{}\left({r}\right)}^{{6}}{}{{r}}^{{6}}{}{{a}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{{b}{}\left({\mathrm{rBAR}}\right)}^{{2}}{}{{\mathrm{rBAR}}}^{{2}}}$ (9)

References

 Carminati, J., and McLenaghan, R.G. "Algebraic invariants of the Riemann tensor in a four-dimensional Lorentzian space." Journal of Mathematical Physics, Vol. 32 No. 11. (Nov. 1991).