Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+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

{\mu,\nu,\rho,\sigma,\lambda,\kappa,\chi,\gamma}::Indices(values={t,r,\phi,\theta}, position=fixed);
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_{\sigma}{g_{\nu\rho}} ):
evaluate(ch, ss, rhsonly=True);
rm:= R^{\rho}_{\sigma\mu\nu} = \partial_{\mu}{\Gamma^{\rho}_{\nu\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;
in General questions by (170 points)

1 Answer

+2 votes
Best answer

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$);
by (71.6k points)
selected by