TensorName
symbolica.community.spenso Class
TensorName(name: str, is_symmetric: Optional[bool] = None, is_antisymmetric: Optional[bool] = None, is_cyclesymmetric: Optional[bool] = None, is_linear: Optional[bool] = None, custom_normalization: Optional[Transformer] = None)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)Constructor
#Create a new tensor name with optional mathematical properties.
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)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | — | The string name for the tensor function |
is_symmetric | Optional[bool] | None | If True, tensor is symmetric under index permutation |
is_antisymmetric | Optional[bool] | None | If True, tensor is antisymmetric under index permutation |
is_cyclesymmetric | Optional[bool] | None | If True, tensor is symmetric under cyclic permutations |
is_linear | Optional[bool] | None | If True, tensor is linear in its arguments |
custom_normalization | Optional[Transformer] | None | Custom normalization function (advanced) |
Member details
__repr__
Method__str__
Methodto_expression
Methodto_expression() -> ExpressionConvert the tensor name to a symbolic expression.
Returns
Expression
A symbolic Expression representing this tensor name
Examples
T = TensorName("T")
expr = T.to_expression()g
Static methodflat
Static methodflat() -> TensorNamePredefined musical isomorphism tensor name. This enables dualizing self dual indices.
gamma
Static methodgamma5
Static methodprojm
Static methodprojp
Static methodsigma
Static methodf
Static methodt
Static method__call__
MethodOverloads
Overload 1 #
__call__(*args: Slot | Expression | int | str | float | complex) -> TensorIndicesCall the tensor name with arguments to create tensor structures.
Accepts a mix of slots and symbolic expressions (for additional arguments).
Returns
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)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
args | Slot | Expression | int | str | float | complex | — | — |
Overload 2 #
__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).
Returns
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)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
args | Representation | Expression | — | — |
View generated signature source: docs/api/python/spynso3.pyi:1285