Plot method for objects of class "itp" returned from itp.

# S3 method for itp
plot(x, ...)

Arguments

x

An object inheriting from class "itp", a result of a call to itp.

...

Arguments passed to curve, such as graphical parameters.

Value

No return value, only the plot is produced.

Details

Uses curve to produce a plot of the function f provided to itp over the interval within which a root was sought. The estimated root is indicated using a horizontal line drawn at 0 and a vertical line drawn at the estimated root. By default the name of the function f is used as a title, but this can be replaced by supplying the argument main. The interval over which f is plotted can be changed by supplying the arguments from and/or to.

See also

itp for the Interpolate, Truncate, Project (ITP) root finding algorithm.

Examples

# Lambert

# Supplying an R function
lambert <- function(x) x * exp(x) - 1
x <- itp(lambert, c(-1, 1))
plot(x)


# Supplying an external pointer to a C++ function
lambert_ptr <- xptr_create("lambert")
x <- itp(lambert_ptr, c(-1, 1))
plot(x, main = "Lambert")