On this page

list_dangling

symbolica.community.idenso Function

list_dangling(self_: Expression) -> list[Expression]

Lists the dangling (external, uncontracted) indices present in the expression.

Identifies and returns all indices that are not summed over (i.e., not dummy indices). These are the "free" indices that appear in the final result and determine the tensor rank of the expression. For dualizable representations, downstairs indices are represented wrapped in dind(...).

This is essential for:

  • Verifying index conservation in tensor equations
  • Determining the rank and structure of tensor expressions
  • Debugging index contractions

Arguments

  • self_: tensor expression to analyze

Returns

A list of expressions, each representing a free (dangling) index.

Examples

from symbolica.community.spenso import TensorName, Slot, Representation
import symbolica as sp
from symbolica.community.idenso import (
    list_dangling,
)

T = TensorName("T")
rep = Representation.euc(3)
# With slots (creates TensorIndices)
mu = rep("mu")
nu = rep("nu")
x = sp.S("x")
tensor_with_args = T(mu, nu, nu, x)  # T(mu, nu; x)
# print(tensor_with_args)
print(list_dangling(tensor_with_args.to_expression()))