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

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


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


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.

asked in General questions by (960 points)
edited by

Please log in or register to answer this question.