Hello,
I am trying to extract the free indices out of some expression, and the result seems to depend on the order of factors.
For example:
{a,b,c,d#,z}::Indices.
ex:= 1/2 C^{a b c} D_{b} A_{c};
try:
next(ex.top().free_indices())
print("there's at least a free index")
except:
print("no free indices!")
ex:= 1/2 D_{b} C^{a b c} A_{c};
try:
next(ex.top().free_indices())
print("there's at least a free index")
except:
print("no free indices!")
ex:= 1/2 D_{b} A_{c} C^{a b c};
try:
next(ex.top().free_indices())
print("there's at least a free index")
except:
print("no free indices!")
returns
1/2 C^{a b c} D_{b} A_{c}
there's at least a free index
1/2 D_{b} C^{a b c} A_{c}
no free indices!
1/2 D_{b} A_{c} C^{a b c}
no free indices!