Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
0 votes
{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;
\delta_{\nu}^{\mu}::KroneckerDelta;
f:=\partial_{\mu}{t};

How can I get 1 as an answer for f? Thank you!

in General questions by

1 Answer

0 votes

You only missed one line:

evaluate(f);

This will give you the following perhaps slightly confusing result: $$\square_\mu = \begin{cases} \square_t = 1 \end{cases}$$ The meaning of this is that the result is a tensor with one (lower) $\mu$ index, which is such that the $\mu=t$ component equals $1$. Which is really what you meant when you said '1 as an answer'.

In general, evaluate works out the components of a tensor expression given rules for the components of its building blocks.

by (82.5k points)

Thank you for quick response. I'll try to describe in another way. First of all I try to find answer for something like \partial_{\mu} x^{\nu}, we know that is \delta_{\mu}^{nu}. But I can't write code for it. Is it possible to get this answer? What should I write? Thank you for understanding.

Just substitute,

substitute(ex, $\partial_{\mu}{ x^{\nu} } = \delta_{\mu}^{\nu}$);

This will work with any indices in place of \mu and \nu.

...