Constructs a Modified Akima interpolator given the vectors of abscissas, ordinates, and derivatives.
Usage
makima(x, y, left_endpoint_derivative = NULL, right_endpoint_derivative = NULL)
Arguments
- x
Numeric vector of abscissas (x-coordinates).
- y
Numeric vector of ordinates (y-coordinates).
- left_endpoint_derivative
Optional numeric value of the derivative at the left endpoint.
- right_endpoint_derivative
Optional numeric value of the derivative at the right endpoint.
Value
An object of class makima
with methods:
interpolate(xi)
: Evaluate the interpolator at point xi
.
prime(xi)
: Evaluate the derivative of the interpolator at point xi
.
push_back(x, y)
: Add a new control point
Examples
x <- c(0, 1, 2, 3)
y <- c(0, 1, 0, 1)
interpolator <- makima(x, y)
xi <- 0.5
interpolator$interpolate(xi)
#> [1] 0.7291667
interpolator$prime(xi)
#> [1] 1.208333
interpolator$push_back(4, 1)