Ricci - Maple Help

Physics[Ricci] - The Ricci tensor

 Calling Sequence Ricci[$\mathrm{\mu },\mathrm{\nu }$] Ricci[keyword] convert(expression, Ricci)

Parameters

 mu, nu - the indices, as names representing integer numbers between 0 and the spacetime dimension, they can also be the numbers themselves keyword - can be any of: scalars, definition, scalarsdefinition, nonzero, ~, to respectively get the Weyl scalars, definition of the tensor or of its scalars, a set with the nonzero components, or an Array with the contravariant components

Description

 • The Ricci[mu, nu], displayed as $\mathrm{R__μ,ν}$, is a computational representation for the Ricci tensor, defined in terms of the Riemann tensor as

${R}_{\mathrm{\mu },\mathrm{\nu }}={g}^{\mathrm{\alpha },\mathrm{\beta }}{R}_{\mathrm{\alpha },\mathrm{\mu },\mathrm{\beta },\mathrm{\nu }}={R}_{\mathrm{\mu },\mathrm{\alpha },\mathrm{\nu }}^{\mathrm{\alpha }}$

 From this definition, and because of the symmetries of the Riemann tensor with respect to interchanging the positions of its indices the Ricci tensor is symmetric with respect to interchanging the position of its indices.
 • Expressing the Riemann tensor in terms of the Christoffel symbols and its derivatives, an equivalent definition is

