local_min_max {sephora} | R Documentation |
Local minimum and maximum of a real-valued continuous function over an open interval
Description
Gets local minimum and maximum of a given function expression on an interval using basic calculus criteria
Usage
local_min_max(f, f1der, f2der, what = c("min", "max"), x0, D)
Arguments
f |
function expression |
f1der |
function expression of first derivative of |
f2der |
function expression of second derivative of |
what |
character. What to look for? A local |
x0 |
numeric givin global minimum or maximum of |
D |
numeric vector specifying the interval over which |
Details
This function looks for critical values
over the interval [D[1],x0-1)
\cup
(x0+1, D[length(D)]]
.
Value
A list containing:
-
x_opt
numeric giving the critical point where the local min or max is achieved. When local min or max cannot be determined, this function returnsNA
. -
locals
numeric vector giving all critical points satisfying second derivative criteria. -
crtPts
a list with 2 entries:-
x_d1
numeric vector with local critical points over[D[1],x-1)
-
x_d2
numeric vector with local critical points over(x0+1,D[length(D)]]
-
-
type
character, what was found? Amin
or amax
?