Interpolation Type

This type contains functionalities to perform various interpolation methods for two dimensional data. It summarizes functions contained within the interpolation module.

Constructors

Constructor Description

Interpolation()

Full Usage: Interpolation()

Returns: Interpolation
Returns: Interpolation

Static members

Static member Description

Interpolation.getFirstDerivative coef

Full Usage: Interpolation.getFirstDerivative coef

Parameters:
Returns: float -> float Function that takes an x value and returns the corresponding slope.

Takes interpolation coefficients to create a function that calculates the slope of the interpolation function.

X values that don't lie within the range of the input x values, may fail or are predicted using the nearest interpolation line!

coef : InterpolationCoefficients

Interpolation coefficients

Returns: float -> float

Function that takes an x value and returns the corresponding slope.

Example

 
 // e.g. days since a certain event
 let xData = vector [|0.;1.;5.;4.;3.;|]
 // some measured feature
 let yData = vector [|1.;5.;4.;13.;17.|]
 
 // get slopes and intersects for interpolating straight lines
 let coefficients = 
     Interpolation.interpolate(xData,yData,InterpolationMethod.LinearSpline)
 
 // get coefficient for interpolating straight lines
 let coefLinSpl = Interpolation.interpolate(xData,yData,InterpolationMethod.LinearSpline)

 // get first derivative
 let func = Interpolation.getFirstDerivative(coefLinSpl)

 // get slope at x=3.4
 func 3.4

Interpolation.getIntegralBetween (coef, x1, x2)

Full Usage: Interpolation.getIntegralBetween (coef, x1, x2)

Parameters:
Returns: float area under the curve between x1 and x2

Takes interpolation coefficients and two x values to calculate the area under the curve within the region flanked by x1 and x2.

coef : InterpolationCoefficients

Interpolation coefficients

x1 : float

interval start

x2 : float

interval end

Returns: float

area under the curve between x1 and x2

Interpolation.getSecondDerivative coef

Full Usage: Interpolation.getSecondDerivative coef

Parameters:
Returns: float -> float Function that takes an x value and returns the corresponding curvature.

Takes interpolation coefficients to create a function that calculates the curvature of the interpolation function.

X values that don't lie within the range of the input x values, may fail or are predicted using the nearest interpolation line!

coef : InterpolationCoefficients

Interpolation coefficients

Returns: float -> float

Function that takes an x value and returns the corresponding curvature.

Example

 
 // e.g. days since a certain event
 let xData = vector [|0.;1.;5.;4.;3.;|]
 // some measured feature
 let yData = vector [|1.;5.;4.;13.;17.|]
 
 // get slopes and intersects for interpolating straight lines
 let coefficients = 
     Interpolation.interpolate(xData,yData,InterpolationMethod.Polynomial)
 
 // get coefficients for interpolating polynomial
 let coef = Interpolation.interpolate(xData,yData,InterpolationMethod.PolynomialCoef)

 // get second derivative
 let func = Interpolation.getSecondDerivative(coef)

 // get curvature at x=3.4
 func 3.4

Interpolation.interpolate (xValues, yValues, method)

Full Usage: Interpolation.interpolate (xValues, yValues, method)

Parameters:
    xValues : float array - Input x values. Must not contain duplicates.
    yValues : float array - Input y values
    method : InterpolationMethod - Interpolation Method

Returns: InterpolationCoefficients Coefficients for interpolation function.

Determines interpolation coefficients for two dimensional data. CubicSpline, AkimaSpline and HermiteSpline use piecewise cubic splines.

xValues : float array

Input x values. Must not contain duplicates.

yValues : float array

Input y values

method : InterpolationMethod

Interpolation Method

Returns: InterpolationCoefficients

Coefficients for interpolation function.

Example

 
 // e.g. days since a certain event
 let xData = vector [|0.;1.;5.;4.;3.;|]
 // some measured feature
 let yData = vector [|1.;5.;4.;13.;17.|]
 
 // get coefficient for interpolating straight lines
 Interpolation.interpolate(xData,yData,InterpolationMethod.LinearSpline)
 // get coefficient for interpolating cubic spline with periodic behaviour
 Interpolation.interpolate(xData,yData,InterpolationMethod.CubicSpline CubicSpline.BoundaryCondition.Periodic)

Interpolation.predict coef

Full Usage: Interpolation.predict coef

Parameters:
Returns: float -> float Function that takes an x value and returns the corresponding y value.

Takes interpolation coefficients to create a interpolation function.

X values that don't lie within the range of the input x values, may fail or are predicted using the nearest interpolation line!

coef : InterpolationCoefficients

Interpolation coefficients

Returns: float -> float

Function that takes an x value and returns the corresponding y value.

Example

 
 // e.g. days since a certain event
 let xData = vector [|0.;1.;5.;4.;3.;|]
 // some measured feature
 let yData = vector [|1.;5.;4.;13.;17.|]
 
 // get slopes and intersects for interpolating straight lines
 let coefficients = 
     Interpolation.interpolate(xData,yData,InterpolationMethod.LinearSpline)
 
 // get coefficient for interpolating straight lines
 let coefLinSpl = Interpolation.interpolate(xData,yData,InterpolationMethod.LinearSpline)

 // get interpolating function
 let func = Interpolation.predict(coefLinSpl)

 // get y value at x=3.4
 func 3.4