On this page

wrap_indices

symbolica.community.idenso Function

wrap_indices(self_: Expression, header: Expression) -> Expression

Wrap all abstract indices with a header symbol

Arguments

  • self_: input expression containing tensor indices
  • header: symbol to use as the wrapper function for all indices

Returns

Expression with all indices wrapped by the header symbol.

Examples

from symbolica.community.spenso import TensorName, Slot, Representation
import symbolica as sp
from symbolica.community.idenso import wrap_indices

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, x)  # T(mu, nu; x)
print(tensor_with_args)
print(wrap_indices(tensor_with_args.to_expression(), sp.S("wrap")))