org.opensourcephysics.numerics
Class Interpolation

java.lang.Object
  extended by org.opensourcephysics.numerics.Interpolation

public class Interpolation
extends java.lang.Object

Class Interpolation defines simple interpolation algorithms. This class cannot be subclassed or instantiated because all methods are static.

Author:
Wolfgang Christian

Method Summary
static double lagrange(double x, double[] xd, double[] yd)
          Lagrange polynomial interpolation at a single point x.
static double linear(double x, double x0, double x1, double y0, double y1)
          Linear interpolation at a single point x.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

linear

public static double linear(double x,
                            double x0,
                            double x1,
                            double y0,
                            double y1)
Linear interpolation at a single point x.

Parameters:
x - double
x0 - double
x1 - double
y0 - double
y1 - double
Returns:
double

lagrange

public static double lagrange(double x,
                              double[] xd,
                              double[] yd)
Lagrange polynomial interpolation at a single point x. Because Lagrange polynomials tend to be ill behaved, this method should be used with care. A LagrangeInterpolator object should be used if multiple interpolations are to be performed using the same data.

Parameters:
x - double
xd - double[] the x data
yd - double[] the y data
Returns:
double