${R}_{\mathrm{\mu },\mathrm{\nu }}={\partial }_{\mathrm{\alpha }}\left({\mathrm{\Gamma }}_{\mathrm{\mu },\mathrm{\nu }}^{\mathrm{\alpha }}\right)-{\partial }_{\mathrm{\nu }}\left({\mathrm{\Gamma }}_{\mathrm{\alpha },\mathrm{\mu }}^{\mathrm{\alpha }}\right)+{\mathrm{\Gamma }}_{\mathrm{\mu },\mathrm{\nu }}^{\mathrm{\alpha }}{\mathrm{\Gamma }}_{\mathrm{\alpha },\mathrm{\beta }}^{\mathrm{\beta }}-{\mathrm{\Gamma }}_{\mathrm{\alpha },\mathrm{\mu }}^{\mathrm{\beta }}{\mathrm{\Gamma }}_{\mathrm{\beta },\mathrm{\nu }}^{\mathrm{\alpha }}$

 • During a Maple session, the value of any component of $\mathrm{R__μ,ν}$ is automatically determined by the value of the spacetime metric. When Physics is loaded, the spacetime is set to galilean, of Minkowski type, and so all the elements of Ricci are automatically zero. To set the spacetime metric to something different use Setup or g_. Also, at least one system of coordinates must be set in order to compute the derivatives entering the definition of the Christoffel symbols, used to construct the Ricci tensor. For that purpose see Setup or Coordinates.
 • When the indices of Ricci assume integer values they are expected to be between 0 and the spacetime dimension, prefixed by ~ when they are contravariant, and the corresponding value of Ricci is returned. The values 0 and 4, or for the case any dimension set for the spacetime, represent the same object. When the indices have symbolic values Ricci returns unevaluated after normalizing its indices taking into account their symmetry property.
 • Computations performed with the Physics package commands take into account Einstein's sum rule for repeated indices - see . and Simplify. The distinction between covariant and contravariant indices in the input of tensors is done by prefixing contravariant ones with ~, say as in ~mu; in the output, contravariant indices are displayed as superscripts. For contracted indices, you can enter them one covariant and one contravariant. Note however that - provided that the spacetime metric is galilean (Euclidean or Minkowski), or the object is a tensor also in curvilinear coordinates - this distinction in the input is not relevant, and so contracted indices can be entered as both covariant or both contravariant, in which case they will be automatically rewritten as one covariant and one contravariant. Tensors can have spacetime and space indices at the same time. To change the type of letter used to represent spacetime or space indices see Setup.
 • Besides being indexed with two indices, Ricci accepts other indexations (keywords) with special meaning:
 – matrix: (synonym: Matrix, array, Array, or no indices whatsoever, as in Ricci[]) returns a Matrix that when indexed with numerical values from 1 to the dimension of spacetime it returns the value of each of the components of Ricci. If this keyword is passed together with indices, that can be covariant or contravariant, the resulting matrix takes into account the character of the indices.
 – ~: returns an Array with the all-contravariant components of the Ricci tensor
 – definition: returns the definition of the Ricci tensor in terms of the Christoffel symbols and their derivatives.
 – nonzero: returns a set of equations, with the left-hand-side as a sequence of two positive numbers identifying the element of $\mathrm{R__μ,ν}$ and the corresponding value on the right-hand-side. Note that this set is actually the output of the ArrayElems command when passing to it the Array obtained with the keyword array.
 – scalar: returns ${R}_{\mathrm{\mu }}^{\mathrm{\mu }}$, the trace of the Ricci tensor, also known as the Ricci scalar, an invariant.
 – scalars: returns the Ricci scalars of the Newman-Penrose formalism (see [2], sec. 2.7), ${\mathrm{\Phi }}_{\mathrm{00}},{\mathrm{\Phi }}_{\mathrm{01}},{\mathrm{\Phi }}_{\mathrm{02}},{\mathrm{\Phi }}_{\mathrm{11}},{\mathrm{\Phi }}_{\mathrm{12}},{\mathrm{\Phi }}_{\mathrm{22}},\mathrm{\Lambda }$, relevant in the classification of the SegreType of a spacetime. The spinor components ${\mathrm{\Phi }}_{\mathrm{10}},{\mathrm{\Phi }}_{\mathrm{20}},{\mathrm{\Phi }}_{\mathrm{21}}$ are respectively obtained from ${\mathrm{\Phi }}_{\mathrm{01}},{\mathrm{\Phi }}_{\mathrm{02}},{\mathrm{\Phi }}_{\mathrm{12}}$ by exchanging ${m}_{\mathrm{\mu }}$ and ${\stackrel{&conjugate0;}{m}}_{\mathrm{\mu }}$ in the definitions shown when using scalarsdefinition. For electrovacuum solutions, the NP curvature scalar $\mathrm{\Lambda }=0$.
 – scalarsdefinition: returns the definition of the Ricci scalars in terms of the null vectors of the Newman-Penrose formalism, ${l}_{\mathrm{\mu }},{n}_{\mathrm{\mu }},{m}_{\mathrm{\mu }},{\stackrel{&conjugate0;}{m}}_{\mathrm{\mu }}$. Note that a general sign in this definition depends on the signature, that you can query entering Setup(signature) and change it using Setup to any of the four possible signatures predefined.
 • Some automatic checking and normalization are carried out each time you enter Ricci[...]. The checking is concerned with possible syntax errors. The automatic normalization takes into account the symmetry of Ricci[mu,nu] with respect to interchanging the positions of the indices mu and nu.
 • The %Ricci command is the inert form of Ricci, so it represents the same mathematical operation but without performing it. To perform the operation, use value.
 • Sometimes it is convenient to rewrite tensorial expressions involving the Einstein tensor in terms of the Ricci tensor. For this purpose use convert(expression, Ricci) - see the Examples section.

Examples

 > $\mathrm{with}\left(\mathrm{Physics}\right):$
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (1)

Set up a coordinate system to work with - the first one to be set is automatically taken as the differentiation variables for d_, the covariant derivative D_ and the dAlembertian

 > $\mathrm{Setup}\left(\mathrm{coordinatesystems}=\mathrm{cartesian}\right)$
 ${}{}\mathrm{Systems of spacetime coordinates are:}{}{}{}\left\{X=\left(x{,}y{,}z{,}t\right)\right\}$
 $\left[{\mathrm{coordinatesystems}}{=}\left\{{X}\right\}\right]$ (2)

When Physics is initialized, the default spacetime metric is of Minkowski type. You can see the metric querying Setup, as in Setup(metric);, or directly entering the metric as g_[], with no indices

 > $\mathrm{g_}\left[\right]$
 ${{\mathrm{g_}}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{rrrr}-1& 0& 0& 0\\ 0& -1& 0& 0\\ 0& 0& -1& 0\\ 0& 0& 0& 1\end{array}\right]\right)$ (3)

