Class FunctionExpander

java.lang.Object
com.github.gbenroscience.math.numericalmethods.FunctionExpander

public class FunctionExpander extends Object
Uses Chebyshev Polynomials to expand, evaluate, differentiate and integrate functions
Author:
GBEMIRO
  • Constructor Details

    • FunctionExpander

      public FunctionExpander(MethodHandle function, double lower, double upper, int degree) throws Throwable
      Throws:
      Throwable
    • FunctionExpander

      public FunctionExpander(MethodHandle function, double lower, double upper, double tolerance) throws Throwable
      Throws:
      Throwable
    • FunctionExpander

      public FunctionExpander(Function function, double lower, double upper, int degree)
    • FunctionExpander

      public FunctionExpander(Function function, double lower, double upper, double tolerance)
  • Method Details

    • setLower

      public void setLower(double lower)
    • getLower

      public double getLower()
    • setUpper

      public void setUpper(double upper)
    • getUpper

      public double getUpper()
    • evaluate

      public double evaluate(double x)
      Evaluate the approximated polynomial using Clenshaw's Algorithm. This is O(N) and much more stable than evaluating a^n + b^n-1...
    • derivative

      public double derivative(double x)
      Computes the derivative of the approximation at point x. This is an exact derivative of the surrogate polynomial.
    • integrateApproximation

      public double integrateApproximation()
      Integrates the approximated polynomial analytically using Kahan summation. This preserves the precision of the high-frequency coefficients.
    • buildPolynomial

      public String buildPolynomial()
    • getTailError

      public double getTailError()
      Estimates the truncation error of the current approximation. For 16dp accuracy, this should be invalid input: '<' 1e-16.
    • main

      public static void main(String[] args)