Learn R Programming

nlsr (version 2023.8.31)

findSubexprs: findSubexprs

Description

Find common sub-expressions in expr.

Usage

findSubexprs(expr, simplify = FALSE, tag = ".expr", verbose = FALSE, ...)

Arguments

expr

An expression represented in a variety of ways. See Details.

simplify

Whether to simplify.

tag

to be attached to the returned object(s)

verbose

If TRUE, then diagnostic output will be printed as derivatives and simplifications are recognized.

...

Additional arguments, passed to nlsSimplify

.

Details

If expr contains repeated subexpressions, this function returns an expression to evaluate them just once and store them in temporary variables with names starting with the tag.

This function is used internally by codeDeriv.

Examples

Run this code
findSubexprs(expression(x^2 + x^2), tag = ".example")

Run the code above in your browser using DataLab