# Differences

This shows you the differences between two versions of the page.

 — documentation:guide:einstein_notation [2015/11/21 12:33] (current) Line 1: Line 1: + ====== Einstein notation ====== + <​html>​ +
+ ​ + Next topic: [[documentation:​guide:​standard_form_of_mathematical_expressions]] + <​html>​ + ​ + ​ + ​ + + ---- + Redberry distinguishes covariant (lower) and contravariant (upper) indices. The corresponding property of single index called //state//. Two indices are considered to be contracted if and only if they have similar names and types but different states. As a consequence of this convention there are some natural restrictions on general structure of the expressions. + + + First of all, the following notation (used, for example, in Euclidean space) is illegal in Redberry: + + def t = '​F_aa'​.t //illegal + ​ + + > InconsistentIndicesException + ​ + + The correct input for the above tensor should be the following: + + def t = '​F_a^a'​.t + ​ + In addition, the error occurs when expression is meaningless because of several indices with the same name and state coexist in the same product: + + //​meaningless expression + def t = '​F_ij*M^i*N^j*K^j'​.t //illegal + ​ + + > InconsistentIndicesException + ​ + The entire architecture of Redberry built in such a way that the above illegal situations can not ever arise during manipulations and user do not need to take care about it. + + Other thing arises with dummy indices in products, where one or more multipliers are sums. It is convenient to write + $+ ​F_{\mu\nu} (A^{\alpha\beta} + M_\mu N^{\mu\alpha\beta}) ​ +$ + There is no problem here, since dummy index $\mu$ is in the scope of sum, which "​outer"​ (if consider sum as a one tensor $T^{\alpha\beta}=A^{\alpha\beta} + M_\mu N^{\mu\alpha\beta}$} indices are upper ${^{\alpha\beta}}$,​ while the first multiplier indices are lower $_{\mu\nu}$). However, if we try to expand brackets in this expression naively (i.e. without relabeling of dummy index $\mu$) we shall face the ambiguity as described in the previous examples. Thus it is better to relabel such dummy indices in sums right after parsing. Such transformation is automatically performed for every input expression in Redberry. Consider the following code: + + def t = '​F_mn*(A^ab + M_m*N^mab)'​.t + println t + ​ + + > F_mn*(A^ab + M_c*N^cab) + ​ + As we can see, dummy index ''​m''​ was automatically renamed to + ''​c'',​ because conflict with free index of the whole tensor was + detected. Similar behaviour is also valid for powers in products: + + def t = '​F_a*(A^a*B_a)**2'​.t + println t + ​ + + > F_a*(A^b*B_b)**2 + ​ + + ====See also==== + * Related guides: [[documentation:​guide:​inputting_and_printing_mathematical_expressions]]