Class PolynomialInterval

java.lang.Object
org.chsrobotics.lib.math.PolynomialInterval

public class PolynomialInterval extends Object
Representation of a standard polynomial function, with restrictions on the upper and lower limits of the domain.
  • Constructor Details

    • PolynomialInterval

      public PolynomialInterval(Map<Integer,Double> terms)
      Constructs a PolynomialInterval.
      Parameters:
      terms - A map of exponent degrees to the coefficient associated with them. For example, the equation 2x^5 - 3x + 5 would be encoded as a map of (5,2), (1,-3), (0,5). Exponents can be negative, but care should be taken to avoid domain issues (0 should not be part of the allowable values if there are negative exponents).
  • Method Details

    • sample

      public Double sample(double reference)
      Samples the polynomial at a certain value.
      Parameters:
      reference - The value to sample the polynomial for.
      Returns:
      The output of the polynomial function.