Description Usage Arguments Details Value Note Author(s) See Also Examples

`nlsSimplify`

simplifies expressions according to rules specified
by `newSimplification`

.

1 2 3 4 5 6 7 8 9 | ```
nlsSimplify(expr, simpEnv = sysSimplifications, verbose = FALSE)
newSimplification(expr, test, simplification, do_eval = FALSE,
simpEnv = sysSimplifications)
sysSimplifications
isFALSE(x)
isZERO(x)
isONE(x)
isMINUSONE(x)
isCALL(x, name)
``` |

`expr` |
An expression to simplify; this should be a language object. |

`simpEnv` |
An environment holding the registered simplifications. |

`verbose` |
If |

`test` |
An expression giving a test to apply to decide whether this simplification applies. |

`simplification` |
The new expression to use to replace the original one. |

`do_eval` |
Whether to evaluate the new expression (to give an even newer expression) to use as the simplification. |

`x` |
An expression to test. |

`name` |
The name of a function as a character string. |

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.

`nlsSimplify`

returns a simplification of the expression, assuming
that variables and functions take real values.

The `newSimplification`

function is called for the side
effect of recording a new simplification rule.

If `expr`

or `deriv`

is missing, `newSimplification()`

will
report on the currently saved simplifications in `simpEnv`

.

The `isFALSE`

function was added to base **R** in version 3.5.0;
starting with that version, `nlsr::isFALSE`

is simply a copy
of it.

Duncan Murdoch

`nlsDeriv`

, which makes use of `nlsSimplify`

.

1 2 3 4 5 6 7 | ```
nlsSimplify(quote(a + 0))
nlsSimplify(quote(exp(1)), verbose = TRUE)
nlsSimplify(quote(sqrt(a + b))) # standard rule
myrules <- new.env(parent = sysSimplifications)
newSimplification(sqrt(a), TRUE, a^0.5, simpEnv = myrules)
nlsSimplify(quote(sqrt(a + b)), simpEnv = myrules)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.