TensorName

TensorName

TensorName()

A symbolic name for tensor functions and structures.

TensorName represents named tensor functions that can be called with indices and arguments to create tensor structures. Names can have various mathematical properties like symmetry, antisymmetry, and custom normalization or printing behavior.

Examples

from symbolica.community.spenso import TensorName, Slot, Representation
T = TensorName("T")
symmetric_T = TensorName("S", is_symmetric=True)
antisymmetric_T = TensorName("A", is_antisymmetric=True)
rep = Representation.cof(3)
mu = rep('mu')
nu = rep('nu')
tensor_structure = T(mu, nu)

Methods

Name Description
__call__ Call the tensor name with arguments to create tensor structures
__new__ Create a new tensor name with optional mathematical properties.
__repr__
__str__
f Predefined color structure constant name.
flat Predefined musical isomorphism tensor name
g Predefined metric tensor name.
gamma Predefined gamma matrix name.
gamma5 Predefined gamma5 matrix name.
projm Predefined left chiral projector name.
projp Predefined right chiral projector name.
sigma Predefined sigma matrix name.
t Predefined color generator name.
to_expression Convert the tensor name to a symbolic expression.

__call__

__call__ has 2 variants:

__call__ returning TensorIndices

TensorName.__call__(*args: Slot | Expression | int | str | float | builtins.complex) -> TensorIndices

Call the tensor name with arguments to create tensor structures.

Accepts a mix of slots and symbolic expressions (for additional arguments).

Parameters

  • *args (Slot or Expression) Slot objects and Expressions for additional arguments

Returns

  • TensorIndices A new TensorIndices object

Examples

from symbolica.community.spenso import TensorName, Slot, Representation
import symbolica as sp
T = TensorName("T")
rep = Representation.euc(3)
mu = rep("mu")
nu = rep("nu")
indexed_tensor = T(mu, nu)

__call__ returning TensorStructure

TensorName.__call__(*args: Representation | Expression) -> TensorStructure

Call the tensor name with arguments to create a TensorStructure.

Accepts a mix of representations and symbolic expressions (for additional arguments).

Parameters

  • *args (Representation or Expression) Representation objects and Expressions for additional arguments

Returns

  • TensorStructure A new TensorStructure object

Examples

from symbolica.community.spenso import TensorName, Slot, Representation
import symbolica as sp
T = TensorName("T")
rep = Representation.euc(3)
structure_tensor = T(rep, rep)

__new__

TensorName.__new__(
    name: builtins.str,
    is_symmetric: typing.Optional[builtins.bool] = None,
    is_antisymmetric: typing.Optional[builtins.bool] = None,
    is_cyclesymmetric: typing.Optional[builtins.bool] = None,
    is_linear: typing.Optional[builtins.bool] = None,
    custom_normalization: typing.Optional[Transformer] = None,
) -> TensorName

Create a new tensor name with optional mathematical properties.

Parameters

  • name (str) The string name for the tensor function
  • is_symmetric (bool, optional) If True, tensor is symmetric under index permutation
  • is_antisymmetric (bool, optional) If True, tensor is antisymmetric under index permutation
  • is_cyclesymmetric (bool, optional) If True, tensor is symmetric under cyclic permutations
  • is_linear (bool, optional) If True, tensor is linear in its arguments
  • custom_normalization (Transformer, optional) Custom normalization function (advanced)

Returns

  • TensorName A new TensorName with the specified properties

Examples

from symbolica.community.spenso import TensorName
T = TensorName("T")
g = TensorName("g", is_symmetric=True)
F = TensorName("F", is_antisymmetric=True)
D = TensorName("D", is_linear=True)

__repr__

TensorName.__repr__() -> builtins.str

__str__

TensorName.__str__() -> builtins.str

f

TensorName.f() -> TensorName

Predefined color structure constant name.

flat

TensorName.flat() -> TensorName

Predefined musical isomorphism tensor name. This enables dualizing self dual indices.

g

TensorName.g() -> TensorName

Predefined metric tensor name.

gamma

TensorName.gamma() -> TensorName

Predefined gamma matrix name.

gamma5

TensorName.gamma5() -> TensorName

Predefined gamma5 matrix name.

projm

TensorName.projm() -> TensorName

Predefined left chiral projector name.

projp

TensorName.projp() -> TensorName

Predefined right chiral projector name.

sigma

TensorName.sigma() -> TensorName

Predefined sigma matrix name.

t

TensorName.t() -> TensorName

Predefined color generator name.

to_expression

TensorName.to_expression() -> Expression

Convert the tensor name to a symbolic expression.

Returns

  • Expression A symbolic Expression representing this tensor name

Examples

T = TensorName("T")
expr = T.to_expression()