View source: R/critical_points.R
| vc_critical_points | R Documentation |
Search for critical-point candidates on a finite interval
vc_critical_points(
f,
interval,
n = 201L,
h = NULL,
x_tol = 1e-08,
slope_tol = 1e-06,
max_iter = 100L
)
f |
Deterministic function accepting a real scalar and returning one finite real scalar. Vectorization is not required. |
interval |
Increasing pair of finite real search bounds. |
n |
Integer number of grid samples, at least 5. |
h |
Positive finite real initial derivative step, or NULL for the heuristic used by vc_derivative(), evaluated with x = x0. |
x_tol |
Positive root refinement tolerance; candidates within 10*x_tol are merged, keeping the smallest sampled derivative residual. |
slope_tol |
Nonnegative absolute tolerance for a stationary candidate. |
max_iter |
Positive integer limit for bracketed root refinement. Bounded local minimization uses stats::optimize() with its own stopping rule. |
Uses vc_derivative(), sign-change root refinement and bounded minimization of absolute derivative near grid minima. All refined residuals are checked again. Low-derivative sampled runs are reported as possible flat intervals, not proved plateaus; isolated refined roots inside them are retained. Continuous stationary sets are not enumerated as infinitely many critical points. Neighborhood classification shares vc_classify_critical(). Known invalid stencils split derivative evidence; sign-change refinement assumes continuity and can miss discontinuities, even-multiplicity roots, narrow features or nonsmooth points. Completeness is never guaranteed. Candidates without derivatives are not stationary.
Plain list with type, interval, points, classifications (full lists), scan (x, value, derivative), flat_intervals, boundary_samples, complete (always FALSE), status and note. status distinguishes unavailable derivatives, found candidates and no detected candidates. refinements records method, bounds, location, residual, status and error message for every attempted refinement; acceptance here means residual acceptance, not a proof of criticality. points includes x, value, derivative, kind, classification and evidence. Boundaries are separate from interior points.
f <- function(x) x^3-3*x
(f |> vc_critical_points(interval=c(-2,2)))$points
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.