Idenso · latest
On this page

Representation

symbolica.community.tensor Class

Representation(name: str, dimension: int | Expression | str, is_self_dual: bool = True)

An index space with a dimension and a rule for pairing indices.

Use representations to distinguish axes that have the same size but different mathematical meanings. A self-dual space pairs with itself; a dualizable space pairs with its dual(). Calling a representation assigns an index label. Built-in spaces include Euclidean and Minkowski vectors, Dirac spinors, and color representations; custom spaces work with the same tensor operations.

Examples

from symbolica.community.tensor import Representation, TensorName
space = Representation.euc(3)
vector = TensorName.vector("v")(space)
vector("i").rank

Constructor

#

Create or reuse a named index space.

Returns

Representation

The requested space, ready to use as an unresolved tensor axis.

Examples

from symbolica.community.tensor import Representation
space = Representation("Flavor", 5, is_self_dual=False)
space.dual().dual() == space

Parameters

NameTypeDefaultDescription
namestr—

Registered name distinguishing this space from other representations.

dimensionint | Expression | str—

Number of components in this index space, or a symbol naming that number. An Expression must be a single symbol, not a sum or product.

is_self_dualboolTrue

Whether indices pair with the same space. False creates a space with a distinct dual; use dual() to obtain it.

Member details

name

Property · read-only#
name: RepresentationName

The registered space identity and duality, without its dimension.

Returns

RepresentationName

Metadata shared by this representation at different dimensions.

Examples

from symbolica.community.tensor import Representation
Representation.euc(3).name == Representation.euc(5).name

dimension

Property · read-only#
dimension: Expression

The dimension of this index space as a Symbolica expression.

Returns

Expression

An integer-valued expression or a dimension symbol.

Examples

from symbolica.community.tensor import Representation
Representation.euc(3).dimension == 3

__eq__

Method#
__eq__(other: object) -> bool

No description is available for this member.

Parameters

NameTypeDefaultDescription
otherobject——

__call__

Method#

Overloads

Overload 1 #
__call__(aind: int | str) -> Slot

Attach an abstract index label to this space.

Returns

Slot or Expression

A typed index, or symbolic syntax for a compound index payload.

Examples
from symbolica import S
from symbolica.community.tensor import Representation, Slot
space = Representation.euc(3)
isinstance(space(S("i")), Slot)
Parameters
NameTypeDefaultDescription
aindint | str—

An index label, not a component coordinate. A string, Python integer, or single symbol creates a Slot. Other Expressions retain raw representation syntax: supported numeric, tagged named, and scoped labels can be admitted directly; other compound payloads require intern="indices" when constructing a tensor.

Overload 2 #
__call__(aind: Expression) -> Expression | Slot

Attach an abstract index label to this space.

Returns

Slot or Expression

A typed index, or symbolic syntax for a compound index payload.

Examples
from symbolica import S
from symbolica.community.tensor import Representation, Slot
space = Representation.euc(3)
isinstance(space(S("i")), Slot)
Parameters
NameTypeDefaultDescription
aindExpression—

An index label, not a component coordinate. A string, Python integer, or single symbol creates a Slot. Other Expressions retain raw representation syntax: supported numeric, tagged named, and scoped labels can be admitted directly; other compound payloads require intern="indices" when constructing a tensor.

_repr_html_

Method#
_repr_html_() -> str

No description is available for this member.

to_html

Method#
to_html() -> str

Render a compact HTML view of this tensor metadata.

Returns

str

HTML fragment for display in a notebook or page.

Examples

from symbolica.community.tensor import Representation
value = Representation.euc(3)
html = value.to_html()

_repr_latex_

Method#
_repr_latex_() -> str

No description is available for this member.

dual

Method#
dual() -> Representation

Return the space that pairs with this one under contraction.

Returns

Representation

The same space for a self-dual representation; its partner otherwise.

Examples

from symbolica.community.tensor import Representation
Representation.euc(3).dual() == Representation.euc(3)
Representation.cof(3).dual().dual() == Representation.cof(3)

casimir

Method#
casimir(degree: _ScalarInput = 2) -> Expression

Construct the degree-dependent Casimir eigenvalue.

Returns

Expression

A symbolic scalar invariant; constructing it does not evaluate a group-specific formula.

Examples

from symbolica.community.tensor import Representation
invariant = Representation.cof(3).casimir()

Parameters

NameTypeDefaultDescription
degree_ScalarInput2

Degree of the invariant. The default is the quadratic invariant.

dynkin_index

Method#
dynkin_index(degree: _ScalarInput = 2) -> Expression

Construct the degree-dependent Dynkin index.

Returns

Expression

A symbolic scalar invariant; constructing it does not evaluate a group-specific formula.

Examples

from symbolica.community.tensor import Representation
invariant = Representation.cof(3).dynkin_index()

Parameters

NameTypeDefaultDescription
degree_ScalarInput2

Degree of the invariant. The default is the quadratic invariant.

gram

Method#
gram(degree: _ScalarInput, other: Optional[Representation] = None) -> Expression

Construct a Gram invariant for two representations.

Returns

Expression

A symbolic Gram invariant, without evaluating a group-specific formula.

Examples

from symbolica.community.tensor import Representation
invariant = Representation.cof(3).gram(2)

Parameters

NameTypeDefaultDescription
degree_ScalarInput—

Degree of the invariant.

otherOptional[Representation]None

Second representation. Defaults to this representation.

g

Method#
g(i: int | Expression | str, j: int | Expression | str) -> TensorExpression

