Skip to content

ibp

Integration by parts for scalar expressions.

integrate_by_parts(expr, targets) — full pipeline: expand → simplify → collect → IBP per target

IBP identity (boundary terms dropped): ∫ Dot(ẋ, f) dt = -∫ Dot(x, ḟ) dt

So: Dot(target, rhs) → Dot(-target.t_integrate(), rhs.t_diff())

integrate_by_parts(expr, targets)

Expand, simplify, then apply collect + IBP for each target.

targets is a list of variation vector time-derivatives (e.g. dot_eta) that should be integrated by parts to remove the time derivative.

Source code in geomech/core/math/ibp.py
def integrate_by_parts(expr, targets):
    """Expand, simplify, then apply collect + IBP for each target.

    *targets* is a list of variation vector time-derivatives (e.g. dot_eta)
    that should be integrated by parts to remove the time derivative.
    """
    expr = expand(expr)
    expr = full_simplify(expr)
    for target in targets:
        expr = collect(expr, target)
        expr = _apply_ibp(expr, target)
        expr = full_simplify(expr)
    return expr