public class Polynomial
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
Polynomial()
Don't allow instantiation but do allow overrides.
|
| Modifier and Type | Method and Description |
|---|---|
static double |
evaluateChebyschev(double[] coeffs,
double x)
Evaluates a Chebyschev series.
|
static double |
hornersMethod(double[] polycoefs,
double x)
Evaluate a polynomial expression using Horner's method.
|
protected Polynomial()
public static double hornersMethod(double[] polycoefs,
double x)
polycoefs - Array of polynomial coefficients.
The coefficients should be ordered
with the constant term first and the
coefficient for the highest powered term
last.x - Value for which to evaluate polynomial.Horner's method is given by the following recurrence relation: c[i]*x^i + ... + c[1]*x + c[0] = c[0] + x*(c[i-1]*x^[i-1] + ... + c[1])
Horner's method avoids loss of precision which can occur when the higher-power values of x are computed directly.
public static double evaluateChebyschev(double[] coeffs,
double x)
coeffs - The Chebyschev polynomial coefficients.x - The value for which to evaluate
the polynomial.