# Integration using tutorials raises a dummy symbol error.

+1 vote

I am trying to derive Schwarzchild Solution and I reach a statement that needs to be integrated with respect to r. But, it raises an error which states I need to specify a dummy symbol. How do I do this integration?

Here is the code

#!/usr/local/bin/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.
{a,b,c,d}::Symbol;
{a,b}::Depends(r);
ss:= { g_{t t} = -exp{2a},
g_{r r} = exp{2b},
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);
rtt:= R_{t t} \exp{2b-2a} + R_{r r}=0;
substitute(rtt,rc);
evaluate(rtt,rc,simplify=True);
sympy.integrate(_);

There are two things you should avoid here. One is to use SymPy's algorithms directly on Cadabra's Ex objects. That does work for some situations, but in case you need to pass more parameters (like here, where you want to pass the function which you want to solve for), it is better and more convenient to use the wrappers in cdb.sympy.solvers.
The second thing is that you use integrate. That does not work well with differential equations (not even in SymPy). Use dsolve instead.
With that, the following will produce your answer $a=C_1 - b$:
import cdb.sympy.solvers as solvers
solvers.dsolve(rtt, $a$);