Skip to content

simplify

simplify(expr) — pull scalars, apply vector identities, eliminate zeros, combine numeric constants. full_simplify(expr) — expand once, then loop simplify until convergence.

full_simplify(expr, max_iter=10)

Expand once, then loop simplify until convergence.

Parameters

max_iter : int Safety cap on the number of passes (default 10).

Source code in geomech/core/transformations/simplify.py
def full_simplify(expr, max_iter=10):
    """Expand once, then loop simplify until convergence.

    Parameters
    ----------
    max_iter : int
        Safety cap on the number of passes (default 10).
    """
    from geomech.core.transformations.expand import expand

    expr = expand(expr)
    for _ in range(max_iter):
        prev = expr
        expr = simplify(expr)
        if str(expr) == str(prev):
            break
    return expr

simplify(expr)

Pull scalars, apply vector identities, then eliminate zeros and combine numeric constants — single call does everything.

Source code in geomech/core/transformations/simplify.py
def simplify(expr):
    """Pull scalars, apply vector identities, then eliminate zeros and
    combine numeric constants — single call does everything."""
    from geomech.core.transformations.pull import pull
    from geomech.core.transformations.vector_rules import vector_rules

    expr = pull(expr)
    expr = vector_rules(expr)
    return _eliminate(expr)