xptr_eval | R Documentation |
This function is used in plot.itp
to plot a function and
the root estimated by itp
.
xptr_eval(x, pars, xpsexp)
x |
The main argument of the function. |
pars |
A list of additional arguments to the function. This may be an empty list. |
xpsexp |
An external pointer to a C++ function. |
See the Passing user-supplied C++ functions article in the Rcpp Gallery for information.
A numeric scalar: the value of the C++ function evaluated at the
input values x
and pars
.
xptr_create
for creating an external pointer to a
C++ function.
lambert_ptr <- xptr_create("lambert")
res <- itp(lambert_ptr, c(-1, 1))
# Value at lower limit
xptr_eval(-1, list(), lambert_ptr)
# Value at upper limit
xptr_eval(1, list(), lambert_ptr)
# Value at the estimated root
xptr_eval(res$root, list(), lambert_ptr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.