(condition, rewrite)
return _proxy_rewriter
Strategy that rewrites an integrand based on some other criteria.
Strategy that rewrites an integrand based on some other criteria.
Strategy that rewrites an integrand based on some other criteria .
def proxy_rewriter(condition, rewrite):
    """Strategy that rewrites an integrand based on some other criteria."""
    def _proxy_rewriter(criteria):
        criteria, integral = criteria
        integrand, symbol = integral
        args = criteria + list(integral)
        if condition(*args):
            rewritten = rewrite(*args)
            if rewritten != integrand:
                return RewriteRule(
                    rewritten,
                    integral_steps(rewritten, symbol),
                    integrand, symbol)
    return _proxy_rewriter
def proxy_rewriter ( condition , rewrite ) : def _proxy_rewriter ( criteria ) : criteria , integral = criteria integrand , symbol = integral args = criteria + list ( integral ) if condition ( * args ) : rewritten = rewrite ( * args ) if rewritten != integrand : return RewriteRule ( rewritten , integral_steps ( rewritten , symbol ) , integrand , symbol ) return _proxy_rewriter