The formula of polynomial in Newton form is p(x) = a[0] + a[1](x-c[0]) + a[2](x-c[0])(x-c[1]) + ... + a[n](x-c[0])(x-c[1])...(x-c[n-1]) Note that the length of a[] is one more than the length of c[]
| Modifier and Type | Field and Description |
|---|---|
| private final double[] | a
When all c[i] = 0, a[] becomes normal polynomial coefficients, i.e. a[i] = coefficients[i]. |
| private final double[] | c
Centers of the Newton polynomial. |
| private double[] | coefficients
The coefficients of the polynomial, ordered by degree -- i.e. coefficients[0] is the constant term and coefficients[n] is the coefficient of x^n where n is the degree of the polynomial. |
| private boolean | coefficientsComputed
Whether the polynomial coefficients are available. |
| Access | Constructor and Description |
|---|---|
| public | PolynomialFunctionNewtonForm(double[]
Coefficients in Newton form formula. a, double[] Centers. c)Construct a Newton polynomial with the given a[] and c[]. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public int | |
| public static double | Returns: the function value.Coefficients in Newton form formula. a, double[] Centers. c, double Point at which the function value is to be computed. z)Evaluate the Newton polynomial using nested multiplication. |
| public double[] | |
| public double[] | Returns: a fresh copy of the coefficients array.Returns a copy of the coefficients array. |
| public double[] | Returns: a fresh copy of coefficients in Newton form formulaReturns a copy of coefficients in Newton form formula. |
| public double | Returns: the function value.Point at which the function value is to be computed. z)Implements org. Calculate the function value at the given point. |
| public DerivativeStructure | value(final DerivativeStructure
function input value t)Implements org. Simple mathematical function. |
| protected static void | verifyInputArray(double[]
the coefficients in Newton form formula a, double[] the centers c)Verifies that the input arrays are valid. |
| a | back to summary |
|---|---|
| private final double[] a When all c[i] = 0, a[] becomes normal polynomial coefficients, i.e. a[i] = coefficients[i]. | |
| c | back to summary |
|---|---|
| private final double[] c Centers of the Newton polynomial. | |
| coefficients | back to summary |
|---|---|
| private double[] coefficients The coefficients of the polynomial, ordered by degree -- i.e. coefficients[0] is the constant term and coefficients[n] is the coefficient of x^n where n is the degree of the polynomial. | |
| coefficientsComputed | back to summary |
|---|---|
| private boolean coefficientsComputed Whether the polynomial coefficients are available. | |
| PolynomialFunctionNewtonForm | back to summary |
|---|---|
| public PolynomialFunctionNewtonForm(double[] a, double[] c) throws NullArgumentException, NoDataException, DimensionMismatchException Construct a Newton polynomial with the given a[] and c[]. The order of centers are important in that if c[] shuffle, then values of a[] would completely change, not just a permutation of old a[]. The constructor makes copy of the input arrays and assigns them.
| |
| computeCoefficients | back to summary |
|---|---|
| protected void computeCoefficients() Calculate the normal polynomial coefficients given the Newton form. It also uses nested multiplication but takes O(N^2) time. | |
| degree | back to summary |
|---|---|
| public int degree() Returns the degree of the polynomial.
| |
| evaluate | back to summary |
|---|---|
| public static double evaluate(double[] a, double[] c, double z) throws NullArgumentException, DimensionMismatchException, NoDataException Evaluate the Newton polynomial using nested multiplication. It is also called Horner's Rule and takes O(N) time.
| |
| getCenters | back to summary |
|---|---|
| public double[] getCenters() Returns a copy of the centers array. Changes made to the returned copy will not affect the polynomial.
| |
| getCoefficients | back to summary |
|---|---|
| public double[] getCoefficients() Returns a copy of the coefficients array. Changes made to the returned copy will not affect the polynomial.
| |
| getNewtonCoefficients | back to summary |
|---|---|
| public double[] getNewtonCoefficients() Returns a copy of coefficients in Newton form formula. Changes made to the returned copy will not affect the polynomial.
| |
| value | back to summary |
|---|---|
| public double value(double z) Implements org. Calculate the function value at the given point.
| |
| value | back to summary |
|---|---|
| public DerivativeStructure value(final DerivativeStructure t) Implements org. Doc from org. Simple mathematical function.
| |
| verifyInputArray | back to summary |
|---|---|
| protected static void verifyInputArray(double[] a, double[] c) throws NullArgumentException, NoDataException, DimensionMismatchException Verifies that the input arrays are valid. The centers must be distinct for interpolation purposes, but not for general use. Thus it is not verified here.
| |