Class Polynomial<T extends Number>

java.lang.Object
org.moddingx.libx.util.math.Polynomial<T>
All Implemented Interfaces:
Function<T,T>, UnaryOperator<T>
Direct Known Subclasses:
DoublePolynomial, IntPolynomial

public abstract class Polynomial<T extends Number> extends Object implements UnaryOperator<T>
Represents a polynomial with coefficients of type T.
  • Constructor Details

    • Polynomial

      protected Polynomial()
  • Method Details

    • coefficients

      public abstract List<T> coefficients()
      Gets the coefficients of this polynomial. For example, the coefficients [2, 0 1] represent the polynomial 2x²+1.
    • derivative

      public abstract Polynomial<T> derivative()
      Computes the derivative of this polynomial.
    • negate

      public abstract Polynomial<T> negate()
      Negates this polynomial.
    • add

      public abstract Polynomial<T> add(Polynomial<T> other)
      Adds two polynomials together.
    • subtract

      public Polynomial<T> subtract(Polynomial<T> other)
      Subtracts two polynomials from each other.
    • multiply

      public abstract Polynomial<T> multiply(Polynomial<T> other)
      Multiplies two polynomials.
    • toString

      public String toString()
      Overrides:
      toString in class Object