The nlsSimplify
function uses simple rules to simplify
expressions. The simplification is aimed at the needs of this
package, so the built-in simplificatinos assume that variables and expressions
have finite real values. For example, 0*expr
will simplify to 0
regardless of the value of expr
. (The name is
nlsSimplify
to avoid a clash with the Simplify
function in the Deriv
package.)
newSimplification
adds a new simplification pattern to the
registered collection. The tests are applied to function calls with
the same function and number of parameters, in order as specified.
Users may specify their own environment (perhaps parented by
sysSimplifications
) to hold rules if they wish to override the
standard rules.
The isFALSE
, isZERO
, isONE
, and isMINUSONE
functions are simple functions to test whether expressions are simple constants,
similar to isTRUE
.
The isCALL
function tests whether an expression is a call to a particular
function.
To handle functions which act differently depending on which arguments
are present, nlsSimplify
will simplify the expression missing(.MissingVal)
to TRUE
. This is used in the definition of the derivative
for x - y
, where the unary minus is seen as a missing y
value.