Check the nonzero components of Christoffel, used to construct the Ricci tensor entering the definition of Ricci: because the default spacetime is of Minkowski type, there are none

 > $\mathrm{Christoffel}\left[\mathrm{nonzero}\right]$
 ${{\mathrm{\Gamma }}}_{{\mathrm{\alpha }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{=}{\varnothing }$ (4)

Hence, from the definition of the Ricci tensor,

 > $\mathrm{Ricci}\left[\mathrm{definition}\right]$
 ${{R}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{=}{{\partial }}_{{\mathrm{\alpha }}}{}\left({{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}^{\phantom{{}}{\mathrm{\alpha }}\phantom{{\mathrm{\mu }}{,}{\mathrm{\nu }}}}\right){-}{{\partial }}_{{\mathrm{\nu }}}{}\left({{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}{\mathrm{\mu }}{,}{\mathrm{\alpha }}}^{\phantom{{}}{\mathrm{\alpha }}\phantom{{\mathrm{\mu }}{,}{\mathrm{\alpha }}}}\right){+}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\beta }}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}^{\phantom{{}}{\mathrm{\beta }}\phantom{{\mathrm{\mu }}{,}{\mathrm{\nu }}}}{}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}{\mathrm{\beta }}{,}{\mathrm{\alpha }}}^{\phantom{{}}{\mathrm{\alpha }}\phantom{{\mathrm{\beta }}{,}{\mathrm{\alpha }}}}{-}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\beta }}}{\mathrm{\mu }}{,}{\mathrm{\alpha }}}^{\phantom{{}}{\mathrm{\beta }}\phantom{{\mathrm{\mu }}{,}{\mathrm{\alpha }}}}{}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}{\mathrm{\nu }}{,}{\mathrm{\beta }}}^{\phantom{{}}{\mathrm{\alpha }}\phantom{{\mathrm{\nu }}{,}{\mathrm{\beta }}}}$ (5)

it follows that

 > $\mathrm{Ricci}\left[\mathrm{\mu },\mathrm{\nu }\right]$
 ${0}$ (6)

and the same is valid for all the general relativity tensors defined in terms of Christoffel and derivatives of the metric g_.

To set the scenario as a curved spacetime set the metric using Setup, for instance indicating the square of the spacetime interval. In this example, we also choose to work in spherical coordinates, so consider for instance the metric defined by

 > $\mathrm{ds2}≔{r}^{2}{\mathrm{dtheta}}^{2}+{r}^{2}{\mathrm{sin}\left(\mathrm{\theta }\right)}^{2}{\mathrm{dphi}}^{2}-2\mathrm{dt}\mathrm{dr}-2{k\left(r,t\right)}^{2}{\mathrm{dt}}^{2}$
 ${\mathrm{ds2}}{≔}{{r}}^{{2}}{}{{\mathrm{dθ}}}^{{2}}{+}{{r}}^{{2}}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{{\mathrm{dφ}}}^{{2}}{-}{2}{}{\mathrm{dt}}{}{\mathrm{dr}}{-}{2}{}{{k}{}\left({r}{,}{t}\right)}^{{2}}{}{{\mathrm{dt}}}^{{2}}$ (7)
 > $\mathrm{Setup}\left(\mathrm{coordinates}=\mathrm{spherical},\mathrm{metric}=\mathrm{ds2}\right)$
 ${}{}\mathrm{Systems of spacetime coordinates are:}{}{}{}\left\{X=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right)\right\}$
 ${}{}\mathrm{_______________________________________________________}$
 $\mathrm{Coordinates:}{}\left[r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right]{}\mathrm{. Signature:}{}\left(\mathrm{- - - +}\right)$
 ${}{}\mathrm{_______________________________________________________}$
 ${{\mathrm{g_}}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{cccc}0& 0& 0& -1\\ 0& {r}^{2}& 0& 0\\ 0& 0& {r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& 0\\ -1& 0& 0& -2{}{k{}\left(r,t\right)}^{2}\end{array}\right]\right)$
 ${}{}\mathrm{_______________________________________________________}$
 $\mathrm{Setting}{}\mathrm{lowercaselatin_is}{}\mathrm{letters to represent}{}\mathrm{space}{}\mathrm{indices}$
 $\mathrm{_______________________________________________________}$
 $\left[{\mathrm{coordinatesystems}}{=}\left\{{X}\right\}{,}{\mathrm{metric}}{=}\left\{\left({1}{,}{4}\right){=}{-1}{,}\left({2}{,}{2}\right){=}{{r}}^{{2}}{,}\left({3}{,}{3}\right){=}{{r}}^{{2}}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({4}{,}{4}\right){=}{-}{2}{}{{k}{}\left({r}{,}{t}\right)}^{{2}}\right\}{,}{\mathrm{spaceindices}}{=}{\mathrm{lowercaselatin_is}}\right]$ (8)

