edu.northwestern.at.utils.math

## Class Polynomial

- java.lang.Object
- - edu.northwestern.at.utils.math.Polynomial

-     public class Polynomial
      extends java.lang.Object

  Polynomial functions.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Polynomial()` Don't allow instantiation but do allow overrides.

  - ### Method Summary

    Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Polynomial

          protected Polynomial()

      Don't allow instantiation but do allow overrides.

  - ### Method Detail

    - #### hornersMethod

          public static double hornersMethod(double[] polycoefs,
                             double x)

      Evaluate a polynomial expression using Horner's method.
      Parameters:
        `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.
      Returns:
        Polynomial evaluated using Horner's method.

        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.

    - #### evaluateChebyschev

          public static double evaluateChebyschev(double[] coeffs,
                                  double x)

      Evaluates a Chebyschev series.
      Parameters:
        `coeffs` - The Chebyschev polynomial coefficients.
        `x` - The value for which to evaluate the polynomial.
      Returns:
        The Chebyschev polynomial evaluated at x.