Skip to contents

ask_fact() returns TRUE, FALSE or NA (unknown) for a single property, following SymPy's expr.is_<property> attributes. The helpers is_positive(), is_real() and friends are shortcuts.

Usage

ask_fact(e, fact)

Arguments

e

A sym expression or a value convertible with as_sym().

fact

One of the assumption names listed in Symbol().

Value

TRUE, FALSE or NA.

Examples

x <- Symbol("x", positive = TRUE)
ask_fact(x^2 + 1, "positive")
#> [1] TRUE
is_integer(Symbol("n", integer = TRUE) * 2)
#> [1] TRUE