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) -> TensorIndicesCall 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
TensorIndicesA 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) -> TensorStructureCall 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
TensorStructureA 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,
) -> TensorNameCreate a new tensor name with optional mathematical properties.
Parameters
name(str) The string name for the tensor functionis_symmetric(bool, optional) If True, tensor is symmetric under index permutationis_antisymmetric(bool, optional) If True, tensor is antisymmetric under index permutationis_cyclesymmetric(bool, optional) If True, tensor is symmetric under cyclic permutationsis_linear(bool, optional) If True, tensor is linear in its argumentscustom_normalization(Transformer, optional) Custom normalization function (advanced)
Returns
TensorNameA 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.strf
TensorName.f() -> TensorNamePredefined color structure constant name.
flat
TensorName.flat() -> TensorNamePredefined musical isomorphism tensor name. This enables dualizing self dual indices.
g
TensorName.g() -> TensorNamePredefined metric tensor name.
gamma
TensorName.gamma() -> TensorNamePredefined gamma matrix name.
gamma5
TensorName.gamma5() -> TensorNamePredefined gamma5 matrix name.
projm
TensorName.projm() -> TensorNamePredefined left chiral projector name.
projp
TensorName.projp() -> TensorNamePredefined right chiral projector name.
sigma
TensorName.sigma() -> TensorNamePredefined sigma matrix name.
t
TensorName.t() -> TensorNamePredefined color generator name.
to_expression
TensorName.to_expression() -> ExpressionConvert the tensor name to a symbolic expression.
Returns
ExpressionA symbolic Expression representing this tensor name
Examples
T = TensorName("T")
expr = T.to_expression()