Description Usage Arguments Details Value Author(s) References Examples
View source: R/maximizeInterpolant.R
Maximize a function given a table of values by spline interpolation.
1 | maximizeInterpolant(x, y)
|
x |
numeric vector of the inputs of the function. |
y |
numeric matrix of function values at the values of |
Calculates the cubic spline interpolant for each row the method of Forsythe et al (1977) using the function fmm_spline
from splines.c
in the stats
package).
Then calculates the derivatives of the spline segments adjacant to the input with the maximum function value.
This allows identification of the maximum of the interpolating spline.
numeric vector of input values at which the function maximums occur.
Aaron Lun, improving on earlier code by Gordon Smyth
Forsythe, G. E., Malcolm, M. A. and Moler, C. B. (1977). Computer Methods for Mathematical Computations, Prentice-Hall.
1 2 3 | x <- seq(0,1,length=10)
y <- rnorm(10,1,1)
maximizeInterpolant(x,y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.