#!/usr/bin/env cadabra2 {r,t,\phi,\theta}::Coordinate; {\mu,\nu,\rho,\sigma,\lambda,\kappa,\chi,\gamma}::Indices(values={t,r,\phi,\theta}, position=fixed); \partial{#}::PartialDerivative; g_{\mu\nu}::Metric. g^{\mu\nu}::InverseMetric. ss:= { g_{t t} = -(1-2 M/r), g_{r r} = 1/(1-2 M/r), g_{\theta\theta} = r**2, g_{\phi\phi}=r**2 \sin(\theta)**2 }. complete(ss, $g^{\mu\nu}$); ch:= \Gamma^{\mu}_{\nu\rho} = 1/2 g^{\mu\sigma} ( \partial_{\rho}{g_{\nu\sigma}} +\partial_{\nu}{g_{\rho\sigma}} -\partial_{\sigma}{g_{\nu\rho}} ): evaluate(ch, ss, rhsonly=True); rm:= R^{\rho}_{\sigma\mu\nu} = \partial_{\mu}{\Gamma^{\rho}_{\nu\sigma}} -\partial_{\nu}{\Gamma^{\rho}_{\mu\sigma}} +\Gamma^{\rho}_{\mu\lambda} \Gamma^{\lambda}_{\nu\sigma} -\Gamma^{\rho}_{\nu\lambda} \Gamma^{\lambda}_{\mu\sigma}; substitute(rm, ch) evaluate(rm, ss, rhsonly=True); rc:= R_{\sigma\nu} = R^{\rho}_{\sigma\rho\nu}; substitute(rc, rm) evaluate(rc, ss, rhsonly=True); K:= K = R^{\mu}_{\nu\rho\sigma} R^{\lambda}_{\kappa\gamma\chi} g_{\mu\lambda} g^{\nu\kappa} g^{\rho\gamma} g^{\sigma\chi}; substitute(K, rm) evaluate(K, ss, rhsonly=True); rm:= R^{\rho}_{\sigma\mu\nu} = \partial_{\mu}{\Gamma^{\rho}_{\nu\sigma}} -\partial_{\nu}{\Gamma^{\rho}_{\mu\sigma}} +\Gamma^{\rho}_{\mu\lambda} \Gamma^{\lambda}_{\nu\sigma} -\Gamma^{\rho}_{\nu\lambda} \Gamma^{\lambda}_{\mu\sigma}; ch:= \Gamma^{\mu}_{\nu\rho} = 1/2 g^{\mu\sigma} ( \partial_{\rho}{g_{\nu\sigma}} +\partial_{\nu}{g_{\rho\sigma}} -\partial_{\sigma}{g_{\nu\rho}} ); substitute(rm, ch); evaluate(rm, ss, rhsonly=True) K:= K = R^{\mu}_{\nu\rho\sigma} R^{\lambda}_{\kappa\gamma\chi} g_{\mu\lambda} g^{\nu\kappa} g^{\rho\gamma} g^{\sigma\chi}; substitute(K, rm) evaluate(K, ss);