IBPRule

Symbolica documentation for getting started, symbolic expressions, numerical evaluation, pattern matching, and APIs in Python and Rust.

IBPRule

class IBPRule

One solved IBP identity, with its domain of validity.

Obtain rules from IBPSolution.rules; they have no public constructor. target describes the left-hand integral. terms is the right-hand linear combination as (powers, coefficient) pairs. Symbolic powers use IBPFamily.index_symbols.

Every nonzero_conditions expression must remain nonzero. An exceptional branch is a list of polynomials that vanish simultaneously; any such branch forbids application. Integer-index checks are performed by apply, but conditions still symbolic in masses, dimension or invariants remain the caller’s responsibility when specializing kinematics.

Examples

from symbolica import S, E
from symbolica.community import hepkit as hep
d, k, m2 = S("d", "k", "m2")
kin = hep.Kinematics(d, momenta=[k])
family = hep.IntegralFamily([k], [], [kin.scalar_product(k, k) - m2], kinematics=kin)
ibp = hep.IBPFamily(family, name="T")
solution = ibp.solve_parametric([True], max_depth=1)
rule = solution.rules[0]
terms = rule.apply([2])
assert terms[0][0] == [1]
assert (terms[0][1] - (d-2)/(2*m2)).together() == E("0")

Attributes

Name Description
exceptions Exceptional branches: a rule is forbidden if every polynomial in any one branch vanishes.
nonzero_conditions Expressions required to stay nonzero for this rule
sector Positive-power support of the left-hand integral; False includes both zero and negative powers.
target Left-hand powers as expressions in the family indices
terms Right-hand terms as (power expressions, coefficient) pairs

exceptions

IBPRule.exceptions: list[list[Expression]]

Exceptional branches: a rule is forbidden if every polynomial in any one branch vanishes.

Examples

Using the setup in the IBPRule class example:

for branch in rule.exceptions:
    print("Excluded simultaneous zeroes:", branch)

nonzero_conditions

IBPRule.nonzero_conditions: list[Expression]

Expressions required to stay nonzero for this rule. Symbolic kinematic conditions must be checked before specialization.

Examples

Using the setup in the IBPRule class example:

conditions = rule.nonzero_conditions
for condition in conditions:
    print("Required nonzero:", condition)

sector

IBPRule.sector: list[bool]

Positive-power support of the left-hand integral; False includes both zero and negative powers.

Examples

Using the setup in the IBPRule class example:

assert rule.sector == [True]

target

IBPRule.target: list[Expression]

Left-hand powers as expressions in the family indices. Fixed coordinates are integers.

Examples

Using the setup in the IBPRule class example:

target_powers = rule.target
assert len(target_powers) == ibp.denominator_count

terms

IBPRule.terms: list[tuple[list[Expression], Expression]]

Right-hand terms as (power expressions, coefficient) pairs. Their order is not a reduction priority.

Examples

Using the setup in the IBPRule class example:

I = S("I")
rhs = sum((coefficient * I(*powers) for powers, coefficient in rule.terms), E("0"))

Methods

Name Description
__repr__ Summarize this IBPRule for interactive inspection.
apply Substitute integer powers into this rule and return its right-hand side

__repr__

IBPRule.__repr__() -> str

Summarize this IBPRule for interactive inspection.

Examples

Using the setup in the IBPRule class example:

summary = repr(rule)

apply

IBPRule.apply(powers: list[int], *, integral: None = None) -> list[tuple[list[int], Expression]]
IBPRule.apply(powers: list[int], *, integral: Expression) -> Expression

Substitute integer powers into this rule and return its right-hand side.

Returns a list of (powers, coefficient) pairs, or a Symbolica expression when integral is a bare symbol. Raises ValueError for wrong arity, incompatible fixed powers/sector, or a detected exceptional locus. Conditions that remain symbolic in kinematic parameters must still be nonzero. This applies one rule once; it does not recursively reduce the result.

Examples

Using the setup in the IBPRule class example:

terms = rule.apply([3])
assert terms[0][0] == [2]
I = S("I")
expression = rule.apply([3], integral=I)
assert (expression - terms[0][1]*I(2)).together() == E("0")

Parameters

  • powers (list[int]) One signed 64-bit integer per denominator; booleans are rejected.
  • integral (Expression or None, optional) Bare Symbolica symbol used as the integral function head; default None returns structured terms. Pass S(“I”), not I(1).