On this page

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

NameTypeDefaultDescription
namestr

The string name for the tensor function

is_symmetricOptional[bool]None

If True, tensor is symmetric under index permutation

is_antisymmetricOptional[bool]None

If True, tensor is antisymmetric under index permutation

is_cyclesymmetricOptional[bool]None

If True, tensor is symmetric under cyclic permutations

is_linearOptional[bool]None

If True, tensor is linear in its arguments

custom_normalizationOptional[Transformer]None

Custom normalization function (advanced)

Member details

__repr__

Method
#
__repr__() -> str

No description is available for this member.

__str__

Method
#
__str__() -> str

No description is available for this member.

to_expression

Method
#
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()

g

Static method
#
g() -> TensorName

Predefined metric tensor name.

flat

Static method
#
flat() -> TensorName

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

gamma

Static method
#
gamma() -> TensorName

Predefined gamma matrix name.

gamma5

Static method
#
gamma5() -> TensorName

Predefined gamma5 matrix name.

projm

Static method
#
projm() -> TensorName

Predefined left chiral projector name.

projp

Static method
#
projp() -> TensorName

Predefined right chiral projector name.

sigma

Static method
#
sigma() -> TensorName

Predefined sigma matrix name.

f

Static method
#
f() -> TensorName

Predefined color structure constant name.

t

Static method
#
t() -> TensorName

Predefined color generator name.

__call__

Method
#

Overloads

Overload 1 #
__call__(*args: Slot | Expression | int | str | float | complex) -> TensorIndices

Call the tensor name with arguments to create tensor structures.

Accepts a mix of slots and symbolic 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)
Parameters
NameTypeDefaultDescription
argsSlot | Expression | int | str | float | complex
Overload 2 #
__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).

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)
Parameters
NameTypeDefaultDescription
argsRepresentation | Expression