Package noaa.coastwatch.util
Class LagrangeInterpolator
java.lang.Object
noaa.coastwatch.util.Function
noaa.coastwatch.util.LagrangeInterpolator
- All Implemented Interfaces:
Encodable
A Lagrange interpolator uses a set of known function data to
interpolate function values between data points. The interpolator
makes use of the Lagrange polynomial method as describe in:
Burden, R.L., and J.D Faires. "Numercial Analysis", Sixth Ed., Brooks/Cole Publishing, 1997, pp 107-111.Briefly, the interpolator derives an (n-1)th order polynomial using the n known data points (xi, yi) where i=1..n with the formula:
P(x) = SUM(i=1..n) { yiLi(x) }where:
Li(x) = PRODUCT(j=1..n,j!=i) { (x-xj) / (xi - xj) }
- Since:
- 3.1.3
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorDescriptionLagrangeInterpolator
(double[] x, double[] y) Creates a new Lagrangian interpolator based on the specified data. -
Method Summary
Modifier and TypeMethodDescriptiondouble
evaluate
(double[] variables) Evalutes a function value with the specified inputs.Methods inherited from class noaa.coastwatch.util.Function
getEncoding, useEncoding
-
Constructor Details
-
LagrangeInterpolator
public LagrangeInterpolator(double[] x, double[] y) Creates a new Lagrangian interpolator based on the specified data.- Parameters:
x
- the x data values.y
- the y function values corresponding to x1..xn.
-
-
Method Details
-
evaluate
public double evaluate(double[] variables) Description copied from class:Function
Evalutes a function value with the specified inputs.
-