Determine if an expression is constant, affine, convex, concave, quadratic, piecewise linear (pwl), or quadratic/piecewise affine (qpwa).

is_constant(object)

is_affine(object)

is_convex(object)

is_concave(object)

is_quadratic(object)

is_pwl(object)

is_qpwa(object)

Arguments

object

An Expression object.

Value

A logical value.

Examples

x <- Variable()
c <- Constant(5)

is_constant(c)
#> [1] TRUE
is_constant(x)
#> [1] FALSE

is_affine(c)
#> [1] TRUE
is_affine(x)
#> [1] TRUE
is_affine(x^2)
#> [1] FALSE

is_convex(c)
#> [1] TRUE
is_convex(x)
#> [1] TRUE
is_convex(x^2)
#> [1] TRUE
is_convex(sqrt(x))
#> [1] FALSE

is_concave(c)
#> [1] TRUE
is_concave(x)
#> [1] TRUE
is_concave(x^2)
#> [1] FALSE
is_concave(sqrt(x))
#> [1] TRUE

is_quadratic(x^2)
#> [1] TRUE
is_quadratic(sqrt(x))
#> [1] FALSE

is_pwl(c)
#> [1] TRUE
is_pwl(x)
#> [1] TRUE
is_pwl(x^2)
#> [1] FALSE