Description Usage Arguments Value Note Author(s) Examples
Approximates the minimum of a function given on a grid. Quadratic approximation around the point where the mimimal function value is observed is used (if that point is in the interior).
1 |
x |
Vector with the x-values at which the function is observed. Should be sorted. |
y |
Vector with the function values. |
which |
Defines which miminum we want to find. Possible values are "global" for the global minimum, "left" for the left-most local minimum and "right" for the right-most local minimum. Abbreviations ("g", "r", "gl", etc.) may be used. |
count.minima |
If TRUE, the number of local minima in the observed function values is returned. |
verbose |
If TRUE, the routine will give a warning if any exceptions occur. |
A list with the following elements is returned:
xmin |
The x-coordinate of the minimum. |
ymin |
The approximate value of the function at the minimum. |
nmin |
The number of local minima in the y-vector (if requested, otherwise 0). |
excep |
Indicates whether an exeption has occurred: -1 if the minimum was found at the left end, 1 if the minimum was found at the right end, 5 if the minimum was in the middle but the quadratic fit yielded a location of the minimum which was outside of the interval defined by the three points used for the quadratic fit and 0 in all other cases. |
The vector x must be sorted.
Berwin A Turlach Berwin.Turlach@gmail.com
1 2 3 | x <- -100:100/50
y <- x*x
getmin(x,y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.