IndexInherit
Make an object inherit all indices from its child objects.
Indicates that an object should inherit the indices of its child
objects. This is useful mainly for operators. Matrix transposition,
for instance, could be written asT{#}::IndexInherit;
ex:=T(B_{m n}) + C_{m n};
\(\displaystyle{}\text{Attached property IndexInherit to }T\left(\#\right).\)
\(\displaystyle{}T\left(B_{m n}\right)+C_{m n}\)
T(B_{m n}) + C_{m n}
Without the
IndexInherit
property, the object
T(B_{m n})
would be considered a scalar, without indices, and an index mismatch
error would be reported. With the property, the first term has
external indices m
and n
, just like the second term.
Note that indices which are 'direct indices' of the object still count, of course.
This is also visible if you ask for the free indices directly, as the following
example shows.ex:= T_{m}(A_{n});
\(\displaystyle{}T_{m}\left(A_{n}\right)\)
T_{m}(A_{n})
for i in ex.top().free_indices():
display(i)
m
n