Kinematics
symbolica.community.hepkit Class
Kinematics(dimension: Optional[Expression] = None, *, momenta: Optional[Sequence[Expression]] = None) Scoped symbolic scalar products and two-to-two Mandelstam kinematics.
The immutable object uses Spenso's dot products and metric shorthand. Apply it after contracting tensors with Idenso. Momentum inputs are unindexed names, and mass inputs are squared masses.
Examples
from symbolica import S, E
from symbolica.community import hepkit as hep
P = hep.Kinematics.external_momentum()
p1, p2, p3, p4 = [P(i) for i in range(4)]
s, t, u = hep.Kinematics.s(), hep.Kinematics.t(), hep.Kinematics.u()
kin = hep.Kinematics.mandelstam([p1, p2, p3, p4], [E("0")]*4, [s, t, u])
assert kin.scalar_product(p1, p2) == s/2Constructor
#Start with no scalar-product assumptions in the chosen dimension.
Examples
Using the setup in the Kinematics class example:
kin = hep.Kinematics()
dimensional = hep.Kinematics(S("D"))Parameters
| Name | Type | Default | Description |
|---|---|---|---|
dimension | Optional[ | None | Integer or symbolic Lorentz dimension; defaults to four. |
momenta | Optional[ | None | Momentum names used in linear combinations with scalar coefficients. |
Member details
dimension
Property · read-only#dimension: ExpressionLorentz dimension as a Symbolica integer or symbol.
Examples
Using the setup in the Kinematics class example:
assert hep.Kinematics(S("D")).dimension == S("D")s
Static method#s() -> ExpressionMandelstam invariant s=(p1+p2)^2 for p1 + p2 -> p3 + p4.
Examples
from symbolica.community import hepkit as hep
s = hep.Kinematics.s()t
Static method#t() -> ExpressionMandelstam invariant t=(p1-p3)^2 for p1 + p2 -> p3 + p4.
Examples
from symbolica.community import hepkit as hep
t = hep.Kinematics.t()u
Static method#u() -> ExpressionMandelstam invariant u=(p1-p4)^2 for p1 + p2 -> p3 + p4.
Examples
from symbolica.community import hepkit as hep
u = hep.Kinematics.u()external_momentum
Static method#external_momentum() -> ExpressionExternal momentum family indexed by physical leg.
Examples
from symbolica.community import hepkit as hep
reference = hep.Kinematics.external_momentum()loop_momentum
Static method#loop_momentum() -> ExpressionLoop momentum family indexed by loop basis position.
Examples
from symbolica.community import hepkit as hep
reference = hep.Kinematics.loop_momentum()mandelstam
Static method#mandelstam(momenta: Sequence[Expression], mass_squared: Sequence[Expression], invariants: Sequence[Expression]) -> Kinematics Set the invariants for p1 + p2 -> p3 + p4.
The convention is s=(p1+p2)^2, t=(p1-p3)^2, and u=(p1-p4)^2. These obey s+t+u=sum(mass_squared); use Symbolica substitution when you want to eliminate one invariant.
Examples
Using the setup in the Kinematics class example:
kin = hep.Kinematics.mandelstam([p1, p2, p3, p4], [E("0")]*4, [s, t, u])Parameters
| Name | Type | Default | Description |
|---|---|---|---|
momenta | Sequence[ | — | Four unindexed momenta, with the incoming pair first. |
mass_squared | Sequence[ | — | Four squared masses in the same order. |
invariants | Sequence[ | — | The three symbols or expressions |
with_scalar_product
Method#with_scalar_product(left: Expression, right: Expression, value: Expression) -> Kinematics Return a new context with one scalar product set.
Examples
Using the setup in the Kinematics class example:
p, m = S("p", "m")
kin = hep.Kinematics(momenta=[p]).with_scalar_product(p, p, m**2)
assert kin.scalar_product(p, p) == m**2Parameters
| Name | Type | Default | Description |
|---|---|---|---|
left | Expression | — | First unindexed momentum. |
right | Expression | — | Second unindexed momentum. |
value | Expression | — | Assumed scalar product. |
scalar_product
Method#scalar_product(left: Expression, right: Expression) -> Expression Expand a bilinear scalar product and apply known assumptions.
For linear combinations, declare the momentum names in the constructor or by setting scalar products. Other symbols are scalar coefficients. Nonlinear momentum expressions raise KinematicsError.
Examples
Using the setup in the Kinematics class example:
assert kin.scalar_product(p1, p2) == s/2
assert kin.scalar_product(p1 + p2, p1 + p2) == sParameters
| Name | Type | Default | Description |
|---|---|---|---|
left | Expression | — | First unindexed momentum or linear combination. |
right | Expression | — | Second unindexed momentum or linear combination. |
flux
Method#flux(first: Expression, second: Optional[Expression] = None) -> Expression Return the initial-state denominator for a cross section or decay rate.
Two momenta give 4*sqrt((p1.p2)2-p12*p2**2). One momentum gives 2*sqrt(p**2) for a decay in its rest frame. Divide the squared matrix element times phase space by this value. Inputs must be physical, future-directed on-shell momenta. Symbolica retains square-root branches; declare positive invariants with S("s", is_positive=True) when known.
Examples
Using the setup in the Kinematics class example:
p1, p2, s = S("p1", "p2", "s")
kin = hep.Kinematics(momenta=[p1, p2])
kin = kin.with_scalar_product(p1, p1, E("0")).with_scalar_product(p2, p2, E("0"))
kin = kin.with_scalar_product(p1, p2, s/2)
flux = kin.flux(p1, p2)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
first | Expression | — | Incoming unindexed momentum or declared linear combination. |
second | Optional[ | None | Other incoming momentum; None selects a rest-frame decay. |
two_body_phase_space
Method#two_body_phase_space(first: Expression, second: Expression) -> Expression Return four-dimensional two-body phase space per unit solid angle.
This is dPhi_2/dOmega in the final pair's rest frame, with (2*pi)**4*delta4(P-p1-p2) and d3p/((2*pi)**3*2E) for each final particle. Use physical on-shell momenta above threshold. Flux, spin/color averages and identical-particle factors are separate. For an angle-independent amplitude, integrating this measure gives 4*pi times the returned expression. Non-four-dimensional contexts are rejected.
Examples
Using the setup in the Kinematics class example:
p1, p2, p3, p4, s, t, u = S("p1", "p2", "p3", "p4", "s", "t", "u")
kin = hep.Kinematics.mandelstam([p1, p2, p3, p4], [E("0")]*4, [s, t, u])
density = kin.two_body_phase_space(p3, p4)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
first | Expression | — | First outgoing unindexed momentum or declared linear combination. |
second | Expression | — | Second outgoing unindexed momentum or declared linear combination. |
three_body_phase_space
Method#three_body_phase_space(first: Expression, second: Expression, third: Expression) -> Expression Return four-dimensional three-body phase space per two Dalitz invariants.
This is dPhi_3/(ds12*ds23) = 1/(128*pi**3*P2), where P=first+second+third and sij=(pi+pj)2. The overall spatial orientation is integrated. Use an orientation-independent or orientation-averaged squared amplitude and physical on-shell momenta. The measure includes (2*pi)**4*delta4 and one d3p/((2*pi)**3*2E) for each final particle.
Masses constrain the allowed Dalitz region; its boundaries are not imposed here. Flux, spin/color averages and identical-particle factors remain separate. Non-four-dimensional contexts are rejected.
Examples
Using the setup in the Kinematics class example:
k1, k2, k3 = S("k1", "k2", "k3")
kin = hep.Kinematics(momenta=[k1, k2, k3])
density = kin.three_body_phase_space(k1, k2, k3)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
first | Expression | — | Final-state on-shell momenta. Their scalar products determine the total invariant mass squared through this kinematic context. |
second | Expression | — | Final-state on-shell momenta. Their scalar products determine the total invariant mass squared through this kinematic context. |
third | Expression | — | Final-state on-shell momenta. Their scalar products determine the total invariant mass squared through this kinematic context. |
apply
Method#Overloads
Overload 1 #
apply(expression: TensorExpression) -> TensorExpressionSubstitute scalar products without mutating global assumptions.
Accepts a scalar Expression or a tensor expression. Tensor results retain the ordered open slots, including when the result is zero.
Examples
Using the setup in the Kinematics class example:
p1, p2, p3, p4, s, t, u = S("p1", "p2", "p3", "p4", "s", "t", "u")
free = hep.Kinematics(momenta=[p1, p2, p3, p4])
kin = hep.Kinematics.mandelstam([p1, p2, p3, p4], [E("0")]*4, [s, t, u])
contracted_expression = free.scalar_product(p1, p2)
assert kin.apply(contracted_expression) == s/2Parameters
| Name | Type | Default | Description |
|---|---|---|---|
expression | TensorExpression | — | Expression with compact scalar products. |
Overload 2 #
apply(expression: Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]) -> Expression Substitute scalar products without mutating global assumptions.
Accepts a scalar Expression or a tensor expression. Tensor results retain the ordered open slots, including when the result is zero.
Examples
Using the setup in the Kinematics class example:
p1, p2, p3, p4, s, t, u = S("p1", "p2", "p3", "p4", "s", "t", "u")
free = hep.Kinematics(momenta=[p1, p2, p3, p4])
kin = hep.Kinematics.mandelstam([p1, p2, p3, p4], [E("0")]*4, [s, t, u])
contracted_expression = free.scalar_product(p1, p2)
assert kin.apply(contracted_expression) == s/2Parameters
| Name | Type | Default | Description |
|---|---|---|---|
expression | Expression | int | Float | int | float | str | decimal. | — | Expression with compact scalar products. |
View generated signature source: docs/api/python/feynkit-community.pyi:6240