Create the metric with two explicit index labels.

Returns

TensorExpression

The indexed rank-two tensor, or its contraction when the labels pair.

Notes

Both ports belong to this representation. For a pairing between a space and its dual, use id or TensorExpression.g(rep, rep.dual()).

Examples

from symbolica.community.tensor import Representation
tensor = Representation.euc(3).g("i", "j")
tensor.rank

Parameters

NameTypeDefaultDescription
iint | Expression | str—

Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.

jint | Expression | str—

Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.

flat

Method#
flat(i: int | Expression | str, j: int | Expression | str) -> TensorExpression

Create the metric map used to lower or raise an index.

Returns

TensorExpression

The indexed rank-two tensor, or its contraction when the labels pair.

Notes

Both ports belong to this representation. The flat map accounts for the metric signs when identifying vectors and covectors.

Examples

from symbolica.community.tensor import Representation
tensor = Representation.euc(3).flat("i", "j")
tensor.rank

Parameters

NameTypeDefaultDescription
iint | Expression | str—

Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.

jint | Expression | str—

Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.

id

Method#
id(i: int | Expression | str, j: int | Expression | str) -> TensorExpression

Create the identity pairing between this space and its dual.

Returns

TensorExpression

The indexed rank-two tensor, or its contraction when the labels pair.

Notes

The first port is in self.dual() and the second in self.

Examples

from symbolica.community.tensor import Representation
tensor = Representation.euc(3).id("i", "j")
tensor.rank

Parameters

NameTypeDefaultDescription
iint | Expression | str—

Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.

jint | Expression | str—

Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.

__repr__

Method#
__repr__() -> str

Return a readable object description for inspection.

Examples

from symbolica.community import tensor as sp
r = sp.Representation.mink(4)
text = repr(r)

__str__

Method#
__str__() -> str

Return a readable text representation.

Examples

from symbolica.community import tensor as sp
r = sp.Representation.mink(4)
text = str(r)

to_expression

Method#
to_expression() -> Expression

Return the symbolic encoding of the space and its dimension.

Returns

Expression

Representation syntax without an index label. Use the Representation itself when constructing tensor axes.

Examples

from symbolica.community.tensor import Representation
encoded = Representation.euc(3).to_expression()

bis

Static method#
bis(dimension: int | Expression | str) -> Representation

Create the Dirac bispinor space.

Returns

Representation

The built-in index space with the supplied dimension.

Notes

This is the self-dual spinor index space used by the Dirac-matrix helpers. Its dimension counts spinor components, not space-time coordinates.

Examples

from symbolica.community.tensor import Representation
space = Representation.bis(4)
space.dimension == 4

Parameters

NameTypeDefaultDescription
dimensionint | Expression | str—

Number of components in this index space, or a symbol naming that number. An Expression must be a single symbol, not a sum or product.

euc

Static method#
euc(dimension: int | Expression | str) -> Representation

Create the Euclidean vector space.

Returns

Representation

The built-in index space with the supplied dimension.

Notes

The space is self-dual, with positive metric signs on every component.

Examples

from symbolica.community.tensor import Representation
space = Representation.euc(3)
space.dimension == 3

Parameters

NameTypeDefaultDescription
dimensionint | Expression | str—

Number of components in this index space, or a symbol naming that number. An Expression must be a single symbol, not a sum or product.

mink

Static method#
mink(dimension: int | Expression | str) -> Representation

Create the Minkowski vector space.

Returns

Representation

The built-in index space with the supplied dimension.

Notes

The space is self-dual, with metric signature (+, -, ..., -). Component zero is the time coordinate.

Examples

from symbolica.community.tensor import Representation
space = Representation.mink(4)
space.dimension == 4

Parameters

NameTypeDefaultDescription
dimensionint | Expression | str—

Number of components in this index space, or a symbol naming that number. An Expression must be a single symbol, not a sum or product.

cof

Static method#
cof(dimension: int | Expression | str) -> Representation

Create the fundamental color representation.

Returns

Representation

The built-in index space with the supplied dimension.

Notes

For SU(N), the dimension is N. This space pairs with its distinct dual, the antifundamental representation.

Examples

from symbolica.community.tensor import Representation
space = Representation.cof(3)
space.dimension == 3

Parameters

NameTypeDefaultDescription
dimensionint | Expression | str—

Number of components in this index space, or a symbol naming that number. An Expression must be a single symbol, not a sum or product.

coad

Static method#
coad(dimension: int | Expression | str) -> Representation

Create the adjoint color representation.

Returns

Representation

The built-in index space with the supplied dimension.

Notes

For SU(N), pass N**2 - 1 (for example 8 for SU(3)). This space is self-dual.

Examples

from symbolica.community.tensor import Representation
space = Representation.coad(8)
space.dimension == 8

Parameters

NameTypeDefaultDescription
dimensionint | Expression | str—

Number of components in this index space, or a symbol naming that number. An Expression must be a single symbol, not a sum or product.

cos

Static method#
cos(dimension: int | Expression | str) -> Representation

Create the sextet color representation.

Returns

Representation

The built-in index space with the supplied dimension.

Notes

The SU(3) sextet has dimension 6 and a distinct dual representation.

Examples

from symbolica.community.tensor import Representation
space = Representation.cos(6)
space.dimension == 6

Parameters

NameTypeDefaultDescription
dimensionint | Expression | str—

Number of components in this index space, or a symbol naming that number. An Expression must be a single symbol, not a sum or product.