Representation
Representation
class RepresentationAn 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
1Attributes
| Name | Description |
|---|---|
dimension |
The dimension of this index space as a Symbolica expression. |
name |
The registered space identity and duality, without its dimension. |
dimension
Representation.dimension: ExpressionThe dimension of this index space as a Symbolica expression.
Returns
ExpressionAn integer-valued expression or a dimension symbol.
Examples
from symbolica.community.tensor import Representation
Representation.euc(3).dimension == 3
Truename
Representation.name: RepresentationNameThe registered space identity and duality, without its dimension.
Returns
RepresentationNameMetadata shared by this representation at different dimensions.
Examples
from symbolica.community.tensor import Representation
Representation.euc(3).name == Representation.euc(5).name
TrueMethods
| Name | Description |
|---|---|
__call__ |
Attach an abstract index label to this space. |
__eq__ |
|
__new__ |
Create or reuse a named index space. |
__repr__ |
Return a readable object description for inspection. |
__str__ |
Return a readable text representation. |
_repr_html_ |
|
_repr_latex_ |
|
bis |
Create the Dirac bispinor space. |
casimir |
Construct the degree-dependent Casimir eigenvalue. |
coad |
Create the adjoint color representation. |
cof |
Create the fundamental color representation. |
cos |
Create the sextet color representation. |
dual |
Return the space that pairs with this one under contraction. |
dynkin_index |
Construct the degree-dependent Dynkin index. |
euc |
Create the Euclidean vector space. |
flat |
Create the metric map used to lower or raise an index. |
g |
Create the metric with two explicit index labels. |
gram |
Construct a Gram invariant for two representations. |
id |
Create the identity pairing between this space and its dual. |
mink |
Create the Minkowski vector space. |
to_expression |
Return the symbolic encoding of the space and its dimension. |
to_html |
Render a compact HTML view of this tensor metadata. |
__call__
Representation.__call__(aind: builtins.int | builtins.str) -> Slot
Representation.__call__(aind: Expression) -> Expression | SlotAttach an abstract index label to this space.
Parameters
aind(int, str, or Expression) 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 requireintern="indices"when constructing a tensor.
Returns
Slot or ExpressionA 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)
True__eq__
Representation.__eq__(other: builtins.object) -> builtins.bool__new__
Representation.__new__(
name: builtins.str,
dimension: builtins.int | Expression | str,
is_self_dual: builtins.bool = True,
) -> RepresentationCreate or reuse a named index space.
Parameters
name(str) Registered name distinguishing this space from other representations.dimension(int, Expression, or 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_dual(bool, default True) Whether indices pair with the same space. False creates a space with a distinct dual; usedual()to obtain it.
Returns
RepresentationThe 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
True__repr__
Representation.__repr__() -> builtins.strReturn a readable object description for inspection.
Examples
from symbolica.community import tensor as sp
r = sp.Representation.mink(4)
text = repr(r)__str__
Representation.__str__() -> builtins.strReturn a readable text representation.
Examples
from symbolica.community import tensor as sp
r = sp.Representation.mink(4)
text = str(r)_repr_html_
Representation._repr_html_() -> builtins.str_repr_latex_
Representation._repr_latex_() -> builtins.strbis
Representation.bis(dimension: builtins.int | Expression | str) -> RepresentationCreate the Dirac bispinor space.
Parameters
dimension(int, Expression, or 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.
Returns
RepresentationThe 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
Truecasimir
Representation.casimir(degree: _ScalarInput = 2) -> ExpressionConstruct the degree-dependent Casimir eigenvalue.
Parameters
degree(scalar expression, default 2) Degree of the invariant. The default is the quadratic invariant.
Returns
ExpressionA symbolic scalar invariant; constructing it does not evaluate a group-specific formula.
Examples
from symbolica.community.tensor import Representation
invariant = Representation.cof(3).casimir()coad
Representation.coad(dimension: builtins.int | Expression | str) -> RepresentationCreate the adjoint color representation.
Parameters
dimension(int, Expression, or 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.
Returns
RepresentationThe 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
Truecof
Representation.cof(dimension: builtins.int | Expression | str) -> RepresentationCreate the fundamental color representation.
Parameters
dimension(int, Expression, or 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.
Returns
RepresentationThe 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
Truecos
Representation.cos(dimension: builtins.int | Expression | str) -> RepresentationCreate the sextet color representation.
Parameters
dimension(int, Expression, or 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.
Returns
RepresentationThe 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
Truedual
Representation.dual() -> RepresentationReturn the space that pairs with this one under contraction.
Returns
RepresentationThe same space for a self-dual representation; its partner otherwise.
Examples
from symbolica.community.tensor import Representation
Representation.euc(3).dual() == Representation.euc(3)
True
Representation.cof(3).dual().dual() == Representation.cof(3)
Truedynkin_index
Representation.dynkin_index(degree: _ScalarInput = 2) -> ExpressionConstruct the degree-dependent Dynkin index.
Parameters
degree(scalar expression, default 2) Degree of the invariant. The default is the quadratic invariant.
Returns
ExpressionA 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()euc
Representation.euc(dimension: builtins.int | Expression | str) -> RepresentationCreate the Euclidean vector space.
Parameters
dimension(int, Expression, or 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.
Returns
RepresentationThe 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
Trueflat
Representation.flat(
i: builtins.int | Expression | str,
j: builtins.int | Expression | str,
) -> TensorExpressionCreate the metric map used to lower or raise an index.
Parameters
i, j(int, str, or Expression) Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.
Returns
TensorExpressionThe 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
2g
Representation.g(
i: builtins.int | Expression | str,
j: builtins.int | Expression | str,
) -> TensorExpressionCreate the metric with two explicit index labels.
Parameters
i, j(int, str, or Expression) Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.
Returns
TensorExpressionThe 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
2gram
Representation.gram(
degree: _ScalarInput,
other: typing.Optional[Representation] = None,
) -> ExpressionConstruct a Gram invariant for two representations.
Parameters
degree(scalar expression) Degree of the invariant.other(Representation, optional) Second representation. Defaults to this representation.
Returns
ExpressionA symbolic Gram invariant, without evaluating a group-specific formula.
Examples
from symbolica.community.tensor import Representation
invariant = Representation.cof(3).gram(2)id
Representation.id(
i: builtins.int | Expression | str,
j: builtins.int | Expression | str,
) -> TensorExpressionCreate the identity pairing between this space and its dual.
Parameters
i, j(int, str, or Expression) Abstract index labels accepted by the shared tensor-structure parser, including numeric, symbolic, tagged named, and scoped indices.
Returns
TensorExpressionThe 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
2mink
Representation.mink(dimension: builtins.int | Expression | str) -> RepresentationCreate the Minkowski vector space.
Parameters
dimension(int, Expression, or 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.
Returns
RepresentationThe 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
Trueto_expression
Representation.to_expression() -> ExpressionReturn the symbolic encoding of the space and its dimension.
Returns
ExpressionRepresentation 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()to_html
Representation.to_html() -> builtins.strRender a compact HTML view of this tensor metadata.
Returns
strHTML fragment for display in a notebook or page.
Examples
from symbolica.community.tensor import Representation
value = Representation.euc(3)
html = value.to_html()