Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote
{t,r,\theta,\phi}::Coordinate;
{\mu, \nu, \tau, \gamma, \alpha, \beta, \kappa, \lambda}::Indices(values={t,r,\theta,\phi}, position=fixed);
\partial{#}::PartialDerivative;
g_{\mu\nu}::Metric;
g^{\mu\nu}::InverseMetric;
g_{\mu\nu}::Diagonal;
g^{\mu\nu}::Diagonal;
g^{\mu}_{\nu}::KroneckerDelta;
g_{\mu}^{\nu}::KroneckerDelta;
\nabla::Derivative;
\Phi::Depends(r);
\Lambda::Depends(r);
\rho::Depends(r);
p::Depends(r);
g := [
    g_{t t} = -exp(2\Phi),
    g_{r r} = exp(2\Lambda),
    g_{\theta \theta} = r**2,
    g_{\phi \phi} = (r*sin(\theta))**2
];
complete(g, $g^{\mu\nu}$);
u := [
    u^t = exp(-\Phi),
    u^r = 0,
    u^\theta = 0,
    u^\phi = 0
];
T := T^{\mu\nu} = (\rho + p)u^{\mu}u^{\nu} + pg^{\mu\nu};

For the provided code, how to get expresions for the energy-momentum tensoro components.

I tried to substitute(T,g); substitute(T,u); and evaluate(T) but I do not get any of the results by components.

Hhow to complete the set of components for the 4 velocity, such that expresion variable "u" will have [ u^\mu, u\mu ] components, by using the equation [ u\mu = g_{\mu\nu}u^{\nu} ]

How to evaluate the contracation of the 4-velocity vector and covector to check if it is normalized to -1 - thus howto carry the operation u^\mu u^\nu g_{\mu\nu}

version 2.2.20, build private dated 2018-08-07

in General questions by (220 points)

1 Answer

+1 vote

Combine the rules for u and g into one call to evaluate, as in

evaluate(T, u+g, rhsonly=True);
by (82.6k points)

Does not seem to work.

The results

evaluate(T,g+u,rhsonly=True);
evaluate(T,u+g,rhsonly=True);
evaluate(T,u,rhsonly=True);

are the same

It worked fine for me when I pasted your code into a fresh notebook and added that extra line.

Send me your notebook by email (info@cadabra.science) and I'll have a look.

Sent, I am not sure why is like this, if I retype or copy it from here it does not seem to take effect. Acually I am the same guy with the git problems, can it be some discrepancy with pythons?

I sended you the notebook.

You wrote

pg^{\mu\nu};

without a space separating the factors. Make it

p g^{\mu\nu};

and it will work.

So sweet , so I suppose it save to include "*" for multiplication instead of just making things stick? Or at least place spaces..., for what I have tried the latter is safer if you are working for indexes, since {tt} can be interpreted as a whole index, not two "t" indexes sticking together.

10x for the responses! :)

Symbols can consists of more than one character, so if you intend to write two objects (whether it be in a product or in a subscript), you always need to write either a * or a space. A space is always interpreted as multiplication except in sub/superscripts, where it indicates separation.

...