Symbollic simplification of an expression or function
Simplify(expr, env = parent.frame(), scache = new.env())Cache(st, env = Leaves(st), prefix = "")
deCache(st)
A simplified expression. The result is of the same type as
expr
except for formula, where a language is returned.
An expression to be simplified, expr can be
an expression: expression(x+x)
a string: "x+x"
a function: function(x) x+x
a right hand side of a formula: ~x+x
a language: quote(x+x)
An environment in which a simplified function is created
if expr
is a function. This argument is ignored in all other cases.
An environment where there is a list in which simplified expression are cached
A language expression to be cached
A string to start the names of the cache variables
An environment simplifications
containing simplification rules, is exported in the namespace accessible by the user.
Cache() is used to remove redundunt calculations by storing them in
cache variables. Default parameters to Cache() does not have to be provided
by user. deCache() makes the inverse job -- a series of assignements
are replaced by only one big expression without assignement.
Sometimes it is usefull to
apply deChache() and only then pass its result to Cache().