To avoid the repeated display of the functionality in $k\left(r,t\right)$ in the following examples and have the display of derivatives in jet notation, indexed, use CompactDisplay

 > $\mathrm{CompactDisplay}\left(\right)$
 ${k}{}\left({r}{,}{t}\right){}{\mathrm{will now be displayed as}}{}{k}$ (9)

Now when the indices are not numerical, Ricci returns itself after normalizing its second and third indices taking advantage of the symmetry of its indices

 > $\mathrm{Ricci}\left[\mathrm{\alpha },\mathrm{\beta }\right]$
 ${{R}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}}$ (10)
 > $\mathrm{Ricci}\left[\mathrm{\beta },\mathrm{\alpha }\right]$
 ${{R}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}}$ (11)
 > $-$
 ${0}$ (12)

The definition of the Ricci scalars in terms of the null vectors l_, n_, m_ and mb_ of the Newman-Penrose formalism (see Tetrads), and the scalars themselves for the spacetime metric (9)

 > $\mathrm{Ricci}\left[\mathrm{scalarsdefinition}\right]$
 $\mathrm{Φ__00}{=}{-}\frac{{{R}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}\phantom{{,}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{l}}_{{\mathrm{\mu }}}{}{{l}}_{{\mathrm{\nu }}}}{{2}}{,}\mathrm{Φ__01}{=}{-}\frac{{{R}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}\phantom{{,}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{l}}_{{\mathrm{\mu }}}{}{{m}}_{{\mathrm{\nu }}}}{{2}}{,}\mathrm{Φ__02}{=}{-}\frac{{{R}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}\phantom{{,}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{m}}_{{\mathrm{\mu }}}{}{{m}}_{{\mathrm{\nu }}}}{{2}}{,}\mathrm{Φ__11}{=}{-}\frac{{{R}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}\phantom{{,}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}\left({{l}}_{{\mathrm{\mu }}}{}{{n}}_{{\mathrm{\nu }}}{+}{{m}}_{{\mathrm{\mu }}}{}{\stackrel{{&conjugate0;}}{{m}}}_{{\mathrm{\nu }}}\right)}{{4}}{,}\mathrm{Φ__12}{=}{-}\frac{{{R}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}\phantom{{,}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{m}}_{{\mathrm{\mu }}}{}{{n}}_{{\mathrm{\nu }}}}{{2}}{,}\mathrm{Φ__22}{=}{-}\frac{{{R}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}\phantom{{,}}\phantom{{\mathrm{\nu }}}}^{\phantom{{}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{n}}_{{\mathrm{\mu }}}{}{{n}}_{{\mathrm{\nu }}}}{{2}}{,}{\mathrm{\Lambda }}{=}\frac{{{R}}_{{\mathrm{\mu }}\phantom{{\mathrm{\mu }}}}^{\phantom{{\mathrm{\mu }}}{\mathrm{\mu }}}}{{24}}$ (13)
 > $\mathrm{Ricci}\left[\mathrm{scalars}\right]$
 $\mathrm{Φ__00}{=}{0}{,}\mathrm{Φ__01}{=}{0}{,}\mathrm{Φ__02}{=}{0}{,}\mathrm{Φ__11}{=}\frac{{2}{}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{k}{}\left({r}{,}{t}\right){}{{r}}^{{2}}{+}{2}{}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}{2}{}{{k}{}\left({r}{,}{t}\right)}^{{2}}{+}{1}}{{4}{}{{r}}^{{2}}}{,}\mathrm{Φ__12}{=}{0}{,}\mathrm{Φ__22}{=}\frac{{2}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{t}\right)\right)}{{k}{}\left({r}{,}{t}\right){}{r}}{,}{\mathrm{\Lambda }}{=}\frac{{-}{2}{}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{k}{}\left({r}{,}{t}\right){}{{r}}^{{2}}{-}{2}{}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{{r}}^{{2}}{-}{8}{}{k}{}\left({r}{,}{t}\right){}{r}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right){-}{2}{}{{k}{}\left({r}{,}{t}\right)}^{{2}}{+}{1}}{{12}{}{{r}}^{{2}}}$ (14)

