First of all, you cannot use Ex
(with a capital E
) as a name for an expression, because Ex
is the name of the Cadabra expression object. Secondly, you cannot add pre-fix superscripts like this; the best you can do there is to use the LaTeXForm
property. So you can do
R1{#}::LaTeXForm("{}^{1}R").
ex:= R1_{\mu\nu};
Now what do you wan to do next? This expression clearly only contains one term. Did you want to compute it for a particular metric and then determine the number of non-zero components?