umontreal.iro.lecuyer.functionfit
Class PolInterp
- java.lang.Object
-
- umontreal.iro.lecuyer.functions.Polynomial
-
- umontreal.iro.lecuyer.functionfit.PolInterp
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, MathFunction, MathFunctionWithDerivative, MathFunctionWithFirstDerivative, MathFunctionWithIntegral
public class PolInterp extends Polynomial implements java.io.Serializable
Represents a polynomial that interpolates through a set of points. More specifically, let (x0, y0),…,(xn, yn) be a set of points and p(x) the constructed polynomial of degree n. Then, for i = 0,…, n, p(xi) = yi.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description PolInterp(double[] x, double[] y)Constructs a new polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description PolInterpclone()static double[]getCoefficients(double[] x, double[] y)Computes and returns the coefficients the polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]).double[]getX()Returns the x coordinates of the interpolated points.double[]getY()Returns the y coordinates of the interpolated points.java.lang.StringtoString()static java.lang.StringtoString(double[] x, double[] y)Makes a string representation of a set of points.-
Methods inherited from class umontreal.iro.lecuyer.functions.Polynomial
derivative, derivative, derivativePolynomial, evaluate, getCoefficient, getCoefficients, getDegree, integral, integralPolynomial, setCoefficients
-
-
-
-
Constructor Detail
-
PolInterp
public PolInterp(double[] x, double[] y)Constructs a new polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]). This constructs a polynomial of degree n from n+1 points.- Parameters:
x- the x coordinates of the points.y- the y coordinates of the points.- Throws:
java.lang.NullPointerException- if x or y are null.java.lang.IllegalArgumentException- if the lengths of x and y are different, or if less than two points are specified.
-
-
Method Detail
-
getCoefficients
public static double[] getCoefficients(double[] x, double[] y)Computes and returns the coefficients the polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]). This polynomial has degree n and there are n+1 coefficients.- Parameters:
x- the x coordinates of the points.y- the y coordinates of the points.- Returns:
- the coefficients the interpolating polynomial.
-
getX
public double[] getX()
Returns the x coordinates of the interpolated points.- Returns:
- the x coordinates of the interpolated points.
-
getY
public double[] getY()
Returns the y coordinates of the interpolated points.- Returns:
- the y coordinates of the interpolated points.
-
toString
public static java.lang.String toString(double[] x, double[] y)Makes a string representation of a set of points.- Parameters:
x- the x coordinates of the points.y- the y coordinates of the points.- Returns:
- the string representing the points.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classPolynomial
-
clone
public PolInterp clone()
- Overrides:
clonein classPolynomial
-
-
DMelt 3.0 © DataMelt by jWork.ORG