| newSimplification | R Documentation |
Define a new simplification expression
newSimplification(expr, test, simplification, do_eval = FALSE,
simpEnv = sysSimplifications)
expr |
An expression to simplify. |
test |
An expression to evaluate whether the simplification
should be applied to |
simplification |
An equivalent but simpler version of the expression. |
do_eval |
Whether the simplification should be evaluated or stored as-is. |
simpEnv |
The environment in which the simplification is stored. |
If expr is missing, list all the functions with known
simplifications.
If test is missing, list all the known simplifications for
expr.
Otherwise, add the new simplification to the list of possible simplifications.
# The unary + operation can always be safely removed:
newSimplification(+a, TRUE, a)
# The unary - operation can be absorbed into numeric values:
newSimplification(-a, is.numeric(a), -a, do_eval = TRUE)
# Adding zero to anything can be skipped:
newSimplification(a + b, isZERO(b), a)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.