to_dots
symbolica.community.idenso Function
to_dots(self_: Expression) -> ExpressionConverts contracted Lorentz/Minkowski indices into dot product notation.
Automatically identifies and converts patterns like p(mink(D, mu)) * q(mink(D, mu)) into the compact, representation-carrying dot(p(mink(D)), q(mink(D))) notation. This simplification is essential for physics calculations involving four-vectors.
The function recognizes:
- Contracted vector indices:
pᵘqᵤ → p·q - Multiple contractions:
pᵘqᵤrᵛsᵥ → (p·q)(r·s) - Self-contractions:
pᵘpᵤ → p²
Arguments
self_: expression containing contracted Minkowski vector indices
Returns
The expression with vector contractions converted to dot products.
Examples
from symbolica.community.idenso import to_dots
from symbolica.community.spenso import Representation, TensorName
p = TensorName("p")
q = TensorName("q")
rep = Representation.euc(3)
# With slots (creates TensorIndices)
mu = rep("mu")
nu = rep("nu")
print(to_dots( p(mu)*q(mu)))View generated signature source: docs/api/python/idenso-community.pyi:445