Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

I don't know how to manipulate matrix easily in Cadabra. For example, some Lagrangian like

$$ L=Tr(\partial_{\mu}{A}\partial^{\mu}{A}), $$

where $A=diag(a, b)$, the right result is

$$ L=\partial_{\mu}{a}\partial^{\mu}{a}+\partial_{\mu}{b}\partial^{\mu}{b}. $$

How to implement the above steps in Cadabra? I have a try

g_{c d}::Metric.
g^{c d}::InverseMetric.
metric:={g_{1 1}=1,g_{2 2}=1};
complete(_,$g^{c d}$);
A:={A_{1 1}=a,A_{2 2}=b};
L:=g^{c d}(\partial_{\mu}{A}\partial^{\mu}{A})_{c d};

but it doesn't work.

in General questions by (1.5k points)
edited by

Please log in or register to answer this question.