Skip to contents

SymPy's test_closed_group(expr, assumptions, key): whether every argument of expr satisfies the predicate key (fuzzy, with SymPy's rule that at most one argument may fail), as used by the handlers of ask() for sums and products.

Usage

test_closed_group(expr, assumptions = TRUE, key)

Arguments

expr

An expression.

assumptions

Assumptions, as for ask().

key

A predicate such as Q$positive, or its name.

Value

TRUE, FALSE or NA.

Examples

x <- Symbol("x")
test_closed_group(x + 1, Q$positive(x), Q$positive)
#> [1] TRUE