Skip to contents

Each entry is a closed call (or literal) representing the named primitive in pure-EML form. The catalog covers the 18 entries listed in eml_catalog(): the seven constants one, e, zero, neg_one, two, i, pi, the unary primitives exp, log, minus, sqrt, sin, cos, and the binary primitives add, sub, mul, div, pow. Higher trigonometric primitives (tan, asin, acos, atan) and hyperbolics (sinh, cosh, tanh) are constructible from the same building blocks but are not shipped as named entries. Constructions are correct but not K-optimal — see the paper's Table 4 for the smaller forms found by exhaustive search.

Usage

tree_e()

tree_one()

tree_exp(x = "x")

tree_ln(x = "x")

tree_log(x = "x")

tree_sub(x = "x", y = "y")

tree_zero()

tree_neg_one()

tree_minus(x = "x")

tree_add(x = "x", y = "y")

tree_mul(x = "x", y = "y")

tree_div(x = "x", y = "y")

tree_pow(x = "x", y = "y")

tree_two()

tree_i()

tree_pi()

tree_sqrt(x = "x")

tree_sin(x = "x")

tree_cos(x = "x")

Arguments

x, y

character (variable name) or an EML expression to embed. Univariate constructors take only x; bivariate constructors (tree_add, tree_sub, tree_mul, tree_div, tree_pow) take both. Defaults are "x" and "y".

Value

An EML expression.

See also

eml_catalog() for the catalog as a named list, verify_catalog() for end-to-end numerical verification, and simplify_native() for collapsing these expressions to base-R primitives.

Examples

tree_log("x") # eml(1, eml(eml(1, x), 1))  — paper Eq. 5
#> eml(1, eml(eml(1, x), 1))
tree_exp("x") # eml(x, 1)
#> eml(x, 1)
tree_add("x", "y")
#> eml(eml(1, eml(eml(1, x), 1)), eml(eml(eml(1, eml(eml(1, eml(1, 
#>     eml(eml(1, 1), 1))), 1)), eml(y, 1)), 1))
simplify_native(tree_log("x")) # log(x)
#> log(x)