Note that these scalars depend on the choice of orientation for the axis of the tetrad system of references. To change the tetrad or that orientation of axis see Tetrads:-TransformTetrad.

To express Ricci in terms of the Christoffel symbols and its derivatives convert to Christoffel

 > $=\mathrm{convert}\left(,\mathrm{Christoffel}\right)$
 ${{R}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}}{=}{{\partial }}_{{\mathrm{\mu }}}{}\left({{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}{\mathrm{\alpha }}{,}{\mathrm{\beta }}}^{\phantom{{}}{\mathrm{\mu }}\phantom{{\mathrm{\alpha }}{,}{\mathrm{\beta }}}}\right){-}{{\partial }}_{{\mathrm{\beta }}}{}\left({{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}{\mathrm{\alpha }}{,}{\mathrm{\mu }}}^{\phantom{{}}{\mathrm{\mu }}\phantom{{\mathrm{\alpha }}{,}{\mathrm{\mu }}}}\right){+}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\nu }}}{\mathrm{\alpha }}{,}{\mathrm{\beta }}}^{\phantom{{}}{\mathrm{\nu }}\phantom{{\mathrm{\alpha }}{,}{\mathrm{\beta }}}}{}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}{\mathrm{\mu }}{,}{\mathrm{\nu }}}^{\phantom{{}}{\mathrm{\mu }}\phantom{{\mathrm{\mu }}{,}{\mathrm{\nu }}}}{-}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\nu }}}{\mathrm{\alpha }}{,}{\mathrm{\mu }}}^{\phantom{{}}{\mathrm{\nu }}\phantom{{\mathrm{\alpha }}{,}{\mathrm{\mu }}}}{}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}{\mathrm{\beta }}{,}{\mathrm{\nu }}}^{\phantom{{}}{\mathrm{\mu }}\phantom{{\mathrm{\beta }}{,}{\mathrm{\nu }}}}$ (15)

Sometimes it is convenient to rewrite tensorial expressions involving the Einstein tensor in terms of the Ricci tensor

 > $\mathrm{Einstein}\left[\mathrm{\alpha },\mathrm{\beta }\right]$
 ${{G}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}}$ (16)
 > $\mathrm{convert}\left(,\mathrm{Ricci}\right)$
 ${{R}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}}{-}\frac{{{g}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}}{}{{R}}_{{\mathrm{\mu }}\phantom{{\mathrm{\mu }}}}^{\phantom{{\mathrm{\mu }}}{\mathrm{\mu }}}}{{2}}$ (17)
 > $\mathrm{convert}\left(,\mathrm{Ricci},\mathrm{evaluatetrace}\right)$
 ${{\mathrm{Ricci}}}_{{\mathrm{α}}{,}{\mathrm{β}}}{+}\frac{{{\mathrm{g_}}}_{{\mathrm{α}}{,}{\mathrm{β}}}{}\left({2}{}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{k}{}\left({r}{,}{t}\right){}{{r}}^{{2}}{+}{2}{}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{{r}}^{{2}}{+}{8}{}{k}{}\left({r}{,}{t}\right){}{r}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right){+}{2}{}{{k}{}\left({r}{,}{t}\right)}^{{2}}{-}{1}\right)}{{{r}}^{{2}}}$ (18)

Check the value of $\mathrm{R__μ,ν}$ for $\mathrm{\mu }$ = $\mathrm{\nu }$ = 1

 > $\mathrm{Ricci}\left[1,1\right]$
 ${0}$ (19)

