Learn R Programming

sephora (version 0.1.31)

local_min_max: 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)

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 returns NA.

  • 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? A min or a max?

Arguments

f

function expression

f1der

function expression of first derivative of f

f2der

function expression of second derivative of f

what

character. What to look for? A local min or a max?

x0

numeric givin global minimum or maximum of f over the the interval D.

D

numeric vector specifying the interval over which f is optimized

Details

This function looks for critical values over the interval [D[1],x0-1) \(\cup\) (x0+1, D[length(D)]].

See Also

global_min_max, phenopar