math.numerics
Class LegendreInterpolator

java.lang.Object
  extended by math.numerics.LegendreInterpolator
All Implemented Interfaces:
Function

public class LegendreInterpolator
extends java.lang.Object
implements Function

LegendreInterpolator uses a polynomial interpolation formula to evaluate values between data points.

Version:
1.0
Author:
W. Christian

Constructor Summary
LegendreInterpolator(double[] xdata, double[] ydata)
          Constructs a Legendre interpolating polynomial from the given data.
 
Method Summary
 double evaluate(double x)
          Computes the interpolated y value for a given x value.
 double[] getCoefficients()
          Gets the polynomial coefficients c in c[0] + c[1] * x + c[2] * x^2 + ....
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LegendreInterpolator

public LegendreInterpolator(double[] xdata,
                            double[] ydata)
Constructs a Legendre interpolating polynomial from the given data.

Parameters:
xdata - double[]
ydata - double[]
Method Detail

evaluate

public double evaluate(double x)
Computes the interpolated y value for a given x value.

Specified by:
evaluate in interface Function
Parameters:
aNumber - x value.
Returns:
interpolated y value.

getCoefficients

public double[] getCoefficients()
Gets the polynomial coefficients c in c[0] + c[1] * x + c[2] * x^2 + .... This routine should be used with care because the Vandermonde matrix that is being solved is ill conditioned. See Press et al.

Returns:
double[]