Now for ${R}_{\nu }^{\mu }$ with $\mathrm{\mu }$ = $\mathrm{\nu }$ = 1 (note you enter the value of the contravariant index prefixed by ~)

 > $\mathrm{Ricci}\left[\mathrm{~1},1\right]$
 ${-}\frac{{2}{}\left({k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{r}{+}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{r}{+}{2}{}{k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)\right)}{{r}}$ (20)

To compute with a representation for Ricci without actually performing the operation, use the inert form %Ricci. To afterwards perform the operation use value

 > $\mathrm{%Ricci}\left[\mathrm{~1},1\right]$
 ${{\mathrm{%Ricci}}}_{\phantom{{}}\phantom{{1}}{1}}^{\phantom{{}}{1}\phantom{{1}}}$ (21)
 > $\mathrm{value}\left(\right)$
 ${-}\frac{{2}{}\left({k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{r}{+}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{r}{+}{2}{}{k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)\right)}{{r}}$ (22)

To have a more compact display in the following examples, suppress the display of the dependency of $k\left(r,t\right)$ and have the display of derivatives in jet notation, indexed (see Typesetting)

The Matrix form of the all-covariant and all-contravariant components of the Ricci tensor

 > $\mathrm{Ricci}\left[\right]$
 ${{\mathrm{Ricci}}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{cccc}0& 0& 0& \frac{2{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)\right){}r+2{}{\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}^{2}{}r+4{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}{r}\\ 0& -4{}k{}\left(r,t\right){}r{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)-2{}{k{}\left(r,t\right)}^{2}+1& 0& 0\\ 0& 0& {\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}{}\left(-4{}k{}\left(r,t\right){}r{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)-2{}{k{}\left(r,t\right)}^{2}+1\right)& 0\\ \frac{2{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)\right){}r+2{}{\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}^{2}{}r+4{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}{r}& 0& 0& \frac{4{}k{}\left(r,t\right){}\left({k{}\left(r,t\right)}^{2}{}\left(\frac{\partial }{\partial r}{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)\right){}r+k{}\left(r,t\right){}{\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}^{2}{}r+2{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right){}{k{}\left(r,t\right)}^{2}+\frac{\partial }{\partial t}{}k{}\left(r,t\right)\right)}{r}\end{array}\right]\right)$ (23)
 > $\mathrm{Ricci}\left[\mathrm{~}\right]$
 ${{\mathrm{Ricci}}}_{{\mathrm{~mu}}{,}{\mathrm{~nu}}}{=}\left(\left[\begin{array}{cccc}-\frac{4{}k{}\left(r,t\right){}\left({k{}\left(r,t\right)}^{2}{}\left(\frac{\partial }{\partial r}{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)\right){}r+k{}\left(r,t\right){}{\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}^{2}{}r+2{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right){}{k{}\left(r,t\right)}^{2}-\left(\frac{\partial }{\partial t}{}k{}\left(r,t\right)\right)\right)}{r}& 0& 0& \frac{2{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)\right){}r+2{}{\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}^{2}{}r+4{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}{r}\\ 0& \frac{-4{}k{}\left(r,t\right){}r{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)-2{}{k{}\left(r,t\right)}^{2}+1}{{r}^{4}}& 0& 0\\ 0& 0& \frac{-4{}k{}\left(r,t\right){}r{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)-2{}{k{}\left(r,t\right)}^{2}+1}{{r}^{4}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}}& 0\\ \frac{2{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)\right){}r+2{}{\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}^{2}{}r+4{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}{r}& 0& 0& 0\end{array}\right]\right)$ (24)

The Ricci scalar can be computed entering Ricci[scalar] or Ricci[mu, mu]

 > $\mathrm{Ricci}\left[\mathrm{scalar}\right]$
 ${-}\frac{{2}{}\left({2}{}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{k}{}\left({r}{,}{t}\right){}{{r}}^{{2}}{+}{2}{}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{{r}}^{{2}}{+}{8}{}{k}{}\left({r}{,}{t}\right){}{r}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right){+}{2}{}{{k}{}\left({r}{,}{t}\right)}^{{2}}{-}{1}\right)}{{{r}}^{{2}}}$ (25)

The nonzero components of the Ricci tensor

 > $\mathrm{Ricci}\left[\mathrm{nonzero}\right]$
 ${{\mathrm{Ricci}}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left\{\left({1}{,}{4}\right){=}\frac{{2}{}{k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{r}{+}{2}{}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{r}{+}{4}{}{k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}{{r}}{,}\left({2}{,}{2}\right){=}{-}{4}{}{k}{}\left({r}{,}{t}\right){}{r}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right){-}{2}{}{{k}{}\left({r}{,}{t}\right)}^{{2}}{+}{1}{,}\left({3}{,}{3}\right){=}{{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}^{{2}}{}\left({-}{4}{}{k}{}\left({r}{,}{t}\right){}{r}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right){-}{2}{}{{k}{}\left({r}{,}{t}\right)}^{{2}}{+}{1}\right){,}\left({4}{,}{1}\right){=}\frac{{2}{}{k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{r}{+}{2}{}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{r}{+}{4}{}{k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}{{r}}{,}\left({4}{,}{4}\right){=}\frac{{4}{}{k}{}\left({r}{,}{t}\right){}\left({{k}{}\left({r}{,}{t}\right)}^{{2}}{}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{r}{+}{k}{}\left({r}{,}{t}\right){}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{r}{+}{2}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right){}{{k}{}\left({r}{,}{t}\right)}^{{2}}{+}{\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{t}\right)\right)}{{r}}\right\}$ (26)

This is the matrix form of ${R}_{\mathrm{\nu }}^{\mathrm{\mu }}$ (note the contravariant index $\mathrm{\mu }$, prefixed by ~)

 > $\mathrm{Ricci}\left[\mathrm{~mu},\mathrm{\nu },\mathrm{matrix}\right]$
 ${{\mathrm{Ricci}}}_{{\mathrm{~mu}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{cccc}\frac{-2{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)\right){}r-2{}{\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}^{2}{}r-4{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}{r}& 0& 0& -\frac{4{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial t}{}k{}\left(r,t\right)\right)}{r}\\ 0& \frac{-4{}k{}\left(r,t\right){}r{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)-2{}{k{}\left(r,t\right)}^{2}+1}{{r}^{2}}& 0& 0\\ 0& 0& \frac{-4{}k{}\left(r,t\right){}r{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)-2{}{k{}\left(r,t\right)}^{2}+1}{{r}^{2}}& 0\\ 0& 0& 0& \frac{-2{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)\right){}r-2{}{\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}^{2}{}r-4{}k{}\left(r,t\right){}\left(\frac{\partial }{\partial r}{}k{}\left(r,t\right)\right)}{r}\end{array}\right]\right)$ (27)

To use this matrix, because its components were computed already taking into account the (covariant/contravariant) character of its indices, you do not need to indicate furthermore that character. So for ${R}_{1}^{1}$ we have

 > $R≔\mathrm{rhs}\left(\right):$
 > $R\left[1,1\right]$
 $\frac{{-}{2}{}{k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right){,}{r}\right)\right){}{r}{-}{2}{}{\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}^{{2}}{}{r}{-}{4}{}{k}{}\left({r}{,}{t}\right){}\left({\mathrm{diff}}{}\left({k}{}\left({r}{,}{t}\right){,}{r}\right)\right)}{{r}}$ (28)

Compare with the output obtained entering Ricci[~1, 1] in eq (16)

 > $\mathrm{normal}\left(-\right)$
 ${0}$ (29)

In different contexts it is sometimes necessary to classify the spacetime, for instance performing a PetrovType classification, or the SegreType classification of the Ricci tensor. These classification commands are in the Tetrads package. For example, for the spacetime considered, we have

 > $\mathrm{Tetrads}:-\mathrm{PetrovType}\left(\right)$
 ${"D"}$ (30)
 > $\mathrm{Tetrads}:-\mathrm{SegreType}\left(\right)$
 ${"D"}{,}{"\left[2,\left(11\right)\right]"}$ (31)
 > 

References

 [1] Landau, L.D., and Lifshitz, E.M. The Classical Theory of Fields, Course of Theoretical Physics Volume 2, fourth revised English edition. Elsevier, 1975.